You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by ni...@bnpparibas.com on 2006/03/07 09:44:45 UTC
Bug : "generate" tag does not form SQL statement correctly in "Update" tag
Hi,
I think I found a bug . When I use the "generate" tag in an update
statement and with a parameterMap than contain more than one field to
update, the SQL statement generated by ibatis is incorrect.
For instance ;
<parameterMaps>
<parameterMap id="generate-params-DataUploadTask">
<parameter property="Name" column="NAME"/>
<parameter property="Type" column="TYPE"/>
<parameter property="IdTask" column="IDTASK"/>
</parameterMap>
<parameterMaps>
<update id="update-DataUploadTask" parameterMap
="generate-params-DataUploadTask">
<generate table="DATAUPLOAD_TASK" by="IDTASK"/>
</update>
I got the following logs
IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id:
[update-DataUploadTask] PreparedStatement :
[UPDATE DATAUPLOAD_TASK SET NAME = :0 TYPE = :1 WHERE
IDTASK = :2]
IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id:
[update-DataUploadTask] Parameters:
[:param0=[IdTask,6], :param1=[Name,Updated_20060306190428],
:param2=[Type,RISK]]
IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id:
[update-DataUploadTask] Types:
[:param0=[Int32, System.Int32], :param1=[String, System.String],
:param2=[String, System.String]]
The comma separator is missing. it should be : [UPDATE DATAUPLOAD_TASK
SET NAME = :0, TYPE = :1 WHERE IDTASK = :2]
After having a look into the code, it seems the condition in the iteration
on fields is not good (in the method SqlGenerator.BuildUpdateQuery), ...
;)
Thanks and Regards
NT
PS : Is it the good mail forum to submit such remarks ? or should I use
the developmenet mailing list ?
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
Re: Bug : "generate" tag does not form SQL statement correctly in "Update" tag
Posted by Gilles Bayon <ib...@gmail.com>.
Yes, it's the good mailing-list.
Open a Jira ticket and give a patch if you see where is the problem.
Thanks.
-Gilles
On 3/7/06, nicolas.theron@bnpparibas.com <ni...@bnpparibas.com>
wrote:
>
>
> Hi,
>
> I think I found a bug . When I use the "generate" tag in an update
> statement and with a parameterMap than contain more than one field to
> update, the SQL statement generated by ibatis is incorrect.
> For instance ;
>
> <parameterMaps>
> <parameterMap id="generate-params-DataUploadTask">
> <parameter property="Name" column="NAME"/>
> <parameter property="Type" column="TYPE"/>
> <parameter property="IdTask" column="IDTASK"/>
> </parameterMap>
> <parameterMaps>
>
> <update id="update-DataUploadTask" parameterMap
> ="generate-params-DataUploadTask">
> <generate table="DATAUPLOAD_TASK" by="IDTASK"/>
> </update>
>
> I got the following logs
>
> IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id:
> [update-DataUploadTask] PreparedStatement :
> *[UPDATE DATAUPLOAD_TASK SET NAME = :0 TYPE = :1
> WHERE IDTASK = :2]*
> IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id:
> [update-DataUploadTask] Parameters:
> [:param0=[IdTask,6], :param1=[Name,Updated_20060306190428],
> :param2=[Type,RISK]]
> IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id:
> [update-DataUploadTask] Types:
> [:param0=[Int32, System.Int32], :param1=[String, System.String],
> :param2=[String, System.String]]
>
> The comma separator is missing. it should be : [UPDATE
> DATAUPLOAD_TASK SET NAME = :0, TYPE = :1 WHERE
> IDTASK = :2]
> After having a look into the code, it seems the condition in the iteration
> on fields is not good (in the method SqlGenerator.BuildUpdateQuery), ....
> ;)
>
> Thanks and Regards
>
> NT
>
> PS : Is it the good mail forum to submit such remarks ? or should I use
> the developmenet mailing list ?
>
> This message and any attachments (the "message") is
> intended solely for the addressees and is confidential.
> If you receive this message in error, please delete it and
> immediately notify the sender. Any use not in accord with
> its purpose, any dissemination or disclosure, either whole
> or partial, is prohibited except formal approval. The internet
> can not guarantee the integrity of this message.
> BNP PARIBAS (and its subsidiaries) shall (will) not
> therefore be liable for the message if modified.
>
> ---------------------------------------------
>
> Ce message et toutes les pieces jointes (ci-apres le
> "message") sont etablis a l'intention exclusive de ses
> destinataires et sont confidentiels. Si vous recevez ce
> message par erreur, merci de le detruire et d'en avertir
> immediatement l'expediteur. Toute utilisation de ce
> message non conforme a sa destination, toute diffusion
> ou toute publication, totale ou partielle, est interdite, sauf
> autorisation expresse. L'internet ne permettant pas
> d'assurer l'integrite de ce message, BNP PARIBAS (et ses
> filiales) decline(nt) toute responsabilite au titre de ce
> message, dans l'hypothese ou il aurait ete modifie.
>
>
>