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: 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,