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
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
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
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
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
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
"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
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
:-)
--
__
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