Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58322
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'parameters': 0.04; 'insert': 0.05; 'host,': 0.09; 'received:151': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; '"insert': 0.16; '%s,': 0.16; 'emanuele': 0.16; 'nick': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'statements,': 0.16; 'subject:possible': 0.16; 'later': 0.20; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'suggested': 0.26; 'pass': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'subject:list': 0.30; 'writes:': 0.31; 'but': 0.35; "i'll": 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'che': 0.60; 'problems.': 0.60; 'times': 0.62; 'kind': 0.63; 'europe)': 0.84; 'quando': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Lele Gaifax <lele@metapensiero.it> |
| Subject | Re: Retrieving possible list for use in a subsequent INSERT |
| Date | Sat, 02 Nov 2013 12:32:27 +0100 |
| Organization | Nautilus Entertainments |
| References | <l4t7jt$52m$1@dont-email.me> <l4t83c$7cn$1@dont-email.me> <e1b4046c-3180-4ad8-a90a-6e87dd4df6ba@googlegroups.com> <l4ulbn$po8$1@dont-email.me> <l50ft7$qr8$1@dont-email.me> <4ee15327-c09b-4d94-94b6-5b387324fa62@googlegroups.com> <l52ebh$vfk$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | 151.62.33.237 |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
| Cancel-Lock | sha1:Au9Ojy2KZ60kXY2gk5EBcPhzjHY= |
| 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.1949.1383391961.18130.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1383391961 news.xs4all.nl 15986 [2001:888:2000:d::a6]:52502 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:58322 |
Show key headers only | View raw
Nick the Gr33k <nikos.gr33k@gmail.com> writes:
> sql = '''INSERT INTO visitors (counterID, refs, host, city, useros,
> browser, visits, downloads) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)'''
> % (cID, refs, host, city, useros, browser, visits, downloads)
It was suggested *several* times but I'll reiterate: do not use Python
iterpolation to pass parameters to your SQL statements, or you sooner or
later will hit this kind of problems.
To be clear:
>>> myvalue = "Italy, Europe"
>>> mysql = "INSERT INTO sometable (theid, thevalue) VALUES (%s, %s)" % (myid, myvalue)
>>> print(mysql)
INSERT INTO sometable (theid, thevalue) VALUES (theid, Italy, Europe)
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it | -- Fortunato Depero, 1929.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-31 11:24 +0200
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-31 11:32 +0200
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-31 13:19 +0200
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-31 18:49 +0200
Re: Retrieving possible list for use in a subsequent INSERT Christian Gollwitzer <auriocus@gmx.de> - 2013-10-31 19:05 +0100
Re: Retrieving possible list for use in a subsequent INSERT rurpy@yahoo.com - 2013-10-31 12:22 -0700
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-31 23:54 +0200
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-01 00:24 +0200
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-01 17:04 +0200
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-01 17:52 +0200
Re: Retrieving possible list for use in a subsequent INSERT rurpy@yahoo.com - 2013-11-01 19:00 -0700
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-02 10:49 +0200
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-02 12:57 +0200
Re: Retrieving possible list for use in a subsequent INSERT Lele Gaifax <lele@metapensiero.it> - 2013-11-02 12:32 +0100
Re: Retrieving possible list for use in a subsequent INSERT Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-02 12:58 -0400
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-01 17:25 +0200
Re: Retrieving possible list for use in a subsequent INSERT Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-01 11:56 -0400
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-01 18:00 +0200
Re: Retrieving possible list for use in a subsequent INSERT "Paul Simon" <psimon@sonic.net> - 2013-11-01 10:07 -0700
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-01 19:35 +0200
Re: Retrieving possible list for use in a subsequent INSERT "Paul Simon" <psimon@sonic.net> - 2013-11-01 12:19 -0700
Re: Retrieving possible list for use in a subsequent INSERT Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-01 19:12 +0000
Re: Retrieving possible list for use in a subsequent INSERT Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-11-02 02:06 +0200
Re: Retrieving possible list for use in a subsequent INSERT Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-02 16:41 +0000
csiph-web