Gerry,
On 29 may 2004, at 9:18, Gerry Snyder wrote:
I do not know whether this should be considered a bug. I don't get the data on fields this way. What I do, which gets the info you need, is:
sqlite> CREATE TABLE t1(x INTEGER PRIMARY KEY, y); sqlite> select sql from sqlite_master; CREATE TABLE t1(x INTEGER PRIMARY KEY, y) sqlite>
I hope this helps.
I don't think you understand the problem. Allow me to explain further.
A simple SELECT as shown above is all it takes to see what the schema is for the given table. Great. Excellent.
However, this is not the way you do it programatically, unless you're willing to parse the results manually. This is what PRAGMA show_datatypes = ON is for. Please read the docs. You'll see that with this PRAGMA set, it includes the datatype of the column in the results.
SQLite stores the original SQL statement that created the table. This statement can be retrieved, as you well suggested, querying sqlite_master. The data is there, but SQLite doesn't do its homework when PRAGMA show_datatypes = ON is set. Instead of reporting in the result set that x is a INTEGER PRIMARY KEY, it returns INTEGER and chops out the rest.
This is why I consider it a bug. Sure, there is a workaround, which is to parse the schema manually. But then... why is PRAGMA show_datatypes around? I don't mind parsing the string, and if this is *not* a bug, then I'd like to see a comment on the documentation, because IMHO it's misleading.
Thanks for your comments Gary. I appreciate them very much. I hope Dr. Hipp makes some comments so that I know whether I'm doing something wrong, or if I should indeed write a ticket.
Best regards,
-- Tito
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]