Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Steve Holden
John Machin wrote: > On Jan 14, 9:42 pm, Steve Holden wrote: > >> 3. I can't be certain my experience with PostgreSQL extends to MySQl, >> but I have done experiments which prove to my satisfaction that it isn't >> possible to parameterize LIKE arguments. So the only way to do it >> appears to be

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Marco Mariani
Steve Holden wrote: 3. I can't be certain my experience with PostgreSQL extends to MySQl, but I have done experiments which prove to my satisfaction that it isn't possible to parameterize LIKE arguments. So the only way to do it appears to be to build the query yourself. Or using Postgres thro

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 9:42 pm, Steve Holden wrote: > 3. I can't be certain my experience with PostgreSQL extends to MySQl, > but I have done experiments which prove to my satisfaction that it isn't > possible to parameterize LIKE arguments. So the only way to do it > appears to be to build the query yoursel

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 9:22 pm, gumbah wrote: > Aahh the conn.commit() DID the trick!! > > I tried that before, but then it failed at another point. I got it > working now! Thanks a lot Peter and John!! For the benefit of future searchers, can you please tell us which varieties of cursor.execute() it works o

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 8:55 pm, gumbah wrote: > Hi John, > > thanks a lot for your quick reply! Please don't top-post. Please answer the question """You don't say what "doesn't work" means ... did you get exceptions, or just silently not updating?""" > > I tried all of your suggestions but none of them work

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Steve Holden
gumbah wrote: > I have this really strange problem. I hope someone can help: > > I am trying to update a database like so: > > UPDATE `tablename` set fieldx='test' WHERE flfieldx = null and fieldy > like '%certainvalue%' > > My Python code looks like this: > > fillsql = "UPDATE `tablename` set

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
Aahh the conn.commit() DID the trick!! I tried that before, but then it failed at another point. I got it working now! Thanks a lot Peter and John!! cheers! On 14 jan, 11:14, gumbah wrote: > Yep, also tried that. Weird thing is that I get no errors, it's just > silently not updating... > > On 1

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
Yep, also tried that. Weird thing is that I get no errors, it's just silently not updating... On 14 jan, 11:06, Peter Otten <__pete...@web.de> wrote: > gumbah wrote: > > I tried all of your suggestions but none of them work... I have a clue > > on why it is failing: MySQLdb seems to quote the % ch

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Peter Otten
gumbah wrote: > I tried all of your suggestions but none of them work... I have a clue > on why it is failing: MySQLdb seems to quote the % characters or > something... > > Even when i do: > cursor.execute("UPDATE tablename set fieldx='test' WHERE flfieldx is > null and fieldy like '%therealvalue

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
Hi John, thanks a lot for your quick reply! I tried all of your suggestions but none of them work... I have a clue on why it is failing: MySQLdb seems to quote the % characters or something... Even when i do: cursor.execute("UPDATE tablename set fieldx='test' WHERE flfieldx is null and fieldy li

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 7:31 pm, gumbah wrote: > I have this really strange problem. I hope someone can help: > > I am trying to update a database like so: > > UPDATE `tablename` set fieldx='test' WHERE flfieldx = null and fieldy > like '%certainvalue%' > > My Python code looks like this: > > fillsql = "UPDATE

MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
I have this really strange problem. I hope someone can help: I am trying to update a database like so: UPDATE `tablename` set fieldx='test' WHERE flfieldx = null and fieldy like '%certainvalue%' My Python code looks like this: fillsql = "UPDATE `tablename` set fieldx='test' WHERE flfieldx = nul