summaryrefslogtreecommitdiff
path: root/test/dialect/mssql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-08-12 21:36:33 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-08-12 21:36:33 +0000
commit62410adeb9f6a0e01de35680ff77cc15ae994995 (patch)
treecabf5c81f443f4becc131501134a2b853b778769 /test/dialect/mssql.py
parentfb5cd747e8c9f4cdcb612ce7c43fd82d298bf812 (diff)
downloadsqlalchemy-62410adeb9f6a0e01de35680ff77cc15ae994995.tar.gz
- fixed compiler bug in mssql
- marked as unsupported for mssql all two-phase and nested transcation tests - marked as unsupported for mssql various transactional/session tests which require two connections looking at uncommitted/external data at the same time (ms-sql cant handle it) - put better explicit closeout step in unitofwork.py tests to appease ms-sqls hard locking
Diffstat (limited to 'test/dialect/mssql.py')
-rwxr-xr-xtest/dialect/mssql.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/dialect/mssql.py b/test/dialect/mssql.py
new file mode 100755
index 000000000..ec2729197
--- /dev/null
+++ b/test/dialect/mssql.py
@@ -0,0 +1,34 @@
+import testbase
+import re
+from sqlalchemy import *
+from sqlalchemy.databases import mssql
+from testlib import *
+
+msdialect = mssql.MSSQLDialect()
+
+# TODO: migrate all MS-SQL tests here
+
+class CompileTest(AssertMixin):
+ def _test(self, statement, expected, **params):
+ if len(params):
+ res = str(statement.compile(dialect=msdialect, parameters=params))
+ else:
+ res = str(statement.compile(dialect=msdialect))
+ res = re.sub(r'\n', '', res)
+
+ assert res == expected, res
+
+ def test_insert(self):
+ t = table('sometable', column('somecolumn'))
+ self._test(t.insert(), "INSERT INTO sometable (somecolumn) VALUES (:somecolumn)")
+
+ def test_update(self):
+ t = table('sometable', column('somecolumn'))
+ self._test(t.update(t.c.somecolumn==7), "UPDATE sometable SET somecolumn=:somecolumn WHERE sometable.somecolumn = :sometable_somecolumn", somecolumn=10)
+
+ def test_count(self):
+ t = table('sometable', column('somecolumn'))
+ self._test(t.count(), "SELECT count(sometable.somecolumn) AS tbl_row_count FROM sometable")
+
+if __name__ == "__main__":
+ testbase.main()