Hey Simon and John, 

First of all, thanks for the advice!

The table has been created using:

CREATE TABLE IF NOT EXISTS t_rp (x SMALLINT, y SMALLINT, z SMALLINT, ap
SMALLINT, m_id INTEGER PRIMARY KEY)

Adding NOT NULL got me an exception when trying to add a 0-coordinate. I
also can't use the command-line tool, since the database is integrated
into the Android OS.

> 
> What evidence do you have to support your assertion that it is stored
> as
>   NULL?

I can query the entire table and print it. Non-zero values are stored
and read perfectly, but for every stored 0, I get back null. I would say
the problem lies in the storing of the 0, turning it into a null.

> 
> As Simon has pointed out, 0 != '0'. If after considering that, you
feel
> you still have a problem, try selecting the offending rows using some
> criteria that are NOT dependant on column z e.g.
> 
> select rowid, z, quoted(z), typeof(z) from t_rp where row is
offending;
> 
> BTW, if your assertion is true, this query should give some output:
> 
> select rowid, z, quoted(z), typeof(z) from t_rp where z is null;

I found the IS NULL somewhere, and that at least enabled me to work
around it, using the some very ugly if-else-statements:

String db_x;
if(x==0) db_x = "(x IS NULL)";
etc.

"SELECT z FROM t_rp WHERE z==0;"
"SELECT z FROM t_rp WHERE z=='0';"
"SELECT z FROM t_rp WHERE z=0;"
"SELECT z FROM t_rp WHERE z='0';"
.. all return 0 rows

"SELECT z FROM t_rp WHERE z IS NULL;"
"SELECT typeof(z) FROM t_rp WHERE z IS NULL;"
.. return the correct number or rows

Greets, Freek


Please help Logica to respect the environment by not printing this email  / 
Pour contribuer comme Logica au respect de l'environnement, merci de ne pas 
imprimer ce mail /  Bitte drucken Sie diese Nachricht nicht aus und helfen Sie 
so Logica dabei, die Umwelt zu schützen /  Por favor ajude a Logica a respeitar 
o ambiente nao imprimindo este correio electronico.



This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to