rabaDB icon indicating copy to clipboard operation
rabaDB copied to clipboard

checking for a boolean to be NOT true

Open wwevo opened this issue 7 years ago • 3 comments

i've been trying for a good hour to get that to work checking if a boolean is NOT set to true. or anything that's NOT set really. i have tried every shown way of querying, sadly, there was no example of a IS NOT ^^

f.addFilter({"authenticated !=": True})

at least runs through, but yields no results i've tried them all. !=, <>, even <= would have sufficed, they all throw errors

i have to resort to pulling all results now and check them later in a loop... :)

could you perhaps add a few more examples? showing different kinds of actions instead of the same action in a dozen different ways?

wwevo avatar Dec 27 '17 20:12 wwevo

Sure :)

The supported operators are: 'LIKE', '=', '<', '>', '=', '>=', '<=', '<>', '!=', 'IS' According to sqlites's doc, the supported types are : TEXT NUMERIC INTEGER REAL and BLOB. Booleans are treated as 0 or 1 and types are assigned to columns. Perhaps that's the reason it did not work, sqlite could have assigned the wrong type to the column.

tariqdaouda avatar Dec 27 '17 21:12 tariqdaouda

Thank you for your reply

Well, they seem to be all type undefined, at least the sqlite database from PyCharm shows undefined. Only rabaID has type integer.

Is there any way to set the type in the raba-class? as far as i could read in the 'docs' there's only primitive for normal fields, and no way to specify anything further?

How would I go about using booleans with your class?

wwevo avatar Dec 28 '17 14:12 wwevo

I wrote rabaDB because I wanted a database for pyGeno with a 100% transparent installation but with Mongodb feel, so I did not include anything for forcing types. However, that sometime implies some negotiations around some sqlite quirks.

What I would do in this case, is to use numbers instead of booleans. Have 0 or negative values for False and the rest for True. Then I would test using > 0 instead of True/False.

tariqdaouda avatar Dec 29 '17 20:12 tariqdaouda