Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-08-01 Thread Martijn van Oosterhout
On Mon, Jul 31, 2006 at 09:47:40PM -0400, John D. Burger wrote: > >never, never, never try quoting on your own! You can only fail. The > >only choice is to fail now or later. > > Nonetheless, in case it's useful, here's a barebones wrapper I call on > everything: It'll work fine on single byte

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Volkan YAZICI
On Jul 31 10:40, Parthan SR wrote: > On 7/31/06, Richard Huxton wrote: > Traceback (most recent call last): File > "/usr/lib/cgi-bin/ConfSachem/page2.py", line 75, in ? main(num_days) File > "/usr/lib/cgi-bin/ConfSachem/page2.py", line 68, in main query = > cursor.execute('INSERT INTO ConfMain (Co

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Parthan SR
Hii,With regards to the previous mail and replaies, I tried with this code. Although it doesn't give any error when i run it as a script,  but the return value is NONE for 'q', which is assigned to return value of cursor.execute(), and the data are not inserted into the database. [code] name =

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread John D. Burger
never, never, never try quoting on your own! You can only fail. The only choice is to fail now or later. Nonetheless, in case it's useful, here's a barebones wrapper I call on everything: def sqlValue (value): if value is None: return "NULL" elif type(value) == types.StringType:

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Harald Armin Massa
Parthan,never, never, never try quoting on your own! You can only fail. The only choice is to fail now or later.The only recommended way with Python and DBAPI2.0 is:lala="huibuh"cs.execute ("select bla from foo where schupp=%s", (lala,))or bettercs.execute ("select bla from foo where schupp=%(lala

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Douglas Horst
Parthan wrote: Hello, Am not sure whether i can post such a question over here, still the error is in my postgresql query syntax, hence i post it in this mailing list. sorry if am wrong. I am getting a 'type error' with the following query. [Code] Line68: query = cursor.execute("""INSERT I

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Joshua D. Drake
Line68: query = cursor.execute("""INSERT INTO ConfMain (ConfName, ConfHost, ConfStart, ConfEnd, ConfDays, ConfStartTime, ConfEndTime, ConfSize) VALUES (\'%s\', \'%s\', \'%%\', \'%%\', %i, \'%%\', \'%%\', %i);""" % (conf_name, host_name, start_day, end_day, int(num_days), start_time, end_time, au

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Parthan SR
On 7/31/06, Richard Huxton wrote: > Line68:> query = cursor.execute("""INSERT INTO ConfMain (ConfName, ConfHost,> ConfStart, ConfEnd, ConfDays, ConfStartTime, ConfEndTime, ConfSize)> VALUES (\'%s\', \'%s\', \'%%\', \'%%\', %i, \'%%\', \'%%\', %i);""" % > (conf_name, host_name, st

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Richard Huxton
Parthan wrote: Hello, Am not sure whether i can post such a question over here, still the error is in my postgresql query syntax, hence i post it in this mailing list. sorry if am wrong. I am getting a 'type error' with the following query. [Code] Line68: query = cursor.execute("""INSERT I

[GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread Parthan
Hello, Am not sure whether i can post such a question over here, still the error is in my postgresql query syntax, hence i post it in this mailing list. sorry if am wrong. I am getting a 'type error' with the following query. [Code] Line68: query = cursor.execute("""INSERT INTO ConfMain (Co