Could this solve the problem?
db.define_table("mytable", Field("myvalue"))
mytable contains:
3 selected
mytable.id
<http://127.0.0.1:8000/booltest/appadmin/select/db?orderby=mytable.id>
mytable.myvalue
<http://127.0.0.1:8000/booltest/appadmin/select/db?orderby=mytable.myvalue>
1 <http://127.0.0.1:8000/booltest/appadmin/update/db/mytable/1> abc
2 <http://127.0.0.1:8000/booltest/appadmin/update/db/mytable/2> bcd
3 <http://127.0.0.1:8000/booltest/appadmin/update/db/mytable/3> def
----------------------------------------------------------------
def testqueries():
queries=[True]
qa = db.mytable.myvalue.contains("a")
qb = db.mytable.myvalue.contains("b")
qc = db.mytable.myvalue.contains("c")
queries.append(qa)
queries.append(qb)
w = db(reduce(lambda a,b: (a&b), queries)).select(db.mytable.ALL)
return locals()
Testqueries
qa :
<Query (LOWER(mytable.myvalue) LIKE '%a%' ESCAPE '\')>
qb :
<Query (LOWER(mytable.myvalue) LIKE '%b%' ESCAPE '\')>
qc :
<Query (LOWER(mytable.myvalue) LIKE '%c%' ESCAPE '\')>
queries :
True
<Query (LOWER(mytable.myvalue) LIKE '%a%' ESCAPE '\')>
<Query (LOWER(mytable.myvalue) LIKE '%b%' ESCAPE '\')>
w :
mytable.idmytable.myvalue
1 abc
----------------------------------------------------------------
def testqueries():
queries=[True]
w = db(reduce(lambda a,b: (a&b), queries)).select(db.mytable.ALL)
return locals()
Testqueries
queries :
True
w :
mytable.idmytable.myvalue
1 abc
2 bcd
3 def
----------------------------------------------------------------
Regards, Martin
2016-11-25 13:32 GMT+01:00 Jurgis Pralgauskis <[email protected]>
:
>
> How are you making your query map reduce?
>>
>>
> query = reduce(lambda a, b: (a & b), queries)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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/d/optout.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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/d/optout.