[Gambas-user] SQLite and INT4 vs. INTEGER

Benoit Minisini gambas at ...1...
Sat Dec 20 19:31:11 CET 2008


On mardi 16 décembre 2008, moon_walker wrote:
> Hi Benoit,
>
> i am developing a cross platform application. The linux side is on GAMBAS
> and the Win side is on
> C#.NET. The common part is the SQLite database.
>
> There is some foreign relations which are coupled with comboboxes.
> So the child table has some foreign key fields joined to parent primary
> keys.
>
> In the parent tables the primary keys are defined as autoincrement. Since i
> was unable to use the type gb.serial at all, i defined this keys in
> SQLite-datamanager in firefox. I realised that SQLite only allows
> autoincrement for primary key INTEGER. However gambas database manager use
> INT4 for the foreign key fields in the child table.
> This causes inconsistency in .NET since it is impossible to create
> relations on type mismatched fields (INT4 vs INTEGER). If i switch all
> related fields to INTEGER then GAMBAS is unable to handle tha databounded
> combobox.
>
> I would prefer that instead of INT4, only INTEGER would be used general by
> SQLite area.
>
> thx
> br
> Attila

I didn't find any clean way to know if a field is an autoincrement field with 
sqlite 3 API. There is a function, but it is not necesarilly compiled in all 
versions of sqlite 3 (and apparently not on Mandriva).

So the AUTOINCREMENT feature is detected by the use of INTEGER, whereas INT4 
is used with norma integer fields.

If I find a way to detect autoincrement fields, you won't have any problem!

-- 
Benoit Minisini




More information about the User mailing list