ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eva Kwan <Eva.K...@huskyenergy.com>
Subject problem with update sql generation
Date Tue, 13 May 2008 18:26:25 GMT
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


Mime
View raw message