1. EDBI Returns Value when Value Should Not Be Returned

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.

new topic     » topic index » view message » categorize

2. Re: EDBI Returns Value when Value Should Not Be Returned

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: EDBI Returns Value when Value Should Not Be Returned

jeremy said...

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!

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu