Re: [DB-SIG] paramstyles (mysql string length?)

2006-04-24 Thread M.-A. Lemburg
Dieter Maurer wrote: > M.-A. Lemburg wrote at 2006-4-19 20:36 +0200: >> ... >> Actually, I don't think that parsing SQL is really necessary >> at all: in all the years I've used qmark style, I've never come >> across a situation where a SQL literal would include a question >> mark. > > I do not th

[DB-SIG] MySQLdb - syntax question

2006-04-24 Thread Patty
I have the following code: UPDATE mytable SET col1 = %s, col2 = %s, col3 = %s, col4 = %s, col5 = %s, col6 = %s WHERE name = %s """, (tuple(entries))) In this example, entries is a list of numbers and the last element is a name of a target. This works fine. But, there will be times whe

Re: [DB-SIG] MySQLdb - syntax question

2006-04-24 Thread Chris Cogdon
On Apr 24, 2006, at 11:35, Patty wrote: > I have the following code: > > UPDATE mytable SET col1 = %s, col2 = %s, col3 = %s, col4 = %s, > col5 = %s, col6 = %s WHERE name = %s > """, (tuple(entries))) > In this example, entries is a list of numbers and the last element is > a name of >

Re: [DB-SIG] how to know the connexion is closed

2006-04-24 Thread Dieter Maurer
William Dode wrote at 2006-4-22 18:53 +: >I search for a generic way (for psycopg, mysqldb, adodbapi) to >know that the connexion is closed I fear there is no generic way -- Dieter ___ DB-SIG maillist - DB-SIG@python.org http://mail.python.or

Re: [DB-SIG] MySQLdb - syntax question

2006-04-24 Thread Patty
Hi again, > query_string = "update mytable set " + ",".join ( [ key + "=%s" for > key, value in d_items ] ) > > cursor.execute ( query_string, tuple ( [ value for key, value in > d_items ] ) ) > Thanks for your prompt reply. I kinda got it, but the the part that I forgot to mention was that

Re: [DB-SIG] MySQLdb - syntax question

2006-04-24 Thread Chris Cogdon
On Apr 24, 2006, at 13:37, Patty wrote: > > Hi again, > >> query_string = "update mytable set " + ",".join ( [ key + "=%s" for >> key, value in d_items ] ) >> >> cursor.execute ( query_string, tuple ( [ value for key, value in >> d_items ] ) ) >> > > > Thanks for your prompt reply. I kinda got it

Re: [DB-SIG] MySQLdb - syntax question

2006-04-24 Thread Patty
Got it!! Thank you ___ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig

Re: [DB-SIG] paramstyles (mysql string length?)

2006-04-24 Thread Chris Clark
In reference to finding question marks in SQL queries and ignoring string literals M.-A. Lemburg wrote: > Does anyone know a good implementation of such a search&replace > mechanism ? > I've not seen any existing code to deal with this BUT there are a couple of places to check: * SnakeSQ

Re: [DB-SIG] paramstyles (mysql string length?)

2006-04-24 Thread Ian Bicking
Chris Clark wrote: > In reference to finding question marks in SQL queries and ignoring > string literals > > M.-A. Lemburg wrote: >>Does anyone know a good implementation of such a search&replace >>mechanism ? >> > > I've not seen any existing code to deal with this BUT there are a couple >

Re: [DB-SIG] how to know the connexion is closed

2006-04-24 Thread Bill Campbell
On Mon, Apr 24, 2006, Dieter Maurer wrote: >William Dode wrote at 2006-4-22 18:53 +: >>I search for a generic way (for psycopg, mysqldb, adodbapi) to >>know that the connexion is closed > >I fear there is no generic way One could use something like: try: cur = conn.cursor() except: cur =