On Mon, Jul 28, 2008 at 8:34 AM, Markus Hoenicka
<[EMAIL PROTECTED]> wrote:
> Thanks for your reply. I'm aware that PRAGMA table_info will allow us
> to read the column names of a particular table. However, we are trying
> to make column names and numbers of arbitrary queries available across
> all database drivers, regardless of whether the query in question
> returns zero or more datasets.
>
> Our sqlite3 driver currently uses sqlite3_get_table() to read the
> results of queries, obviously because it is convenient. I understand
> from your reply that we'd have to switch to the low-level interface
> using prepared statements in order to be able to use
> sqlite3_column_name() et al.

You probably want to look at the "empty_result_callbacks" PRAGMA.
Although the manual only mention sqlite3_exec, it's also used by
sqlite3_get_table().

Note that you will need to change your code to handle the extra "row"
with the column names.

Any way, you will be better off using prepared statements.
sqlite3_get_table is maintained for compatibility with really old code
(there isn't a Unicode equivalent, for example).
The preferred interface is using the sqlite3_prepare_v2() and related API.
sqlite3_get_table() is just a wrapper around the "modern" interface.


Regards,
~Nuno Lucas
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to