[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Nullable foreign keys
From: Simone <simozack () yahoo ! it>
Date: 2008-03-28 7:59:57
Message-ID: 47ECA57D.5060508 () yahoo ! it
[Download RAW message or body]
Catriona Johnson ha scritto:
> My question is how do I handle nullable foreign keys? If foreign key
> is null it is not being displayed in the QTableView and there seems to
> be no way of having a null value in a combo box apart from having a
> 'Null' record which I don't really want to do.
I solve this issue by inserting a row with the ID field -1 and the rest
of the columns as null except where there is a foreign key, in which I
insert the value of -1.
My bad english plays against me, so consider this example:
table_1:
ID integer primary key autoincrement,
DESCRIPTION text,
FK_TO_TABLE_2 integer;
TABLE_2:
ID integer primary key autoincrement,
DESCRIPTION text;
The inserted rows are:
TABLE_2:
insert into TABLE_2(ID) values (-1);
TABLE_1:
insert into TABLE_1(ID, FK_TO_TABLE_2) values (-1, -1);
HTH!
Simone
Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic