Hello! Long time no see:
I have a Field 'parameters' of type "list:integer", something like:
db.define_table('operation',
Field('type', 'integer'),
Field('parameters','list:integer')
)
The Field db.operation.parameters has a method 'contains' that I can use in
queries, like in
db(db.operation.parameters.contains(5))
The generated sql uses "LIKE '%|5|%'" (it also uses ESCAPE, though I don't
understand why). For example,
In: db(db.operation.parameters.contains(5))._count()
Out: "SELECT COUNT(*) FROM `operation` WHERE
(LOWER(`operation`.`parameters`) LIKE '%|5|%' ESCAPE '\\');"
But I would like to specify that number 5 must be in the first position,
for instance. I guess there is no hope in Google App Engine NoSQL and the
like, but I only need to work with relational databases. The sql could go
like:
SELECT COUNT(*) FROM `operation` WHERE
(SUBSTR(`operation`.`parameters`,1,3) = '|5|');
And my questions:
- Is there "an obvious way to do it" (maybe more than one :-/ )?
- I have checked with pydal that the order of the integers is respected
in insert, but can I trust that behaviour?
Regards
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/a3948b05-1f68-46b4-9422-29edbe1a578d%40googlegroups.com.