Troubles with SMALLINT primary key field

In this forum all bug reports concerning the 6.x branch will be gahtered. You have the possibility to track the bug fix process.

Moderators: EgonHugeist, mdaems

Post Reply
robsonselzelin
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 09.07.2006, 20:56
Contact:

Troubles with SMALLINT primary key field

Post by robsonselzelin »

Using MySQL database, I've created a table with two fields as primary key, first field INTEGER and second field SMALLINT. On Delphi, using TClientDataSet, when I try to delete a record and after that ApplyUpdates(-1) the record is not deleted.

Using ZSQLMonitor and watching delete statement, I noticed that wasn't the delete statement defined in TZUpdateSQL. Debugging Zeoslib source code, I noticed that Zeos couldn't find the record internaly to delete it, so DataSetProvider have to create a DELETE SQL statement but this statement didn't delete the record in database.

Debugging ZAbstractDataSet.pas unit, when a record is deleted, LocateRecord method is called to find it, then Locate method is called so InternalLocate method is called by Locate method.

InternalLocate call CompareFieldsFromResultSet function to compare the values but when one of those KeyValues is Short (SMALLINT in database), the comparetion is:

if CaseInsensitive then
begin
Result := KeyValues.VString =
AnsiUpperCase(ResultSet.GetString(ColumnIndex));
end
else
begin
Result := KeyValues.VString =
ResultSet.GetString(ColumnIndex);
end;

So record is not found by Zeos than DataSetProvider have to generate de DELETE statement, what means that DELETE statement defined by me in TZUpdateSQL is not executed. I switched the SMALLINT field to INT then it works fine but the problem still exists.

I'm using Zeoslib 6.5.1 rev. 79 but it happens with alpha version also.
Last edited by robsonselzelin on 20.07.2006, 13:43, edited 1 time in total.
Terence
Zeos Dev Team
Zeos Dev Team
Posts: 141
Joined: 22.09.2005, 14:11
Location: Stuttgart
Contact:

Post by Terence »

Please complete your bug report..

Which method you are originally calling?
What do you do to delete your record?
ON which Class you call that method?
Which zeos version, which database?
Which exception / problem raises at which codeline?
Did you already applied a working patch (or what do you think has to be fixed) then post it here.
fabian
Post Reply