Page 1 of 1

Bug in GetIndexInfo

Posted: 04.11.2005, 20:52
by the_kique
The statement PRAGMA index_list(Tablename) returns:
For each index on the named table, one record with information about that index. Arguments include the index name and a flag to indicate whether or not the index must be unique.
Then the code in GetIndexInfo of TDdcSQLiteMetadata is wrong because the value of Unique flag is read inverted.
The problem is in the follow lines

if (Pos(' autoindex ', GetString(2)) = 0)
>> and ((Unique = False) or (GetInt(3) <> 0)) then

and

>> Result.UpdateBoolean(4, GetInt(3) <> 0);

They would have to be replaced by

if (Pos(' autoindex ', GetString(2)) = 0)
>> and ((Unique = False) or (GetInt(3) = 0)) then

and

>> Result.UpdateBoolean(4, GetInt(3) = 0);


Thanks in advance.

Sorry my poor english.

Posted: 08.11.2005, 08:48
by aducom
Thank you for the patch, we'll be testing this.

Posted: 16.12.2005, 17:28
by the_kique
Hi.
I know you are very busy, but i really need this patch.
In my work we´ve been working in a project using InstantObjects for persistence, InstantObjects has a database evolve method, but everytime when call the evolve method, this incorrectly delete the indexes and redo again telling the unique flag doesn´t mismatch. That is not a big problem but the users see that like a instability and distrust of the software.
if it can useful the documentation of the pragma statement in sqlite can be found at http://www.sqlite.org/pragma.html#modify
and the instantobject if you want quickly test, you can run the primerdemo after aggregate the zeosdbo support (in uses clausule of main unit), instantobject found at http://www.instantobjects.org/.

Regards.
Again sorry my poor english.