if self._select_lastrowid:
if self.dialect.use_scope_identity:
- self.cursor.execute("SELECT scope_identity() AS lastrowid")
+ self.cursor.execute("SELECT scope_identity() AS lastrowid", ())
else:
- self.cursor.execute("SELECT @@identity AS lastrowid")
+ self.cursor.execute("SELECT @@identity AS lastrowid", ())
# fetchall() ensures the cursor is consumed without closing it
row = self.cursor.fetchall()[0]
self._lastrowid = int(row[0])
no_support('sybase', 'not supported by database'),
)
+def independent_cursors(fn):
+ """Target must support simultaneous, independent database cursors on a single connection."""
+
+ return _chain_decorators_on(
+ fn,
+ no_support('mssql+pyodbc', 'no driver support'),
+ no_support('mssql+mxodbc', 'no driver support'),
+ )
+
def independent_connections(fn):
"""Target must support simultaneous, independent database connections."""
def teardown(self):
metadata.drop_all()
+ @testing.fails_on_everything_except('mssql+pyodbc', 'this is some pyodbc-specific feature')
def test_decimal_notation(self):
import decimal
numeric_table = Table('numeric_table', metadata,
self.assert_(repr(t.c.t))
t.create(checkfirst=True)
- @testing.crashes("+mxodbc", "mxODBC doesn't do scope_identity() with DEFAULT VALUES")
def test_autoincrement(self):
Table('ai_1', metadata,
Column('int_y', Integer, primary_key=True),
assert not c.autoincrement, name
assert tbl._autoincrement_column is not c, name
- for counter, engine in enumerate([
- engines.testing_engine(options={'implicit_returning':False}),
- engines.testing_engine(options={'implicit_returning':True}),
- ]
- ):
+ # mxodbc can't handle scope_identity() with DEFAULT VALUES
+ if testing.db.driver == 'mxodbc':
+ eng = [engines.testing_engine(options={'implicit_returning':True})]
+ else:
+ eng = [
+ engines.testing_engine(options={'implicit_returning':False}),
+ engines.testing_engine(options={'implicit_returning':True}),
+ ]
+
+ for counter, engine in enumerate(eng):
engine.execute(tbl.insert())
if 'int_y' in tbl.c:
assert engine.scalar(select([tbl.c.int_y])) == counter + 1
self.assert_(connection.cursor() is not None)
self.assert_(connection is not connection2)
+ @testing.fails_on('+pyodbc', "pyodbc cursor doesn't implement tuple __eq__")
def test_cursor_iterable(self):
conn = testing.db.raw_connection()
cursor = conn.cursor()