Re: pysqlite - simple problem

2006-09-03 Thread rdrink
Dennis Lee Bieber wrote: > That is probably the worst way to "fix" the problem -- as in the > future, you may end up trying that method for something that may need to > be quoted or escaped. > > cur.execute(template, (arg1,) ) > > allows the DB-API spec to properly convert the argument

Re: pysqlite - simple problem

2006-09-01 Thread Fredrik Lundh
rdrink wrote: > And yes I should prolly move to pysqlite2, but for now I was able to > fix it this way... > num = 200 > mess = "INSERT INTO foo (id) VALUES (%s)" % num > cur.execute(mess) > > ... don't know why I didn't think of that last (oh wait, Yes I do... > because 'last night' was actually

Re: pysqlite - simple problem

2006-09-01 Thread rdrink
Thanks everyone! But... RTFM? Ouch. It's not like I don't know what I'm doing :-( ... rather, that I *am* using the older sqlite module > print sqlite.paramstyle = pyformat > print sqlite.version = 1.0.1 which does not support the qmark sytax. (and I fell victim of someone elses tutor

Re: pysqlite - simple problem

2006-09-01 Thread John Machin
Fredrik Lundh wrote: > John Machin wrote: > >> So this has to be something stupidly simple... but for the life of me I > >> can't see it. > > > > With the '?' paramstyle, the 2nd arg to cursor.execute() should be a > > *sequence* (typically a tuple) of the values that you are inserting. > > > > Tt

Re: pysqlite - simple problem

2006-09-01 Thread Fredrik Lundh
John Machin wrote: >> So this has to be something stupidly simple... but for the life of me I >> can't see it. > > With the '?' paramstyle, the 2nd arg to cursor.execute() should be a > *sequence* (typically a tuple) of the values that you are inserting. > > Tty this: > cur.execute("INSERT INTO foo

Re: pysqlite - simple problem

2006-09-01 Thread John Machin
rdrink wrote: > I am just getting into pysqlite (with a fair amount of Python and MySQL > experience behind me) and have coded a simple test case to try to get > the hang of things... > yet have run into a 'stock simple' problem... > > I can create a database 'test.db', add a table 'foo' (which BTW

Re: pysqlite - simple problem

2006-09-01 Thread Fredrik Lundh
"rdrink" <[EMAIL PROTECTED]> wrote: >I am just getting into pysqlite (with a fair amount of Python and MySQL > experience behind me) and have coded a simple test case to try to get > the hang of things... > > yet have run into a 'stock simple' problem... what does import sqlite print sql

Re: pysqlite - simple problem

2006-09-01 Thread Gerold Penz
rdrink schrieb: > num = 200 > cur.execute("INSERT INTO foo (id) VALUES (?)", num) Hi! ``num`` must be an iterable object (tuple, list, ...). num = (200,) cur.execute("INSERT INTO foo (id) VALUES (?)", num) Regards, Gerold :-) -- __

pysqlite - simple problem

2006-09-01 Thread rdrink
I am just getting into pysqlite (with a fair amount of Python and MySQL experience behind me) and have coded a simple test case to try to get the hang of things... yet have run into a 'stock simple' problem... I can create a database 'test.db', add a table 'foo' (which BTW I repeatedly DROP on eac