ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Schrader" <tschra...@gmail.com>
Subject Re: How to use a function on a parameter in an "update" mapped statement?
Date Mon, 10 Jul 2006 13:26:10 GMT
Hi Fred,

Does mySQL allow place holders inside of functions for JDBC?  For example:

update jobs
     set clientid=?, summary=?, jobduedate=str_to_date(?)
 where jobid=?

I ran into a similar problem with DB2 on the AS400/iSeries/i5.  Check
out the last entry on
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Environment+Specific+Information

Ted


On 08/07/06, Fred Janon <fjanon@yahoo.com> wrote:
> Hi,
>
> I want to convert a string containing a date in the format dd/month/year
> into a mySQL date format (YYYY/mm/dd) in an update statement. I tried:
>
>   <mapped-statement name="saveJob">
>     update jobs
>         set clientid=#clientId#, summary=#summary#, jobduedate=str_to_date(#dueDate#,
'%d/%m/%Y')
>             where jobid=#id#
>   </mapped-statement>
>
> but it doesn't work or even generate an error, it jut stores 0000/00/00
> in the my SQL DB. I enabled DEBUG on SQL statements and  apparently the
> generated statement by iBatis is:
>
> PreparedStatement: update jobs      set clientid=?, summary=?, jobduedate=?    where
jobid=?
> Parameters: [2, Yellow banner 7, 10/10/2000, 3]
>
> No sign of my function call at all.
>
> Is there a way to get my function call working?
>
> Thanks
>
> Fred
>
>
>
>
>
>

Mime
View raw message