Bug in GetIndexInfo

Forum related to SQLite

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
the_kique
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 17.10.2005, 21:02
Location: México D.F.

Bug in GetIndexInfo

Post 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.
aducom
Zeos Dev Team
Zeos Dev Team
Posts: 67
Joined: 30.08.2005, 13:21

Post by aducom »

Thank you for the patch, we'll be testing this.
the_kique
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 17.10.2005, 21:02
Location: México D.F.

Post 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.
Post Reply