The following statements all work perfectly:
cur.execute('SELECT ?, ?', [1, 2])
cur.execute('BEGIN DECLARE a int; set a = ?; SELECT 1; END', [1])
cur.execute('BEGIN DECLARE a int; set a = ?; SELECT a; END', [1])
cur.execute('BEGIN DECLARE a int; DECLARE b int; SET a = ?; SELECT a; END', [1])
But the following doesn't:
cur.execute('BEGIN DECLARE a int; DECLARE b int; SET a = ?; SET b = ?; SELECT a; END', [1, 2])
It fails with:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 792, in execute
self.executemany(operation, [parameters])
File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 769, in executemany
self.handleerror(*self.parent.error())
File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 689, in handleerror
eh(self.parent, self, errorclass, errorvalue, sqlcode)
File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 379, in standardErrorHandler
raise errorclass(errorvalue,sqlcode)
OperationalError: ('Not enough values for host variables', -188)
Why? I need to be able to set more than one variable at a time, it's kind of important.