1. EDBI Returns Value when Value Should Not Be Returned
- Posted by euphoric (admin) Sep 30, 2011
- 1105 views
Jeremy,
I'm doing a query_object() and not getting the results I expect.
If I do a query on a record that does not exist- for example:
name = "TESTING" res = edbi:query_object( "select tileset_id from tilesets where tileset_name = %s", {name} )
-there's no such record where tileset_name is 'testing.' However, res is set to the integer 101 and error_code() is false.
Therefore, I get a bad result.
Ultimately, what I'm trying to do is determine if such a record already exists. Since tileset_id is an integer, and 101 is an integer, it's a false positive.
How, then, should I be approaching this?
Edit: Oh, BTW, in case it matters, I'm using the SQLite driver.
2. Re: EDBI Returns Value when Value Should Not Be Returned
- Posted by jeremy (admin) Sep 30, 2011
- 1095 views
Yeah, that isn't very intuitive. I'll ponder what to do about that.
As for the detection of an existing record or not, right now you can do:
name = "TESTING" res = edbi:query_object( "select count(*) from tilesets where tileset_name = %s", {name} )
Jeremy
3. Re: EDBI Returns Value when Value Should Not Be Returned
- Posted by euphoric (admin) Sep 30, 2011
- 1134 views
As for the detection of an existing record or not, right now you can do:
name = "TESTING" res = edbi:query_object( "select count(*) from tilesets where tileset_name = %s", {name} )
I started using query_row() and then checking if result is a sequence or not.
Thank you!