Is it possible to get some assistance from ooSQLite code regarding NULL values
in SQL statments ?
Lets say you define a table like this (from ooSQLite examples more or less) in
a database
sql = "CREATE TABLE addr_type (" || .endOfLine || -
" id INTEGER PRIMARY KEY," || .endOfLine || -
" somecol TEXT ," || .endOfLine || -
" type TEXT NOT NULL DEFAULT 'Home'" || .endOfLine || -
");"
Now with ooRexx and ooSQlite you use this SQL INSERT stmt
mytype = 'WORK'
somecol_value = '' -- or somecol_value = 'NULL' or somecol_value = .nil or
somecol_value = NULL
i.e somecol_value has NO value (.nil in oorexx, NULL in SQL)
sql = "INSERT INTO addr_type (type,somecol) VALUES('" || mytype || "','" ||
somecol_value || "');"
will give sql --> INSERT INTO addr_type (type,somecol) VALUES('WORK',''); or
INSERT INTO addr_type (type,somecol) VALUES('WORK','NULL');
or INSERT INTO addr_type (type,somecol) VALUES('WORK','.nil object');
Note that SQLite treat the 'NULL' etc as a literal string and not a SQL NULL
in the database the somcol will NOT be NULL ( in terms of SQL) it will have a
value of '' or NULL (as a string) or "....nil object.. (as a string) etc..
My get around for the moment is to do a: SQL = SQL~changestr("'NULL'",NULL)
before the exceution of the database stmnt
that will give INSERT INTO addr_type (type,somecol) VALUES('WORK',NULL); -- no
quotes around NULL
But can it be possible to get support for .nil (NULL) in ooSQLite so the each
sql statement is scanned (to remove the quotes) before handover to SQLite.
/hex------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel