SQLite API - access column names for a query

Q&A's, tips, howto's
Locked
Kirill
Posts: 90
Joined: Wed Oct 31, 2007 1:21 pm

SQLite API - access column names for a query

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: SQLite API - access column names for a query

Post by Lutz »


Kirill
Posts: 90
Joined: Wed Oct 31, 2007 1:21 pm

Re: SQLite API - access column names for a query

Post 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!

Kirill
Posts: 90
Joined: Wed Oct 31, 2007 1:21 pm

Re: SQLite API - access column names for a query

Post 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.

Locked