On Monday, September 12, 2016 at 12:39:17 PM UTC-7, Meinolf wrote:
>
> Anyone knows the web2py's sqlite syntax to select database records using 
> wildcards such as %like% or contains instead of query = db.mytable.myfield 
> == 'value'?
>
>
According to the book, it's db(db.log.event.like('string%')).select() 
(where I've used the example DB names).
<URL:https://www.youtube.com/watch?v=-7JfNBmcjXo
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#like--ilike--regexp--startswith--endswith--contains--upper--lower>

(I found it a good idea to pretty much read the book through ... I got the 
hardcopy, which is not quite up-to-date now ... and that made it easier to 
search through for answers to specific questions.)

I don't have examples on this computer (instead, the early code here used 
executesql() with "LIKE" in the WHERE clause), but I probably have an 
example at home.

/dps



-- 
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.

Reply via email to