Re: [web2py] How to pass variables to db.executesql?

2020-11-20 Thread Carlos Correia

On 20/11/20 04:56, Alex Glaros wrote:

for example

    where mytable.id = someWeb2PyVariable

thanks,

Alex Glaros
--
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 web2py+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/fa1cf04c-a01c-40fa-8e00-20295fa46113n%40googlegroups.com 
.


The recomended way is to use parameter 'placeholders', which is a dictionary 
with key-value pairs.


Example:

rows = db.executesql( 'select * from mytable where id = %(id)s', 
placeholders=dict( id=someWeb2PyVariable ) )


Regards,

Carlos Correia
=
MEMÓRIA PERSISTENTE
GSM:  917 157 146 (Signal, WhatsApp)
e-mail: ge...@memoriapersistente.pt
URL: http://www.memoriapersistente.pt
XMPP (Jabber): car...@memoriapersistente.pt
GnuPG: wwwkeys.eu.pgp.net

--
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a0c8eec5-6de9-441c-33bc-ba259b831c28%40memoriapersistente.pt.


[web2py] How to pass variables to db.executesql?

2020-11-19 Thread Alex Glaros
for example 

where mytable.id = someWeb2PyVariable

thanks,

Alex Glaros 

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/fa1cf04c-a01c-40fa-8e00-20295fa46113n%40googlegroups.com.