alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

GAE search conditions with 'boolean' do not work (Fixed) #12

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

From robi...@gmail.com on June 18, 2008 14:36:34

What steps will reproduce the problem? 1. every post in db.posts has db.posts.valid=True

  1. db(db.posts.valid==True).select()
  2. returns empty set

What is the expected output?

should return all valid==True rows

What do you see instead?

empty set What version of the product are you using? On what operating system? r263 Please provide any additional information below. I am not even sure how to debug this, is there a way to print the generated GQL?

Original issue: http://code.google.com/p/web2py/issues/detail?id=12

alfonsodg commented 10 years ago

From robi...@gmail.com on June 18, 2008 16:56:08

I found the _select() to output the GQL, and think the problem is that True/False are being quoted, also there is a semi-colon that might not belong in GQL:

"... AND valid='TRUE';"

alfonsodg commented 10 years ago

From robi...@gmail.com on June 18, 2008 17:01:55

This patch removes the quotes and semi-colon

Index: gluon/contrib/gql.py

--- gluon/contrib/gql.py ( revision 263 ) +++ gluon/contrib/gql.py (working copy) @@ -256,8 +256,8 @@ def sql_represent(object,fieldtype,dbname):
if object is None: return '' if fieldtype=='boolean':

regexundot=re.compile("^(?P(([^']'){2})[^'])(?P%s.)(?P._)$"%tablename) while p!=q:

alfonsodg commented 10 years ago

From massimod...@gmail.com on June 18, 2008 17:51:39

Summary: GAE search conditions with 'boolean' do not work (Fixed)
Status: Fixed