-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

danjenkins wrote:
> Hi,
> Without using a wrapper, is there a simple way of accessing a query's
> results using field/column names instead of index offsets?

You are already using a wrapper - sqlite3_get_table.  To solve this
problem you will need to use the "normal" SQLite api which involves
calling sqlite3_prepare, sqlite3_step, sqlite3_column_XXX etc

(Alternatively copy the code for sqlite3_get_table and make it return
one more parameter - a column name list).

You can find out the column name using
http://sqlite.org/c3ref/column_name.html and how many columns there are
using http://sqlite.org/c3ref/column_count.html

You'll need to use the routines as appropriate to your situation.  For
example if you are only looking at one row then you can have a helper
routine that just calls column_name on each column until the match is
found.  If your result set is many rows then you'll want to build some
sort of lookup table to cache the answers.  You may find that most
convenient to do after calling prepare.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIOgPFmOOfHg372QQRAtgRAKDJPfS4Js1uchPEWUASQ2HpE4+0LwCgn8PA
WhgrvaDj1Uexxtz2EpWhIbo=
=2PRC
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to