[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Kexi Thoughts.......
From:       Adam Pigg <adam () piggz ! fsnet ! co ! uk>
Date:       2003-08-09 18:45:00
[Download RAW message or body]

Hi

I was busy working away on my postgresql driver when i decided it was time to 
add a function to find the primary key for a table.

PostgreSQL stores all keys(primary/unique) in a table pg_index.  To find the 
primary key for a table i query pg_index which for the primay key returns an 
integer array representing the columns that make up the primary key 
(composite key), simple enough.

In a composite key situation, on their own, each column is not nescesserily 
unique, but together they are.

Now i get to reimplementing kexidbrecordset using the mysql driver as a 
starting point.  The findKey function loops round the columns looking for a 
column that has the primarykey boolean set, and sets this column as the key 
field (or the last one it finds).  From what i understand of the code, this 
wouldnt seem to work if a composite key was used.

It may be wise to add a vector/list that represens the primary key and maybe 
another list to store all the unique indexes or as lucijan suggested maybe a 
KexiDBIndex class.

Anyway, for the time being, for simplicities sake im gonna work on the 
assumption that the primary key is a single column which will keep my code 
almost identical to the mysql version.

Just my thoughts

PiggZ 
-- 
adampigg.9p.org.uk
adam@piggz.fsnet.co.uk
adam@adampigg.9p.org.uk

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic