Hi guys,

 

   I'm not sure I've posted at all my previous msg so here it is again with
few more explanation

 

I'm creating a table using the following :

 

#########

CREATE TABLE IF NOT EXISTS `test_table` (

  `test_field1` INTEGER DEFAULT -1,

  `test_field2` INTEGER DEFAULT NULL

);

#########

 

Note the DEFAULT  -1

I then do in firefox sqlitemanager addon (any better tool around to check
inside the DB ?)

 

#########

PRAGMA table_info (test_table)

#########

 

I'm getting the following

 

>>"0","test_field1","INTEGER","0","NULL","0"

>>"1","test_field2","INTEGER","0","NULL","0"

 

I was expecting -1 instead of NULL as default value for the 1st column, can
anyone explain me that ? I've noticed the if I put (-1) instead of -1,
PRAGMA gives me the good default value. That make me wonder if -1 were
interpreted as TEXT and casted into INT? or is it NULL that's interpreted as
TEXT? any idea what happened?

 

Im trying to access this data from a C++ app. When I'm executing the "PRAGMA
table_info(test_table)" from the application and parsing the returned field
and casting field in String, test_field1 is '' and test_field2 is 'NULL',
which is completely different. Is it that in test_field2, the default value
is a TEXT  that couldn't cast into INT ?

 

Can anyone explain me the behavior around that ?

Thanks.

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

Reply via email to