This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年02月21日 19:39 by GuGu, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg153896 - (view) | Author: GuGu (GuGu) | Date: 2012年02月21日 19:39 | |
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.
|
|||
| msg222179 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014年07月03日 13:59 | |
Can we have a reply to this please as I don't understand enough about sqlite3 to comment. |
|||
| msg226638 - (view) | Author: Matthew Barnett (mrabarnett) * (Python triager) | Date: 2014年09月09日 15:21 | |
For comparison: Python 3.1.3: [(b'',)] Python 3.2.5: [(None,)] Python 3.3.5: [(b'',)] Python 3.4.1: sqlite3.OperationalError: trigger cannot use variables |
|||
| msg233387 - (view) | Author: Gerhard Häring (ghaering) * (Python committer) | Date: 2015年01月04日 03:24 | |
The sqlite3 module is not at fault here. If it does not work, then is is a restriction of SQLite3 - at which places it accepts bind parameters. This closing as "not a bug". |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:27 | admin | set | github: 58284 |
| 2015年01月04日 03:24:17 | ghaering | set | status: open -> closed assignee: ghaering resolution: not a bug messages: + msg233387 |
| 2014年09月09日 15:21:58 | mrabarnett | set | nosy:
+ mrabarnett messages: + msg226638 |
| 2014年09月08日 12:57:29 | flupke | set | nosy:
+ flupke |
| 2014年07月03日 13:59:22 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg222179 title: sqlite3 module ignores placeholers in CREATE TRIGGER code -> sqlite3 module ignores placeholders in CREATE TRIGGER code |
| 2012年02月25日 08:55:21 | Christian.Schilling | set | nosy:
+ Christian.Schilling |
| 2012年02月25日 00:37:03 | terry.reedy | set | nosy:
+ ghaering |
| 2012年02月21日 19:39:32 | GuGu | create | |