On Fri, 12 May 2006, Josh wrote:
With MySQL I would simply do:
SHOW COLUMNS FROM `war3users` LIKE 'playerip';
Can I do something similar in SQLite ?
[...]
Hello Josh,
as far as I know, exactly equivalent functionality does not exist in
SQLite3. But you can use the data you get via
PRAGMA table_info(war3users);
or that which you get via
SELECT * FROM sqlite_master WHERE type = 'table' AND name = 'war3users';
to achieve what you want with a little additional code on your
application's side.
For example one could write in CHICKEN Scheme:
(define (sqlite3:table-has-column? db table column)
(member
column
(sqlite3:map-row
(project 1)
db (sprintf "PRAGMA table_info(~S);" table))))
cu,
Thomas