Re: [sqlite] sqlite3_column_type returns NOT SQLITE_NULL and the following sqlite3_column_text returns with nullptr

2018-09-11 Thread Richard Hipp
On 9/11/18, heribert  wrote:
> I've a prepared select statement (the database is in :memory: based.).
> After binding the input values, calling next, checking the result type
> of a text column, sometimes the follwing sqlite3_column_text returns
> with a nullptr.
>
> The stange thing is: the prior called sqlite3_column_type do not return
> with SQLITE_NULL.

That can happen when SQLite needs to do a type conversion (INTEGER to
TEXT, or UTF-16 to UTF-8, for example) and it is unable to allocate
sufficient memory to carry out the conversion.

How big is your text string?
-- 
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


Re: [sqlite] sqlite3_column_type returns NOT SQLITE_NULL and the following sqlite3_column_text returns with nullptr

2018-09-11 Thread heribert

Thx Gunter...
that's the problem. I've capsuled the sqlite access in some database 
classes. So i have only the call a function named getProperty with some 
parameters.
But in some cases it may be possible that the instance of the object 
calls this function from another thread (with the same stmt).
The main thread reads...  meanwhile the other thread access resets the 
stmt results...


Thx again!

Am 11.09.2018 um 13:58 schrieb heribert:

I've a prepared select statement (the database is in :memory: based.).
After binding the input values, calling next, checking the result type 
of a text column, sometimes the follwing sqlite3_column_text returns 
with a nullptr.


The stange thing is: the prior called sqlite3_column_type do not 
return with SQLITE_NULL.


if  (sqlite3_column_type(_sqlite3_stmt, Field) == SQLITE_NULL)
    return false;

 LPCSTR cp = (LPCSTR)sqlite3_column_text(_sqlite3_stmt, Field);
if (cp == nullptr)
{
    ASSERT(false);
    return false;
}

Is that correct? May it be possible that sqlite3_column_type returns 
NOT SQLITE_NULL and the following sqlite3_column_text returns with 
nullptr?


Thx for any hint
heribert
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users