fcl-db: sqlite: starting from SQLite 3.7.16, there is changed output of PRAGMA table_info. Now column "pk" shows order of given column in PK (or zero if column is not a part of PK).

Patch keeps backward compatibility.
Test TestMultipleFieldPKIndexDefs

git-svn-id: trunk@23927 -
This commit is contained in:
lacak 2013-03-19 07:51:29 +00:00
parent 8b7071c8e8
commit 81c8825623

View File

@ -885,10 +885,10 @@ begin
IXFields:=TStringList.Create;
IXFields.Delimiter:=';';
//primary key fields
//primary key fields; 5th column "pk" is zero for columns that are not part of PK
artableinfo := stringsquery('PRAGMA table_info('+TableName+');');
for ii:=low(artableinfo) to high(artableinfo) do
if (high(artableinfo[ii]) >= 5) and (artableinfo[ii][5] = '1') then
if (high(artableinfo[ii]) >= 5) and (artableinfo[ii][5] >= '1') then
PKFields.Add(artableinfo[ii][1]);
//list of all table indexes