Re: MySQL Problem

2010-09-03 Thread Ian
On 03/09/2010 14:29, Victor Subervi wrote: This is an addendum to my last post. Please observe the following: mysql> select * from spreadsheets where Temp=1; +-++---+-++--+ | ID | Client | Multi | Item| Markup | Temp | +-+

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
On Fri, Sep 3, 2010 at 9:25 AM, Richard Arts wrote: > These are also mere suggestions. > > The statements you use in your print statement and the one you use to > feed the cursor differ slightly. The latter is missing quotes around > your search criterium. > > Isn't it possible to fetch results r

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
This is an addendum to my last post. Please observe the following: mysql> select * from spreadsheets where Temp=1; +-++---+-++--+ | ID | Client | Multi | Item| Markup | Temp | +-++---+-++--

Re: MySQL Problem

2010-09-03 Thread Richard Arts
These are also mere suggestions. The statements you use in your print statement and the one you use to feed the cursor differ slightly. The latter is missing quotes around your search criterium. Isn't it possible to fetch results row by row and see if the missing row is in the set? That way you c

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
On Thu, Sep 2, 2010 at 3:02 PM, Ian wrote: > On 02/09/2010 19:34, Victor Subervi wrote: > >> for some reason running the command through python *omits* this one data!! >> The only difference is that a flag in spreadsheets (Temp) is set to 1. Why >> on earth doesn't it work in python?? >> > Some

Re: MySQL Problem

2010-09-02 Thread Ian
On 02/09/2010 19:34, Victor Subervi wrote: for some reason running the command through python *omits* this one data!! The only difference is that a flag in spreadsheets (Temp) is set to 1. Why on earth doesn't it work in python?? Some ideas to follow up. (These are only guesses). 1) One of t

MySQL Problem

