[New-bugs-announce] [issue14076] sqlite3 module ignores placeholers in CREATE TRIGGER code

GuGu report at bugs.python.org
Tue Feb 21 20:39:32 CET 2012


New submission from GuGu <andrey at kostenko.name>:

When I try to use placeholders in CREATE TRIGGER (for django-denorm module) SQLite module just ignores placeholders and sends `None` to it.

For example:

  In [11]: c.cursor().execute('CREATE TRIGGER test1 after insert on a for each row begin UPDATE a SET b=?; END', '1').fetchone()

  In [12]: c.cursor().execute('INSERT INTO a values (100)')
  Out[12]: <pysqlite2.dbapi2.Cursor at 0x101d77e30>

  In [13]: c.cursor().execute('SELECT * FROM a').fetchall()
  Out[13]: [(None,), (None,), (None,)]

  In [14]: c.cursor().execute('DROP TRIGGER test1')
  Out[14]: <pysqlite2.dbapi2.Cursor at 0x101d77f10>

  In [15]: c.cursor().execute('CREATE TRIGGER test1 after insert on a for each row begin UPDATE a SET b=1; END').fetchone()

  In [16]: c.cursor().execute('INSERT INTO a values (100)')
  Out[16]: <pysqlite2.dbapi2.Cursor at 0x101d77f80>

  In [17]: c.cursor().execute('SELECT * FROM a').fetchall()
  Out[17]: [(u'1',), (u'1',), (u'1',), (u'1',)]

In MySQLdb and psycopg2 creating triggers with a placeholder works.

----------
components: Library (Lib)
messages: 153896
nosy: GuGu
priority: normal
severity: normal
status: open
title: sqlite3 module ignores placeholers in CREATE TRIGGER code
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14076>
_______________________________________


More information about the New-bugs-announce mailing list