diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-05 10:25:36 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-05 10:25:36 -0500 |
| commit | 197ffa2be2cadce3df8bfb0799b3c80158250286 (patch) | |
| tree | a67320139e3ae72014a71bdd56396660408a4b12 /test | |
| parent | 04b1a52783a38148e52d50566161bdaf5262cd43 (diff) | |
| download | sqlalchemy-197ffa2be2cadce3df8bfb0799b3c80158250286.tar.gz | |
- Fixed 1.0 regression where the eager fetch of cursor.rowcount was
no longer called for an UPDATE or DELETE statement emitted via plain
text or via the :func:`.text` construct, affecting those drivers
that erase cursor.rowcount once the cursor is closed such as SQL
Server ODBC and Firebird drivers.
fixes #3622
Diffstat (limited to 'test')
| -rw-r--r-- | test/sql/test_rowcount.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/sql/test_rowcount.py b/test/sql/test_rowcount.py index 46e10e192..110f3639f 100644 --- a/test/sql/test_rowcount.py +++ b/test/sql/test_rowcount.py @@ -1,6 +1,7 @@ from sqlalchemy import * from sqlalchemy.testing import fixtures, AssertsExecutionResults from sqlalchemy import testing +from sqlalchemy.testing import eq_ class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults): @@ -65,6 +66,22 @@ class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults): print("expecting 3, dialect reports %s" % r.rowcount) assert r.rowcount == 3 + def test_raw_sql_rowcount(self): + # test issue #3622, make sure eager rowcount is called for text + with testing.db.connect() as conn: + result = conn.execute( + "update employees set department='Z' where department='C'") + eq_(result.rowcount, 3) + + def test_text_rowcount(self): + # test issue #3622, make sure eager rowcount is called for text + with testing.db.connect() as conn: + result = conn.execute( + text( + "update employees set department='Z' " + "where department='C'")) + eq_(result.rowcount, 3) + def test_delete_rowcount(self): # WHERE matches 3, 3 rows deleted department = employees_table.c.department |
