Error using row object as args for a query

TiNo <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
I try to use the outcome of a select statement in another query doing the
following:

--------------------------------------------------------------------------------------------------------------------
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
win32
>>> from pysqlite2 import dbapi2 as sqlite
>>> sqlite.version
'2.3.2'
>>> con = sqlite.connect(':memory:')
>>> con.row_factory = sqlite.Row
>>> cur = con.cursor()
>>> cur.execute('CREATE TABLE test (a TEXT,b TEXT)')
<pysqlite2.dbapi2.Cursor object at 0x02096DD0>
>>> cur.execute('INSERT INTO test(a,b) VALUES ("aa","bb")')
<pysqlite2.dbapi2.Cursor object at 0x02096DD0>
>>> cur.execute('SELECT * FROM test')
<pysqlite2.dbapi2.Cursor object at 0x02096DD0>
>>> x = cur.fetchone()
>>> x
< pysqlite2.dbapi2.Row object at 0x01EFD7A0>
>>> x[0]
u'aa'
>>> x['a']
u'aa'
>>> cur.execute('DELETE FROM test WHERE a = :a',x)
Traceback (most recent call last):
  File "<input>", line 1, in ?
ProgrammingError: Incorrect number of bindings supplied. The current
statement uses 1, and there are -1 supplied.
>>> cur.execute('DELETE FROM test WHERE a = :a',(x,))
Traceback (most recent call last):
  File "<input>", line 1, in ?
InterfaceError: Error binding parameter 0 - probably unsupported type.

--------------------------------------------------------------------------------------------------------------------

But that doesn't work...
My fault? Bug? how do I do this?

Thanks,

TiNo

_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.