Re: null values in edbi giving machine-level exception

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy,

Here is some example code. You will need to change your include, driver path and db handle. You may also need to comment out the drop table query the first time.

include /usr/share/euphoria/edbi/edbi/edbi.e 
 
edbi:set_driver_path("/usr/share/euphoria/edbi/drivers") 
edbi:db_handle dbh = edbi:open("sqlite3:///data/sqlite/TM") 
 
edbi:execute("DROP TABLE TEST_NULL;") 
edbi:execute("CREATE TABLE TEST_NULL (ID integer(10) NOT NULL, A TEXT(40) DEFAULT NULL);") 
edbi:execute("INSERT INTO TEST_NULL (ID,A) VALUES (1,'test');") 
edbi:execute("INSERT INTO TEST_NULL (ID,A) VALUES (2, NULL);") 
 
sequence sql, data 
 
sql = "SELECT A FROM TEST_NULL WHERE ID=1;" 
data = edbi:query_rows(sql)	--ok 
object o = data[1] 
puts(1,o[1]) 
 
sql = "SELECT A FROM TEST_NULL WHERE ID=2;" 
data = edbi:query_rows(sql)	--not ok 
o = data[1] 
puts(1,o[1]) 
 
edbi:close() 

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu