mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 10:39:39 +02:00
* fix retrieving AutoInc value when index of autoinc field differs in Fields and in fielddefs
git-svn-id: trunk@19247 -
This commit is contained in:
parent
4c21beb48e
commit
e10071da70
@ -278,7 +278,7 @@ var
|
|||||||
begin
|
begin
|
||||||
//Get AutoInc Field initial value
|
//Get AutoInc Field initial value
|
||||||
if FAutoIncFieldNo <> -1 then
|
if FAutoIncFieldNo <> -1 then
|
||||||
sqlite3_exec(FSqliteHandle, PChar('Select Max(' + Fields[FAutoIncFieldNo].FieldName +
|
sqlite3_exec(FSqliteHandle, PChar('Select Max(' + FieldDefs[FAutoIncFieldNo].Name +
|
||||||
') from ' + FTableName), @GetAutoIncValue, @FNextAutoInc, nil);
|
') from ' + FTableName), @GetAutoIncValue, @FNextAutoInc, nil);
|
||||||
|
|
||||||
FReturnCode := sqlite3_prepare(FSqliteHandle, PChar(FEffectiveSQL), -1, @vm, nil);
|
FReturnCode := sqlite3_prepare(FSqliteHandle, PChar(FEffectiveSQL), -1, @vm, nil);
|
||||||
|
@ -228,7 +228,7 @@ var
|
|||||||
begin
|
begin
|
||||||
//Get AutoInc Field initial value
|
//Get AutoInc Field initial value
|
||||||
if FAutoIncFieldNo <> -1 then
|
if FAutoIncFieldNo <> -1 then
|
||||||
sqlite_exec(FSqliteHandle, PChar('Select Max(' + Fields[FAutoIncFieldNo].FieldName + ') from ' + FTableName),
|
sqlite_exec(FSqliteHandle, PChar('Select Max(' + FieldDefs[FAutoIncFieldNo].Name + ') from ' + FTableName),
|
||||||
@GetAutoIncValue, @FNextAutoInc, nil);
|
@GetAutoIncValue, @FNextAutoInc, nil);
|
||||||
|
|
||||||
FReturnCode := sqlite_compile(FSqliteHandle, PChar(FEffectiveSQL), nil, @vm, nil);
|
FReturnCode := sqlite_compile(FSqliteHandle, PChar(FEffectiveSQL), nil, @vm, nil);
|
||||||
|
Loading…
Reference in New Issue
Block a user