Tito Ciuro wrote:

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.

Very diplomatically said.

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.

I am. In TCL I set up one list with the complete specifications, for cloning a table, and one with just the first word (data type) from each for doing copy commands. A couple dozen lines of code, even with my beginner-level TCL programming.


This is what PRAGMA show_datatypes = ON is for.

Or, this is what you thought it was for.

Please read the docs.

I have. One of your reasons for avoiding sqlite_master is:

> As Kurt very well suggested, one can concentrate the efforts in
> sqlite_master's SQL statement for a given table, but that is a
> dangerous proposition. IMHO, it's an implementation detail that
> should be supported by an API. If one day Dr. Hipp decides to
> improve the internals and decides to change the implementation,
> our code will break in an instant.

There is no indication anywhere I have seen that such a change is in the works. But the docs do say this about your favored method:

"The pragma command is experimental and specific pragma statements may be removed or added in future releases of SQLite. Use this command with caution."

Why on Earth would you want to use this in a program you are afraid might be broken by future SQLite releases? I've read the docs.

Gerry


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to