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 Eva Kwan <Ev...@huskyenergy.com> on 2008/05/13 20:26:25 UTC
problem with update sql generation
Hello
We are running into an issue with the code base in SqlGenerator.cs where the generation of the UPDATE clause is skipping each column that has a name that is part of the name of the column that it is updating by.
Line 204 of SqlGenerator.cs
// Create the set statement
for (int i = 0; i < columnCount; i++)
{
ParameterProperty property = (ParameterProperty) statement.ParameterMap.PropertiesList[i];
// Ignore key columns
if (update.Generate.By.IndexOf(property.ColumnName) < 0)
{
if (i < (columnCount-keysList.Length - 1))
{
output.Append("\t" + property.ColumnName + " = ?,");
}
else
{
output.Append("\t" + property.ColumnName + " = ? ");
}
} else
{
Console.WriteLine("skipping...");
}
}
For example, we have a table named "Trucked_Mass_Ticket" with a pk called "Trucked_Mass_Ticket_Id" and another column named "Mass". The Mass column is being skipped because its IndexOf("Trucked_Mass_Ticket_Id") is > 0. This results in incorrectly generated sql because there are more parameters than place holders.
Is this by design (and something that we should work around) or a bug? Is it fixed in the next release? We are currently using version 1.6.1 .
Thanks
Ka-Wai
Re: problem with update sql generation
Posted by Gilles Bayon <ib...@gmail.com>.
I expected to release the Beta in July.
You can have a look of the V3 current source in
http://svn.apache.org/repos/asf/ibatis/trunk/cs/V3/
--
Cheers,
Gilles
RE: problem with update sql generation
Posted by "Michael McCurrey (5318)" <mi...@pinggolf.com>.
Giles,
How far out do you anticipate V3 being?
________________________________
From: Gilles Bayon [mailto:ibatis.net@gmail.com]
Sent: Tuesday, May 13, 2008 11:59 AM
To: user-cs@ibatis.apache.org
Subject: Re: problem with update sql generation
It's certainly a bug but sql generation in this version is a bit
experimental.
It will improve in the next major version, V3.
--
Cheers,
Gilles
Re: problem with update sql generation
Posted by Gilles Bayon <ib...@gmail.com>.
It's certainly a bug but sql generation in this version is a bit
experimental.
It will improve in the next major version, V3.
--
Cheers,
Gilles