Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #69258
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <guru@digitalfantasy.it> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'parameters': 0.04; 'none:': 0.07; 'subject:query': 0.07; 'advance': 0.07; 'function,': 0.09; 'none):': 0.09; 'parameter': 0.09; 'part,': 0.09; 'subject:()': 0.09; 'python': 0.11; 'def': 0.12; '2.7': 0.14; "%s'": 0.16; "(it's": 0.16; "?',": 0.16; 'hidden,': 0.16; 'received:217.194': 0.16; 'subject:parameters': 0.16; 'substitution': 0.16; 'all.': 0.16; 'charset:iso-8859-15': 0.16; 'code,': 0.22; 'header:User-Agent:1': 0.23; 'format,': 0.24; 'received:192.168.1.100': 0.24; 'query': 0.26; 'pass': 0.26; 'function': 0.29; "i'm": 0.30; 'piece': 0.31; 'another': 0.32; 'something': 0.35; 'but': 0.35; 'thanks': 0.36; 'possible': 0.36; 'received:it': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'received:217': 0.63; 'real': 0.63; 'id,': 0.84; 'subject:Using': 0.84; 'catalog': 0.93 |
| Date | Fri, 28 Mar 2014 09:44:43 +0100 |
| From | Daniele Forghieri <guru@digitalfantasy.it> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Using query parameters subtitution outside of execute() |
| Content-Type | text/plain; charset=ISO-8859-15; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.8662.1395996885.18130.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1395996885 news.xs4all.nl 2973 [2001:888:2000:d::a6]:34328 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:69258 |
Show key headers only | View raw
Hi to all. I'm using sqlite3 with python 2.7 on windows.
I use the query substitution parameters in my query but I need to pass
part of the query to a function, something like (it's not the real
examples, just to clarify the question):
def loadAll(cursor, id, queryAdd = None):
if queryAdd is None:
qry = 'select * from files where catalog = ?'
else:
qry = 'select * from files where catalog = ? and %s' % (queryAdd))
cursor.execute(qry, (id, ))
...
I would like to use the query substitution even when I create, in
another piece of code, the queryAdd part, something like:
queryAdd = cursor.querySubst('enabled = ? and hide = ? and data > ?',
(enabled, hidden, min_date, ))
when the function take care of the date format, quoting the parameter
and so on
It's possible or not ?
Thanks in advance
Daniele Forghieri
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Using query parameters subtitution outside of execute() Daniele Forghieri <guru@digitalfantasy.it> - 2014-03-28 09:44 +0100
csiph-web