Hi,
If I set up a query like so,
q1 = auth.accessible_query('read', db.stuff)
q2 = db.stuff.id==3
selected_record = db(q1&q2).select().first() # how to check if
this successfully got db record?
selected_records = db(q1&q2).select() # how to check if
this successfully got db records?
...I want to check if my select() or select().first() was successful and
contains record(s) before executing more code.
These are some ways I thought of doing it, but they have all created
problems in one way or another.
1) if selected_record in locals(): # if query successful,
returns FALSE
2) if selected_record: # code below still
executes even if 'selected_record' does not exist
3) if len(selected_record): # throws row object
has no len attribute error
Thanks for help,
-JL
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.