I've a problem with the last insert id when an insert occured on a table with over than 16.000.000 of records.
In this case MySQL-direct return always 1.936.683.040.
The problem is around this code :
//no fields ... it was an executed query (eg insert)
if (field_count = 0) then
begin
faffected_rows:= net_field_length_ll(pos1); //affected rows
finsert_id:=net_field_length_ll(pos1); //last insert id
//we can check for server status
Note: the field for the unique key is INTEGER(10)
Thanks for help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've a problem with the last insert id when an insert occured on a table with over than 16.000.000 of records.
In this case MySQL-direct return always 1.936.683.040.
The problem is around this code :
//no fields ... it was an executed query (eg insert)
if (field_count = 0) then
begin
faffected_rows:= net_field_length_ll(pos1); //affected rows
finsert_id:=net_field_length_ll(pos1); //last insert id
//we can check for server status
Note: the field for the unique key is INTEGER(10)
Thanks for help.
Outside of the unknown server version - would it be possible for me to get access to your server? and run that particular sql couple of times?
I would only need access for a few minutes...
Alternativelly you could try to sniff the communication using ethereal or similar and send me the saved packets ...
Kind regards,
Cristian Nicola
inside uMysqlClient.pas in the:
function net_field_length_ll(var packet: Integer): int64;
try to replace:
result:=a+result shl 32;
with:
result:=(int64(result) shl 32) or a;
Let me know if this changes anything.
Please note that 1.936.683.040 is less than 32 bits so it should not cause any overflow problems ...
Hi,
Thanks for your quick reply.
I'm sorry but there is no access on this server from internet. I tryed your suggest but it give the same result.
The server version is 5.0.18 and it's the same on 5.0.16. If i deactivate this line in net_field_length_ll :
//packet:=packet+9; //8 bytes value
Everything works well in this case.
Any idea ?
If you need it, i will send you packets from ethereal.