Re: [sqlite] How to find the primary key ?

2003-12-30 Thread Kurt Welgehausen
>> Hi Kurt. I could use code to parse out the other stuff too. >> If its written in C/C++, would you be willing to share it? >> >> cheers >> -brett It's a tcl function that returns a list containing a string, 5 lists of strings, and 3 lists of lists of strings. You'd have to translate it. It's

Re: [sqlite] How to find the primary key ?

2003-12-29 Thread Bertrand Mansion
<[EMAIL PROTECTED]> wrote : > Bertrand Mansion wrote: >> Hi, >> >> I have been through the archives on yahoo groups and found a mail that said >> the current way to find the primary key in sqlite is to write your own sql >> parser. This was back in May 2003. >> >> Is this still the only way ? >>

Re: [sqlite] How to find the primary key ?

2003-12-29 Thread Kurt Welgehausen
>> What about PRAGMA table_info('table_name')? You're right. I had forgotten about that, and I took the other fellow's word that there was no suitable pragma. It wouldn't work for me, since I wanted to parse check expressions, foreign keys, and unique columns, but it's certainly a more efficient

Re: [sqlite] How to find the primary key ?

2003-12-28 Thread D. Richard Hipp
Bertrand Mansion wrote: Hi, I have been through the archives on yahoo groups and found a mail that said the current way to find the primary key in sqlite is to write your own sql parser. This was back in May 2003. Is this still the only way ? This looks tough to achieve, there seems to be so many

Re: [sqlite] How to find the primary key ?

2003-12-28 Thread Kurt Welgehausen
You can try splitting the create-table statement on the regular expression [,()]|\s+. (The . is not part of the RE.) Then you need to look at the tokens that match the RE and at the strings between those tokens. With this method, I needed about 400 lines of tcl to do a complete parse with error

[sqlite] How to find the primary key ?

2003-12-28 Thread Bertrand Mansion
Hi, I have been through the archives on yahoo groups and found a mail that said the current way to find the primary key in sqlite is to write your own sql parser. This was back in May 2003. Is this still the only way ? This looks tough to achieve, there seems to be so many things to take into con