if stack:
self.stack.append(stack)
try:
- return self.traverse_single(obj, **kwargs)
+ x = self.traverse_single(obj, **kwargs)
+ if x is None:
+ raise "hi " + repr(obj)
+ return x
finally:
if stack:
self.stack.pop(-1)
}
def visit_function(self, func):
func.name = self.function_rewrites.get(func.name, func.name)
- super(MSSQLCompiler, self).visit_function(func)
+ return super(MSSQLCompiler, self).visit_function(func)
def for_update_clause(self, select):
# "FOR UPDATE" is only allowed on "DECLARE CURSOR" which SQLAlchemy doesn't use
'dialect.mysql',
'dialect.postgres',
'dialect.oracle',
+ 'dialect.mssql',
)
alltests = unittest.TestSuite()
for name in modules_to_test:
--- /dev/null
+import testbase\r
+import re\r
+from sqlalchemy import *\r
+from sqlalchemy.databases import mssql\r
+from testlib import *\r
+\r
+msdialect = mssql.MSSQLDialect()\r
+\r
+# TODO: migrate all MS-SQL tests here\r
+\r
+class CompileTest(AssertMixin):\r
+ def _test(self, statement, expected, **params):\r
+ if len(params):\r
+ res = str(statement.compile(dialect=msdialect, parameters=params))\r
+ else:\r
+ res = str(statement.compile(dialect=msdialect))\r
+ res = re.sub(r'\n', '', res)\r
+\r
+ assert res == expected, res\r
+ \r
+ def test_insert(self):\r
+ t = table('sometable', column('somecolumn'))\r
+ self._test(t.insert(), "INSERT INTO sometable (somecolumn) VALUES (:somecolumn)")\r
+\r
+ def test_update(self):\r
+ t = table('sometable', column('somecolumn'))\r
+ self._test(t.update(t.c.somecolumn==7), "UPDATE sometable SET somecolumn=:somecolumn WHERE sometable.somecolumn = :sometable_somecolumn", somecolumn=10)\r
+\r
+ def test_count(self):\r
+ t = table('sometable', column('somecolumn'))\r
+ self._test(t.count(), "SELECT count(sometable.somecolumn) AS tbl_row_count FROM sometable")\r
+ \r
+if __name__ == "__main__":\r
+ testbase.main()\r
assert len(result.fetchall()) == 0
connection.close()
- @testing.unsupported('sqlite', 'mssql') # TEMP: test causes mssql to hang
+ @testing.supported('postgres', 'mysql', 'oracle')
@testing.exclude('mysql', '<', (5, 0, 3))
def testnestedsubtransactionrollback(self):
connection = testbase.db.connect()
)
connection.close()
- @testing.unsupported('sqlite', 'mssql') # TEMP: test causes mssql to hang
+ @testing.supported('postgres', 'mysql', 'oracle')
@testing.exclude('mysql', '<', (5, 0, 3))
def testnestedsubtransactioncommit(self):
connection = testbase.db.connect()
)
connection.close()
- @testing.unsupported('sqlite', 'mssql') # TEMP: test causes mssql to hang
+ @testing.supported('postgres', 'mysql', 'oracle')
@testing.exclude('mysql', '<', (5, 0, 3))
def testrollbacktosubtransaction(self):
connection = testbase.db.connect()
metadata.create_all()
def tearDown(self):
- users_table.delete().execute()
UnitOfWorkTest.tearDown(self)
+ users_table.delete().execute()
def tearDownAll(self):
metadata.drop_all()
UnitOfWorkTest.tearDownAll(self)
-
+
@testing.unsupported('mssql') # TEMP: test causes mssql to hang
def test_update(self):
class User(object):
assert u.name == 'test2'
assert u.counter == 2
+ @testing.unsupported('mssql')
def test_insert(self):
class User(object):
pass
def setUpAll(self):
UnitOfWorkTest.setUpAll(self)
tables.create()
+
def tearDownAll(self):
tables.drop()
UnitOfWorkTest.tearDownAll(self)
+
def tearDown(self):
- tables.delete()
UnitOfWorkTest.tearDown(self)
+ tables.delete()
def testonetomany_1(self):
"""test basic save of one to many."""
)
def tearDown(self):
- tables.delete()
UnitOfWorkTest.tearDown(self)
+ tables.delete()
def testbasic(self):
# save two users
def setUpAll(self):
UnitOfWorkTest.setUpAll(self)
tables.create()
+
def tearDownAll(self):
tables.drop()
UnitOfWorkTest.tearDownAll(self)
+
def tearDown(self):
- tables.delete()
UnitOfWorkTest.tearDown(self)
+ tables.delete()
def testm2oonetoone(self):
# TODO: put assertion in here !!!
def setUpAll(self):
UnitOfWorkTest.setUpAll(self)
tables.create()
+
def tearDownAll(self):
tables.drop()
UnitOfWorkTest.tearDownAll(self)
+
def tearDown(self):
- tables.delete()
UnitOfWorkTest.tearDown(self)
+ tables.delete()
def testmanytomany(self):
items = orderitems
meta.create_all()
def tearDown(self):
- meta.drop_all()
UnitOfWorkTest.tearDown(self)
+ meta.drop_all()
def testbackwardsnonmatch(self):
m = mapper(Address, addresses, properties = dict(