On Wed, Sep 08, 2010 at 07:01:19PM -0400, Igor Tandetnik wrote: > Schrum, Allan <allan.sch...@rightnow.com> wrote: > > I guess I'm confused as to why sqlite3_column_type() would not work? It > > works for me on queries and I get back either > > SQLITE_INTEGER, SQLITE_FLOAT, or SQLITE3_TEXT. While I know the types could > > be coerced to something else, at least it is an > > answer of what you originally intended the column to be. > > No. sqlite3_column_type returns the type of the value in the given > column and the current row. The type reported by sqlite3_column_type > may change from row to row. It is largely unrelated to the type "you > originally intended the column to be" (SQLite doesn't really have such > a concept; column affinity comes closest, but there's no API to report > it, directly). > > In particular, if the value in the current row is null, > sqlite3_column_type returns SQLITE_NULL.
You can use CHECK() expressions to ensure all values are of the intended type, and you can use NOT NULL to avoid NULL (or treat NULL as being of whatever type sqlite3_column_type() reports). Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users