EuSQL 'EQUALTO' syntax error

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

Matt,

I'm not sure what gives here. Can we not compare fields to an empty string? Is this a bug or did I miss something?

Quick example program:

include "eusql.e" 
 
constant temp_db = "temp.edb" 
object void, query, result 
 
void = create_db( temp_db ) 
void = run_sql( "CREATE TABLE people id AS AUTONUMBER, name AS TEXT, address AS TEXT, city AS TEXT, state AS TEXT, country AS TEXT" ) 
query = parse_sql( "INSERT INTO people name, address, city, state, country VALUES( [@name], [@address], [@city], [@state], [@country] )" ) 
 
set_parameter( "@name", "Greg Haberek" ) 
set_parameter( "@address", "123 Super Secret" ) 
set_parameter( "@city", "Anywhere" ) 
set_parameter( "@state", "XY" ) 
set_parameter( "@country", "USA" ) 
void = run_query( query ) 
 
set_parameter( "@name", "Matthew Lewis" ) 
set_parameter( "@address", "" ) 
set_parameter( "@city", "" ) 
set_parameter( "@state", "" ) 
set_parameter( "@country", "" ) 
void = run_query( query ) 
 
result = run_sql( sprintf("SELECT id FROM people WHERE name = '%s' AND address = '%s'", {"Greg Haberek", "123 Super Secret"}) ) 
if atom( result ) then 
    puts( 2, get_sql_err(result) ) 
    abort( 1 ) 
end if 
 
result = run_sql( sprintf("SELECT id FROM people WHERE name = '%s' AND address = '%s'", {"Matthew Lewis", ""}) ) 
if atom( result ) then 
    puts( 2, get_sql_err(result) ) 
    abort( 1 ) 
end if 
 
close_db( temp_db ) 

Output:

EuSQL Error: ERROR IN 'WHERE' CLAUSE 
Error in clause: 'EQUALTO' syntax error 
NAME = "Matthew Lewis" AND ADDRESS = "" 

-Greg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu