Page 1 of 1

SQLite API - access column names for a query

Posted: Mon Nov 09, 2009 10:42 pm
by Kirill

Code: Select all

sql3:col-names
and

Code: Select all

sql3:col-types
are not mentioned in the documentation of the module for accessing an SQLite database. Still, especially sql3:col-names is useful in situations where one wants to know what columns are returned after doing, e.g. a

Code: Select all

select * from <table>
In this particular case the columns may be retrieved by using

Code: Select all

(sql3:columns <table>)
, but that would be an ugly workaround. What if the user specifies

Code: Select all

select count(*) as count,* from <table>
sql3:col-names would give me the correct number of columns with their names.

I'd like to see a documented accessor to sql3:col-names.

Thanks :)

-- Kirill

Re: SQLite API - access column names for a query

Posted: Tue Nov 10, 2009 1:25 am
by Lutz

Re: SQLite API - access column names for a query

Posted: Tue Nov 10, 2009 11:10 am
by Kirill
Now that it's documented, it is a part of the API and it's safe to use it - it won't just seddenly disappear.

Thank you!

Re: SQLite API - access column names for a query

Posted: Tue Nov 10, 2009 9:58 pm
by Kirill
Lutz, col-names is now not consistent with the rest of the functions. Could you please add a wrapper as for rowid. It's only three lines.

Thank you.