2010-09-02 Thread Victor Subervi
Hi; I have this code: print 'select * from spreadsheets s join products p on p.Item=s.Item join productsCategories pc on p.ID=pc.ProductsID join categories c on pc.CategoryID=c.ID where s.Client="%s" order by c.Category, c.Parent' % (client,) cursor.execute('select * from spreadsheets s jo

Re: Another MySQL Problem

2010-06-26 Thread Victor Subervi
On Fri, Jun 25, 2010 at 2:15 AM, Dennis Lee Bieber wrote: > On Thu, 24 Jun 2010 09:59:41 -0430, Victor Subervi > declaimed the following in > gmane.comp.python.general: > >I could have sworn the concept had been brought up some 8 months > ago... Probably couched in relational database ter

Re: Another MySQL Problem

2010-06-24 Thread Victor Subervi
On Thu, Jun 24, 2010 at 9:34 AM, Stephen Hansen wrote: > On Thu, Jun 24, 2010 at 4:47 AM, Victor Subervi > wrote: > >> On Thu, Jun 24, 2010 at 1:56 AM, John Nagle wrote: >> > Yes. Please post your CREATE statements, so we can see your >>> database schema. If you really have one table per c

Re: Another MySQL Problem

2010-06-24 Thread Stephen Hansen
On Thu, Jun 24, 2010 at 4:47 AM, Victor Subervi wrote: > On Thu, Jun 24, 2010 at 1:56 AM, John Nagle wrote: > Yes. Please post your CREATE statements, so we can see your >> database schema. If you really have one table per client, you're >> doing it wrong. >> > > cursor.execute('create tabl

Re: Another MySQL Problem

2010-06-24 Thread Victor Subervi
On Thu, Jun 24, 2010 at 1:56 AM, John Nagle wrote: > On 6/23/2010 10:59 PM, Dennis Lee Bieber wrote: > >> On Wed, 23 Jun 2010 11:58:24 -0430, Victor Subervi >> declaimed the following in >> gmane.comp.python.general: >> >> >> When I have this code: >>> >> > > >>And yes -- it IS an

Re: Another MySQL Problem

2010-06-23 Thread John Nagle
On 6/23/2010 10:59 PM, Dennis Lee Bieber wrote: On Wed, 23 Jun 2010 11:58:24 -0430, Victor Subervi declaimed the following in gmane.comp.python.general: When I have this code: And yes -- it IS an error... You are AGAIN trying to use parameters for SCHEMA entities, not data.

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 11:20 AM, Victor Subervi wrote: On Wed, Jun 23, 2010 at 12:51 PM, Stephen Hansen wrote: > The problem is not this line but: > > > File "/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py", line > 38, in mailSpreadsheet > cursor.execute('select * from %s', (client

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
On Wed, Jun 23, 2010 at 12:51 PM, Stephen Hansen wrote: > The problem is not this line but: > > > File "/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py", line > 38, in mailSpreadsheet > cursor.execute('select * from %s', (client,)) > > > This one. > Yes, can't use the comma, must

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 9:28 AM, Victor Subervi wrote: Ok, let's start all over again. When I have this code: cursor.execute('select clientEmail from clients where client="%s"', (client.replace('_', ' '),)) clientEmail = cursor.fetchone()[0] Already addressed this. Do not quote inside the SQL.

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 9:12 AM, Paul Rubin wrote: Stephen Hansen writes: On 6/23/10 6:45 AM, Victor Subervi wrote: cursor.execute('select clientEmail from clients where client=%s', ... Do, 'client.replace("_", " ")' instead. Er, look what happened to Little Bobby Tables (a quick web search on

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
Ok, let's start all over again. When I have this code: cursor.execute('select clientEmail from clients where client="%s"', (client.replace('_', ' '),)) clientEmail = cursor.fetchone()[0] I get this error: /var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py 67 68 ''' 69 70

Re: Another MySQL Problem

2010-06-23 Thread Tim Chase
On 06/23/2010 08:45 AM, Victor Subervi wrote: Hi; I have this line: cursor.execute('select clientEmail from clients where client=%s', (string.replace(client, '_', ' '))) clientEmail = cursor.fetchone()[0] cursor.execute('select * from %s' % (client)) client = "Lincoln_Properties" With

Re: Another MySQL Problem

2010-06-23 Thread Tapi
On Wed, 23 Jun 2010 10:46:37 -0430, Victor Subervi wrote: > On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen > wrote: > >> On 6/23/10 6:45 AM, Victor Subervi wrote: >> > Hi; >> > I have this line: >> > >> > cursor.execute('select clientEmail from clients where client=%s', >> > (string.replace(c

Re: Another MySQL Problem

2010-06-23 Thread Paul Rubin
Stephen Hansen writes: >On 6/23/10 6:45 AM, Victor Subervi wrote: >> cursor.execute('select clientEmail from clients where client=%s', ... > Do, 'client.replace("_", " ")' instead. Er, look what happened to Little Bobby Tables (a quick web search on his name should find his story) because someo

Re: Another MySQL Problem

2010-06-23 Thread Simon Malinge
On Wed, 23 Jun 2010 10:46:37 -0430, Victor Subervi wrote: > On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen > wrote: > >> On 6/23/10 6:45 AM, Victor Subervi wrote: >> > Hi; >> > I have this line: >> > >> > cursor.execute('select clientEmail from clients where client=%s', >> > (string.replace(c

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On 6/23/10 8:16 AM, Victor Subervi wrote: > On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen > mailto:pyt...@ixokai.io>> wrote: > > On 6/23/10 6:45 AM, Victor Subervi wrote: > > Hi; > > I have this line: > > > > cursor.execute('select clientEmail from clients where client=%s'

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen wrote: > On 6/23/10 6:45 AM, Victor Subervi wrote: > > Hi; > > I have this line: > > > > cursor.execute('select clientEmail from clients where client=%s', > > (string.replace(client, '_', ' '))) > > clientEmail = cursor.fetchone()[0] > > curso

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On 6/23/10 6:45 AM, Victor Subervi wrote: > Hi; > I have this line: > > cursor.execute('select clientEmail from clients where client=%s', > (string.replace(client, '_', ' '))) > clientEmail = cursor.fetchone()[0] > cursor.execute('select * from %s' % (client)) > > client = "Lincoln_Properti

Another MySQL Problem

2010-06-23 Thread Victor Subervi
Hi; I have this line: cursor.execute('select clientEmail from clients where client=%s', (string.replace(client, '_', ' '))) clientEmail = cursor.fetchone()[0] cursor.execute('select * from %s' % (client)) client = "Lincoln_Properties" With the replacement, the interpreter complains that myd

Re: Yet Another MySQL Problem

2010-05-28 Thread Malcolm Greene
Tim, > The underscore is a valid variable-name, idiomatically used for "I don't care > about this", often seen in places like tuple assignment: The underscore is also used as an alias for gettext.gettext or gettext.ugettext so you may want to use another variable-name. Malcolm -- http://mail.p

Re: Yet Another MySQL Problem

2010-05-28 Thread Victor Subervi
On Thu, May 27, 2010 at 5:47 PM, Tim Chase wrote: > On 05/27/2010 03:32 PM, Victor Subervi wrote: > > On Thu, May 27, 2010 at 1:15 PM, Tim Chase wrote: >> >>> That should be: ', '.join(['%s'] * len(values))) >>> >>> Or as I've done in the past: >>> >>> ', '.join('%s' for _

Re: Yet Another MySQL Problem

2010-05-27 Thread Tim Chase
On 05/27/2010 03:32 PM, Victor Subervi wrote: On Thu, May 27, 2010 at 1:15 PM, Tim Chase wrote: That should be: ', '.join(['%s'] * len(values))) Or as I've done in the past: ', '.join('%s' for _ in values) Huh? Can you describe that underscore to me? Fascinating! The underscor

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 1:15 PM, Tim Chase wrote: > On 05/27/2010 11:56 AM, MRAB wrote: > >> Kushal Kumaran wrote: >> >>>', '.join('%s' * len(values))) >>> >> >> That should be: >> >> ', '.join(['%s'] * len(values))) >> > > Or as I've done in the past: > > ', '.join('%s' for _ in

Re: Yet Another MySQL Problem

2010-05-27 Thread Tim Chase
On 05/27/2010 11:56 AM, MRAB wrote: Kushal Kumaran wrote: ', '.join('%s' * len(values))) That should be: ', '.join(['%s'] * len(values))) Or as I've done in the past: ', '.join('%s' for _ in values) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 12:56 PM, MRAB wrote: > Kushal Kumaran wrote: > [snip] > > Since I'm in a good mood today, here's a little present: >> >> def insert(cursor, table, columns, values): >>"""Insert a row into a table. columns must be a list of column >>names. values must be a list

Re: Yet Another MySQL Problem

2010-05-27 Thread Kushal Kumaran
On Thu, 2010-05-27 at 17:56 +0100, MRAB wrote: > Kushal Kumaran wrote: > [snip] > > Since I'm in a good mood today, here's a little present: > > > > def insert(cursor, table, columns, values): > > """Insert a row into a table. columns must be a list of column > > names. values must be a

Re: Yet Another MySQL Problem

2010-05-27 Thread MRAB
Kushal Kumaran wrote: [snip] Since I'm in a good mood today, here's a little present: def insert(cursor, table, columns, values): """Insert a row into a table. columns must be a list of column names. values must be a list of values for the new row. The columns and values must corr

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 12:11 PM, Kushal Kumaran wrote: > Since I'm in a good mood today, here's a little present: > > def insert(cursor, table, columns, values): >"""Insert a row into a table. columns must be a list of column >names. values must be a list of values for the new row. The

Re: Yet Another MySQL Problem

2010-05-27 Thread Kushal Kumaran
On Thu, 2010-05-27 at 20:47 +0530, Kushal Kumaran wrote: > On Thu, 2010-05-27 at 10:30 -0400, Victor Subervi wrote: > > On Thu, May 27, 2010 at 10:17 AM, Kushal Kumaran > > wrote: > > > > On Thu, 2010-05-27 at 08:34 -0400, Victor Subervi wrote: > > > Hi; > > > I ha

Re: Yet Another MySQL Problem

2010-05-27 Thread Kushal Kumaran
On Thu, 2010-05-27 at 10:30 -0400, Victor Subervi wrote: > On Thu, May 27, 2010 at 10:17 AM, Kushal Kumaran > wrote: > > On Thu, 2010-05-27 at 08:34 -0400, Victor Subervi wrote: > > Hi; > > I have this code: > > > > sql = "insert into %s (%s) va

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 10:17 AM, Kushal Kumaran wrote: > On Thu, 2010-05-27 at 08:34 -0400, Victor Subervi wrote: > > Hi; > > I have this code: > > > > sql = "insert into %s (%s) values ('%%s');" % (personalDataTable, > > string.join(cols[1:], ', ')) > > #cursor.execute(sql, string.join(v

Re: Yet Another MySQL Problem

2010-05-27 Thread Kushal Kumaran
> (Note to self: enterPeople3.py) > > ...and here's another one: > > print 'insert into categories (Store, Category, Parent) > values("%s", "%s", Null)'% (store, cat) > # cursor.execute('insert into ca

Re: Yet Another MySQL Problem

2010-05-27 Thread Kushal Kumaran
On Thu, 2010-05-27 at 08:34 -0400, Victor Subervi wrote: > Hi; > I have this code: > > sql = "insert into %s (%s) values ('%%s');" % (personalDataTable, > string.join(cols[1:], ', ')) > #cursor.execute(sql, string.join(vals[1:], "', '")) > cursor.execute('insert into %s (%s) values ("%

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 8:34 AM, Victor Subervi wrote: > Hi; > I have this code: > > sql = "insert into %s (%s) values ('%%s');" % (personalDataTable, > string.join(cols[1:], ', ')) > #cursor.execute(sql, string.join(vals[1:], "', '")) > cursor.execute('insert into %s (%s) values ("%s"

Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
Hi; I have this code: sql = "insert into %s (%s) values ('%%s');" % (personalDataTable, string.join(cols[1:], ', ')) #cursor.execute(sql, string.join(vals[1:], "', '")) cursor.execute('insert into %s (%s) values ("%s");' % (personalDataTable, string.join(cols[1:], ', '), string.join(va

Re: Another Little MySQL Problem

2010-05-27 Thread Tim Golden
On 26/05/2010 23:24, Christian Heimes wrote: Actually, no. The names of tables are not quoted in SQL. One writes SELECT ID FROM mytable; not SELECT ID FROM "mytable"; nit picking mode: Some RDBMS support case sensitive table names. You have to quote the table name if you using the feature

Re: Another Little MySQL Problem

2010-05-26 Thread Alister
On Wed, 26 May 2010 15:30:16 -0700, John Nagle wrote: > Alister wrote: >> I think you should probably also write your execute differently: >> > clientCursor.execute('select ID from %s' , (personalDataTable,)) >> >> this ensures the parameters are correctly escaped to prevent mysql >> inj

Re: Another Little MySQL Problem

2010-05-26 Thread Christian Heimes
Actually, no. The names of tables are not quoted in SQL. One writes SELECT ID FROM mytable; not SELECT ID FROM "mytable"; nit picking mode: Some RDBMS support case sensitive table names. You have to quote the table name if you using the feature. Yeah I know, it's prett

Re: Another Little MySQL Problem

2010-05-26 Thread John Nagle
Alister wrote: I think you should probably also write your execute differently: clientCursor.execute('select ID from %s' , (personalDataTable,)) this ensures the parameters are correctly escaped to prevent mysql injection attacks,the "," after personalDataTable is necessary to ensure th

Re: Another Little MySQL Problem

2010-05-26 Thread Alister
On Wed, 26 May 2010 12:43:29 -0700, John Nagle wrote: > Kushal Kumaran wrote: >> On Tue, 2010-05-25 at 14:45 -0400, Victor Subervi wrote: >>> Hi; >>> I have this code: >>> >>> clientCursor.execute('select ID from %s' % (personalDataTable)) >>> upds = [itm[0] for itm in clientCursor] print

Re: Another Little MySQL Problem

2010-05-26 Thread John Nagle
Kushal Kumaran wrote: On Tue, 2010-05-25 at 14:45 -0400, Victor Subervi wrote: Hi; I have this code: clientCursor.execute('select ID from %s' % (personalDataTable)) upds = [itm[0] for itm in clientCursor] print "" % upds The problem is that the values passed are 1L, 2L When I r

Re: Another Little MySQL Problem

2010-05-26 Thread Victor Subervi
On Wed, May 26, 2010 at 11:25 AM, Kushal Kumaran wrote: > On Tue, 2010-05-25 at 14:45 -0400, Victor Subervi wrote: > > Hi; > > I have this code: > > > > clientCursor.execute('select ID from %s' % (personalDataTable)) > > upds = [itm[0] for itm in clientCursor] > > print "" % upds > > >

Re: Another Little MySQL Problem

2010-05-26 Thread Kushal Kumaran
On Tue, 2010-05-25 at 14:45 -0400, Victor Subervi wrote: > Hi; > I have this code: > > clientCursor.execute('select ID from %s' % (personalDataTable)) > upds = [itm[0] for itm in clientCursor] > print "" % upds > > The problem is that the values passed are 1L, 2L When I retrieve >

Another Little MySQL Problem

2010-05-25 Thread Victor Subervi
Hi; I have this code: clientCursor.execute('select ID from %s' % (personalDataTable)) upds = [itm[0] for itm in clientCursor] print "" % upds The problem is that the values passed are 1L, 2L When I retrieve them on the other end and try to convert them to integers, guess what happ

Re: Another Strange MySQL Problem

2010-05-22 Thread Victor Subervi
On Fri, May 21, 2010 at 2:40 PM, Tim Chase wrote: > On 05/21/2010 12:31 PM, Victor Subervi wrote: > >> cursor.execute('insert into Baggage values (Null, %s, %s, %s, >> %s)', (flight_id, customer_id, weight, ticket_no)) >> > > You're trying to insert stuff... > > > OperationalError: (1452, 'Ca

Re: Another Strange MySQL Problem

2010-05-21 Thread Tim Chase
On 05/21/2010 12:31 PM, Victor Subervi wrote: cursor.execute('insert into Baggage values (Null, %s, %s, %s, %s)', (flight_id, customer_id, weight, ticket_no)) You're trying to insert stuff... OperationalError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`sea

Another Strange MySQL Problem

2010-05-21 Thread Victor Subervi
Hi; When I try to execute this code from my Python script, I get this error: Traceback (most recent call last): File "/var/www/html/creative.vi/clients/sea-flight/reservations/create_edit_bags3.py", line 38, in ? create_edit_bags3() File "/var/www/html/creative.vi/clients/sea-flight/res

Re: Strange MySQL Problem

2010-05-21 Thread John Nagle
Christian Heimes wrote: MRAB wrote: I think you need to 'commit' any changes to do to the database. Yeah, you are right. Also some RDBMS don't support DDL and DML statements inside one transaction. You may need to commit and begin after the create table DDL. Christian Er, yes. General

Re: Strange MySQL Problem

2010-05-20 Thread Victor Subervi
On Thu, May 20, 2010 at 12:56 PM, MRAB wrote: > > When performing SQL operations, don't insert the values using Python's > string formatting, because that makes it vulnerable to SQL-injection > attacks, ie don't do this: > >cursor.execute(sql_command % values) > > do this: > >cursor.execu

Re: Strange MySQL Problem

2010-05-20 Thread Christian Heimes
MRAB wrote: I think you need to 'commit' any changes to do to the database. Yeah, you are right. Also some RDBMS don't support DDL and DML statements inside one transaction. You may need to commit and begin after the create table DDL. Christian -- http://mail.python.org/mailman/listinfo/pyt

Re: Strange MySQL Problem

2010-05-20 Thread MRAB
Victor Subervi wrote: Hi; I have this code: #!/usr/bin/python import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login def create_edit_passengers4(): print "Content-Type: text/html" print print ''' "http://www.w3.org/TR/xht

Strange MySQL Problem

2010-05-20 Thread Victor Subervi
Hi; I have this code: #!/usr/bin/python import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login def create_edit_passengers4(): print "Content-Type: text/html" print print ''' http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.d

Re: Another MySQL Problem

2009-12-18 Thread John Nagle
MRAB wrote: Victor Subervi wrote: Hi; mysql> truncate tem126072414516; Query OK, 0 rows affected (0.00 sec) Then I run a script: if whatDo == 'insert': try: sql = 'insert into %s (ProdID, Quantity) values ("%s", "%s");' % (tmpTable, prodid, quantity) print sql cursor

Re: Another MySQL Problem

2009-12-13 Thread Victor Subervi
On Sun, Dec 13, 2009 at 1:37 PM, MRAB wrote: > 2. Did you commit the changes? > Ah, yes, caught me napping! db.commit() has bit me in the a$$ again. Thanks, V -- http://mail.python.org/mailman/listinfo/python-list

Re: Another MySQL Problem

2009-12-13 Thread MRAB
Victor Subervi wrote: Hi; mysql> truncate tem126072414516; Query OK, 0 rows affected (0.00 sec) Then I run a script: if whatDo == 'insert': try: sql = 'insert into %s (ProdID, Quantity) values ("%s", "%s");' % (tmpTable, prodid, quantity) print sql cursor.execute(sql)

Another MySQL Problem

2009-12-13 Thread Victor Subervi
Hi; mysql> truncate tem126072414516; Query OK, 0 rows affected (0.00 sec) Then I run a script: if whatDo == 'insert': try: sql = 'insert into %s (ProdID, Quantity) values ("%s", "%s");' % (tmpTable, prodid, quantity) print sql cursor.execute(sql) that runs this (printed

Re: Strange MySQL Problem...

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 14:03:53 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > On Thu, Apr 3, 2008 at 9:34 AM, Gabriel Genellina > <[EMAIL PROTECTED]> > wrote: > > Thank you. I believe you mean by bound, something like this, right? > binary(picdata) > I am now doing that, if I am not mista

Re: Strange MySQL Problem...

2008-04-03 Thread Victor Subervi
On Thu, Apr 3, 2008 at 9:34 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 03 Apr 2008 09:43:57 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > > >> Steve Holden wrote: > >> Define "no longer works". > > Sorry. Throws HTTP 200 error. > > HTTP 200 means OK. Yes. But there is a

Re: Strange MySQL Problem...

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 09:43:57 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: >> Steve Holden wrote: >> Define "no longer works". > Sorry. Throws HTTP 200 error. HTTP 200 means OK. >> > The same remarks I've posted earlier apply here. > Must have missed those. Yes, the code works fine. Repe

Re: Strange MySQL Problem...

2008-04-03 Thread Victor Subervi
Comments in line... On Thu, Apr 3, 2008 at 12:35 AM, John Nagle <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > Define "no longer works". > Sorry. Throws HTTP 200 error. On Thu, Apr 3, 2008 at 12:35 AM, John Nagle <[EMAIL PROTECTED]> wrote: > John Nagle wrote: > > "works fine"? Please ch

Re: Strange MySQL Problem...

2008-04-02 Thread John Nagle
Gabriel Genellina wrote: > En Wed, 02 Apr 2008 16:36:43 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > >> I have this code which works fine: > > "works fine"? Please check again... > The same remarks I've posted earlier apply here. In addition, you're not committing the database up

Re: Strange MySQL Problem...

2008-04-02 Thread Gabriel Genellina
En Wed, 02 Apr 2008 16:36:43 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > I have this code which works fine: "works fine"? Please check again... The same remarks I've posted earlier apply here. > print 'Content-Type: image/jpeg\r\n' > print '\nHi!\n' Don't you see a conflict among th

Re: Strange MySQL Problem...

2008-04-02 Thread Steve Holden
Victor Subervi wrote: > Hi; > I have this code which works fine: > > #!/usr/local/bin/python > import _mysql > import MySQLdb, cPickle > host = 'mysqldb2.ehost-services.com ' > user = 'user' > passwd = 'pass' > db = 'bre' > print 'Content-Type: image/jpeg\r\n'

Strange MySQL Problem...

2008-04-02 Thread Victor Subervi
Hi; I have this code which works fine: #!/usr/local/bin/python import _mysql import MySQLdb, cPickle host = 'mysqldb2.ehost-services.com' user = 'user' passwd = 'pass' db = 'bre' print 'Content-Type: image/jpeg\r\n' print '\nHi!\n' connection = MySQLdb.connect(host=host, user=user, passwd=passwd,

Re: Python & MySQL problem with input to table..!

2007-06-29 Thread hiroc13
Thanks It is working! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & MySQL problem with input to table..!

2007-06-29 Thread Justin Ezequiel
On Jun 29, 4:26 pm, hiroc13 <[EMAIL PROTECTED]> wrote: > >>> import MySQLdb > >>> db = MySQLdb.connect (host = "localhost", user = "root", passwd = "pass", > >>> db = "base1") > >>> c = db.cursor () > >>> c.execute(""" INSERT INTO table1 (prvo, drugo) VALUES ('test', '1') """) > >>> c.execute("SEL

Python & MySQL problem with input to table..!

2007-06-29 Thread hiroc13
>>> import MySQLdb >>> db = MySQLdb.connect (host = "localhost", user = "root", passwd = "pass", >>> db = "base1") >>> c = db.cursor () >>> c.execute(""" INSERT INTO table1 (prvo, drugo) VALUES ('test', '1') """) >>> c.execute("SELECT * FROM table1") >>> res = c.fetchall () >>> print res When I s

Re: Python/MySQL problem on Windows

2006-09-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Eric Smith wrote: > I could have sworn that I got the use of connection() from published > sample code, but I must be mistaken. If all else fails, read the documentation , -- http://mail.python.org/mailman/listinfo/python-

Re: Python/MySQL problem on Windows

2006-09-20 Thread Eric Smith
Carsten Haese <[EMAIL PROTECTED]> writes: > What happens if you use connect(...) instead of connection(...)? Then it works! :-) I could have sworn that I got the use of connection() from published sample code, but I must be mistaken. Thanks! Eric -- http://mail.python.org/mailman/listinfo/

Re: Python/MySQL problem on Windows

2006-09-20 Thread Carsten Haese
On Wed, 2006-09-20 at 16:37, Eric Smith wrote: > I'm trying to use Python 2.4.3 and pywin32-209 to access a MySQL > database on Windows Server 2003 Standard Edition, and not having much > luck. It seems like parts of the MySQLdb module are not getting loaded > correctly, but no error message is giv

Python/MySQL problem on Windows

2006-09-20 Thread Eric Smith
I'm trying to use Python 2.4.3 and pywin32-209 to access a MySQL database on Windows Server 2003 Standard Edition, and not having much luck. It seems like parts of the MySQLdb module are not getting loaded correctly, but no error message is given during the import, even if I give a "-vv" on the com

Re: MySQL problem

2005-03-18 Thread Kent Johnson
wes weston wrote: Dennis Lee Bieber wrote: Try neither, the recommended method is to let the execute() do the formatting... That way /it/ can apply the needed quoting of arguments based upon the type of the data. cursor.execute("insert into produkt1 (MyNumber) values (%d)", (MyValue)) Dennis,

Re: MySQL problem

2005-03-18 Thread wes weston
Dennis Lee Bieber wrote: On Thu, 17 Mar 2005 16:45:57 GMT, wes weston <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: str = "INSERT INTO produkt1 (MyNumber) VALUES(%d)" % (MyNumber) cursor.execute(str) Think you meant "MyValue" for the second item... However... Try nei

Re: MySQL problem

2005-03-17 Thread wes weston
Lad wrote: I have the following program( only insert a record) import MySQLdb conn = MySQLdb.connect (host = "localhost",user = "", passwd = "",db="dilynamobily") cursor = conn.cursor () cursor.execute("""CREATE TABLE produkt1 ( id int(10) unsigned NOT NULL auto_increment, MyNu

MySQL problem

2005-03-17 Thread Lad
I have the following program( only insert a record) import MySQLdb conn = MySQLdb.connect (host = "localhost",user = "", passwd = "",db="dilynamobily") cursor = conn.cursor () cursor.execute("""CREATE TABLE produkt1 ( id int(10) unsigned NOT NULL auto_increment, MyNumber varcha