Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.093 X-Spam-Evidence: '*H*': 0.81; '*S*': 0.00; 'mess': 0.09; 'help.': 0.21; 'to:name:python-list@python.org': 0.22; 'skip:\xa0 20': 0.24; 'query': 0.26; 'this:': 0.26; 'received:209.85.217': 0.29; 'database,': 0.30; 'kevin': 0.30; 'message-id:@mail.gmail.com': 0.30; 'subject:Database': 0.31; 'skip:d 20': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'data,': 0.36; 'thanks': 0.36; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'users': 0.40; 'records,': 0.69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=EjlvFEIhPyJMeBEzxLTCFCX1wfQWIAXWaYDVKeg/+i8=; b=g5S616tfVYS5lYogGk5m5XVelE8LtlYiR1f9XSxkbSFRtwduGd5QwyiPGZiXpIVFqR T5hFQWcW5RnwI1mgUXQtwb67I5F5zhydogwazclx7t5Fnuw21tiHeFtCGe9C9RfOixV9 8lRR+QCqmAuCn0Man4+cFNKhyUxDI0w/XK0CbMc7N3LJeg8Han1lUuBoj69ndMFIid25 OylZQoTqQ29kljXfb86xK7uR4cikthh5RXgMzbblUTrN3pc0kk8mIOkc/Jl7LjhxSOgr tuv0dnKGN/pOK69nbWDKFpWcc7Uwup/6idorLCoJNS4OTz09rhBqwkn4n7ipXNdMSCA8 o1Fw== MIME-Version: 1.0 X-Received: by 10.112.190.6 with SMTP id gm6mr3820766lbc.41.1368039179208; Wed, 08 May 2013 11:52:59 -0700 (PDT) Date: Wed, 8 May 2013 14:52:59 -0400 Subject: MySQL Database From: Kevin Holleran To: "python-list@python.org" Content-Type: multipart/alternative; boundary=001a11c2653a50ce2304dc397105 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368039187 news.xs4all.nl 15895 [2001:888:2000:d::a6]:54546 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44957 --001a11c2653a50ce2304dc397105 Content-Type: text/plain; charset=ISO-8859-1 Hello, I want to connect to a MySQL database, query for some records, manipulate some data, and then update the database. When I do something like this: db_c.execute("SELECT a, b FROM Users") for row in db_c.fetchall(): (r,d) = row[0].split('|') (g,e) = domain.split('.') db_c.execute("UPDATE Users SET g = '" + g + "' WHERE a ='" + row[0]) Will using db_c to update the database mess up the loop that is cycling through db_c.fetchall()? Thanks for your help. Kevin --001a11c2653a50ce2304dc397105 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,

I want to connect to a MySQL dat= abase, query for some records, manipulate some data, and then update the da= tabase.

When I do something like this:

=A0 =A0=A0db_c.execute("SELECT a= , b FROM Users")

=A0 =A0 for row in db_c.fetchall():

=A0 =A0 =A0 =A0 (r,d) =3D row[0].split('|')

=A0 =A0 =A0 =A0 (g,e) =3D domain.spli= t('.')

=A0 =A0 =A0 =A0 db_c.execute("UP= DATE Users SET g =3D '" + g + "' = WHERE a =3D'" + row[0])


Will using db_c to update the da= tabase mess up the loop that is cycling through db_c.fetchall()?

Thanks for your help.

Kevin
--001a11c2653a50ce2304dc397105--