Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37598
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'though:': 0.07; 'works.': 0.07; 'booth': 0.09; 'received:mail-vc0-f174.google.com': 0.09; '%s,': 0.16; 'expert,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hits': 0.16; 'statement.': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'skip:v 30': 0.20; 'mention': 0.23; 'host': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'updating': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.220.174': 0.29; "i'm": 0.29; 'fri,': 0.30; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85.220': 0.35; 'table': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'next': 0.35; 'but': 0.36; 'being': 0.37; 'skip:v 20': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'date,': 0.65; 'pin': 0.65; '2013': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=6TDqjKFnu/nUez33OHc10ubfEyYuZyfIN1coaftmhhw=; b=bUZZm0K/OoyQJVY0VreU4ZAg5dPlDTQhhRSvhxOR2xd0/pQJtRPQB6tGiW/0thrErY 7pxaB/wEnYU8Xk2wKbdsJt6VKTgf2eh+0PBdUgoZOY009WNrAaUJCwftAb0GuX6OYNG6 6C24Qcqstyb/MHPivN2+ovAcj+D44f8p4FZ/RGWQ8NDZGR2P37FXzRth1HEsm3sYTERA fkg5PkHCoPo8w8VnlRgA3Hgo5QafQmyxgkb0A6j//WqJKWqgltHeutrjsoYVf/OquUE7 fSg7NkDx7eBoCFuJs/38HrkqEm04XSKV7y+MqB2IJ/hv8b6Ir8hGxhEpJfLjVR84DbaB 8Krg== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.156.10 with SMTP id u10mr2291889vcw.28.1359041223204; Thu, 24 Jan 2013 07:27:03 -0800 (PST) |
| In-Reply-To | <XnsA1529BEFD8BCAduncanbooth@127.0.0.1> |
| References | <88306c73-dfa2-44e1-ab0c-d90dba05be1c@googlegroups.com> <mailman.965.1359026737.2939.python-list@python.org> <774065a6-3d15-4cff-88d8-7f822ed1c0b0@googlegroups.com> <mailman.977.1359030166.2939.python-list@python.org> <25438e79-de00-463d-9ae3-7ea63e282e4a@googlegroups.com> <mailman.984.1359034659.2939.python-list@python.org> <mailman.986.1359038146.2939.python-list@python.org> <XnsA1529BEFD8BCAduncanbooth@127.0.0.1> |
| Date | Fri, 25 Jan 2013 02:27:03 +1100 |
| Subject | Re: mysql solution |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.989.1359041225.2939.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1359041225 news.xs4all.nl 6984 [2001:888:2000:d::a6]:40783 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37598 |
Show key headers only | View raw
On Fri, Jan 25, 2013 at 2:19 AM, Duncan Booth
<duncan.booth@invalid.invalid> wrote:
> Ferrous Cranus <nikos.gr33k@gmail.com> wrote:
>
>> I can do that but then i have to use that pin column's value in my
>> next statement.
>>
>> cursor.execute( '''UPDATE visitors SET hits = hits + 1, useros = %s,
>> browser = %s, date = %s WHERE pin = %s AND host = %s''', (useros,
>> browser, date, pin, host))
>
> I'm not MySQL expert, but something like this might work:
>
> cursor.execute('''UPDATE visitors,counter
> SET visitors.hits=visitors.hits+1, visitors.useros=%s,
> visitors.browser =%s, visitors.date=%s
> WHERE visitors.pin=counter.pin AND counter.page = %s
> AND visitors.host=%s''',
> (useros, browser, date, page, host))
Not sure that that works. This should, though:
UPDATE visitors SET hits=hits+1,blah,blah WHERE visitors.pin=(SELECT
pin FROM counter WHERE page=%s)
I prefer not to mention a table for updating if it's not actually being updated.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 03:04 -0800
Re: mysql solution Chris Angelico <rosuav@gmail.com> - 2013-01-24 22:16 +1100
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 05:31 -0800
Re: mysql solution Chris Angelico <rosuav@gmail.com> - 2013-01-25 01:46 +1100
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 05:31 -0800
Re: mysql solution Lele Gaifax <lele@metapensiero.it> - 2013-01-24 12:25 +0100
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 04:01 -0800
Re: mysql solution Lele Gaifax <lele@metapensiero.it> - 2013-01-24 13:22 +0100
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 05:24 -0800
Re: mysql solution Lele Gaifax <lele@metapensiero.it> - 2013-01-24 14:37 +0100
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 06:35 -0800
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 06:35 -0800
Re: mysql solution Duncan Booth <duncan.booth@invalid.invalid> - 2013-01-24 15:19 +0000
Re: mysql solution Chris Angelico <rosuav@gmail.com> - 2013-01-25 02:27 +1100
Re: mysql solution Lele Gaifax <lele@metapensiero.it> - 2013-01-24 16:39 +0100
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 10:22 -0800
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 10:22 -0800
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 05:24 -0800
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-24 04:01 -0800
Re: mysql solution Chris Angelico <rosuav@gmail.com> - 2013-01-24 22:29 +1100
Re: mysql solution Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-24 15:43 -0500
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-25 07:43 -0800
Re: mysql solution Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-25 16:56 -0500
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-26 02:35 -0800
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-26 02:35 -0800
Re: mysql solution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-25 07:43 -0800
csiph-web