On 27 Mar 2010, at 1:51pm, Greg Bryant wrote:
> From any of the various SQLite admin tools, I can type PRAGMA
> table_info(mytable) and I get a result set back with everything I need.
>
> However, when I move this into my code (we use a front-end class on the
> built-in MSVC SQL wrapper), putting the pragma statement in to replace a
> standard "select y FROM y" fails. Basically:
> db.SetStatement("PRAGMA table_info(mytable)");
> db.PrepareAndExecute(); // this returns success
> db.bind... // bind the first three columns so I can get name and type
> db.Fetch(); // this fails, with the SQLFetch returning a -1.
Sorry but I'm not familiar with your API. But if you use the setup you use for
SELECT, and just use the PRAGMA command instead, it should be working.
> Is there a different API to retrieve the schema on a table by table basis?
Another way to find out everything about your schema is to query the table
sqlite_master. Try this
SELECT * FROM sqlite_master ORDER BY tbl_name,type DESC
Unfortunately, you'll have to parse the results yourself, but it does give you
the equivalent information.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users