#1 2011-03-22 16:09:46

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

empty string and NULL

If I save a record with an empty RAWUTF8 value I'm getting an error reading it back. The first line of IsJSONString is giving an AV accessing a nil string (called by GetJSONValues). I've found that sqlite3_column_type is returning SQLITE_NULL for these fields which seems to cause the problem.

Strangely old data is read fine, it only when adding new records.

Can you give any suggestions where I am going wrong. (using delphi 2007)

Offline

#2 2011-03-22 18:54:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,546
Website

Re: empty string and NULL

I was not able to reproduce it with the source code repository version with low-level test coverage.

But you are 100% right: it's strange with revision 3.7.5 of the database engine: when you write a "" TEXT into the database, it does return a SQLITE_NULL when you retrieve this field...

I've modified the code so that there is no access violation, and that a NULL JSON field content will be decoded as '' when assigned to a string property.

I've also added the corresponding regression test.

Thanks for the feedback.

See http://synopse.info/fossil/info/0fbcfa621e

Offline

#3 2011-03-23 09:56:44

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: empty string and NULL

Thanks, it works fine now.

Offline

Board footer

Powered by FluxBB