To expand on Simon's warning about types: any given column can contain
different types in different rows in sqlite, so examining just the first
row to get the types is not necessarily reliable (but may be for any given
app, depending on how the app inserts/updates data).

----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
On Feb 14, 2012 6:17 PM, "Simon Slavin" <slav...@bigfraud.org> wrote:

>
> On 14 Feb 2012, at 4:50pm, Marc L. Allen wrote:
>
> > Ok.. I just want to make sure I understand.  A SELECT which returns no
> rows will still have a non-zero column count?  And, I would check the
> column count after step() returns SQLITE_DONE?
>
> Yes, the columncount returned will reflect what columns you asked for,
> even if the SELECT returns zero rows.  So if columncount is zero, either
> it's not a SELECT command, or you've somehow managed to make a SELECT which
> returns zero rows.  At least, that's what it did a few releases ago, and I
> see no reason it should have changed.
>
> Worth noting that other commands besides SELECT can also return columns.
>  For instance, PRAGMA.
>
> Also worth noting that using a SELECT which returns no rows, you can
> iterate along the columns and find the column names.  However, you can't
> find the datatypes of the columns, because columns don't have datatypes.
>  Only the data contained in the rows has datatypes, and there are no rows.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to