On 9/13/17, Stadin, Benjamin <benjamin.sta...@heidelberg-mobil.com> wrote:
> Hi,
>
> I was missing a few records in my program. After debugging further, I found
> that sqlite3_column_type () returns SQLITE_NULL for some objects (like 10 in
> 2000), even though these actually contain text data.
>
> Is this normal? And how should I handle it properly (I mean, check if it’s
> proper 0 escaped text for example)?

This is normal.  The sqlite3_value object contains only a NULL, not
any text or numbers.  Internally, the sqlite3_value object caches some
things that helps SQLite to run faster, and some of those cached
buffers might be holding the remains of stale string values.  Ignore
all of that - it is junk at this point.  The only thing that matters
in your sqlite3_value dump below is the "flags" field, which has a
value of 0x0001, which indicates a NULL
(https://sqlite.org/src/artifact/1fe007701?ln=234)

Please note that all this is an implementation detail which often
changes from one release to the next.  The dump of the sqlite3_value
object shown below is valid only for the specific version of SQLite
you are debugging, and might be very different for other versions of
SQLite.

When you start digging down into the content of the sqlite3_value
object, you are looking into low-level implementation details of
SQLite.  This is something that application developers need not worry
with.  You are welcomed to poke around if you want, but please know
that it is not expected nor necessary and that very few
application-level developers get into that much detail, especially
considering that everything you learn will likely be different the
next time you upgrade your SQLite version.


>
> Below is an example object returned by sqlite3_column_value() which is
> reported as SQLITE_NULL.
>
> I’m using the latest SQLite 3.20.1.
>
> Thanks
> Ben
>
> val   sqlite3_value * 0x10201a618     0x000000010201a618
>             u MemValue
>             flags     u16     1
>             enc       u8      '\x01'
>             eSubtype  u8      '\0'
>             n int     6
>             z char *  "BB.999"        0x000000010201e340
>             zMalloc   char *  "BB.999"        0x000000010201e340
>             szMalloc  int     1200
>             uTemp     u32     0
>             db        sqlite3 *       0x100406f10     0x0000000100406f10
>             xDel      void (*)(void *)        NULL    0x0000000000000000
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to