diff options
author | Jason Kirtland <jek@discorporate.us> | 2007-10-16 23:59:05 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2007-10-16 23:59:05 +0000 |
commit | 5154d304181ec7f2203e9c02db3c7d41dafc79b5 (patch) | |
tree | a5fe1ed93f268025e32569bb12b8205f17aa465c /test/dialect/mysql.py | |
parent | 6bbc7dd157faf5b513852286ba656fa6723cd2d6 (diff) | |
download | sqlalchemy-5154d304181ec7f2203e9c02db3c7d41dafc79b5.tar.gz |
- Added support for UPDATE with LIMIT on mysql.
- Added mysql dialect tests for SET columns and the in_ operator.
Diffstat (limited to 'test/dialect/mysql.py')
-rw-r--r-- | test/dialect/mysql.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/dialect/mysql.py b/test/dialect/mysql.py index 92d93b8d5..d43f5cd16 100644 --- a/test/dialect/mysql.py +++ b/test/dialect/mysql.py @@ -496,6 +496,17 @@ class TypesTest(AssertMixin): roundtrip([1, 1, 1], [set(['dq']), set(['a']), set(['5'])]) roundtrip([set(['dq', 'sq']), None, set(['9', '5', '7'])]) + + set_table.insert().execute({'s3':set(['5'])}, + {'s3':set(['5', '7'])}, + {'s3':set(['5', '7', '9'])}, + {'s3':set(['7', '9'])}) + rows = list(select( + [set_table.c.s3], + set_table.c.s3.in_([set(['5']), set(['5', '7'])])).execute()) + found = set([frozenset(row[0]) for row in rows]) + self.assertEquals(found, + set([frozenset(['5']), frozenset(['5', '7'])])) finally: meta.drop_all() @@ -783,6 +794,26 @@ class SQLTest(SQLCompileTest): "SELECT t.col1, t.col2 FROM t LIMIT 10, 18446744073709551615" ) + @testing.supported('mysql') + def test_update_limit(self): + t = sql.table('t', sql.column('col1'), sql.column('col2')) + + self.assert_compile( + t.update(values={'col1':123}), + "UPDATE t SET col1=%s" + ) + self.assert_compile( + t.update(values={'col1':123}, mysql_limit=5), + "UPDATE t SET col1=%s LIMIT 5" + ) + self.assert_compile( + t.update(values={'col1':123}, mysql_limit=None), + "UPDATE t SET col1=%s" + ) + self.assert_compile( + t.update(t.c.col2==456, values={'col1':123}, mysql_limit=1), + "UPDATE t SET col1=%s WHERE t.col2 = %s LIMIT 1" + ) def colspec(c): return testbase.db.dialect.schemagenerator(testbase.db.dialect, |