diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-04-02 22:33:50 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-04-02 22:33:50 +0000 |
commit | bf77ddaabb8a39f292a649e51f84e8a9af397de7 (patch) | |
tree | fa15dc086012f8bf3bc3f7510d70b989683f1a3c /test | |
parent | 0359a6a13dbe02b680e14cd830206544206153b8 (diff) | |
download | sqlalchemy-bf77ddaabb8a39f292a649e51f84e8a9af397de7.tar.gz |
- Got PG server side cursors back into shape, added fixed
unit tests as part of the default test suite. Added
better uniqueness to the cursor ID [ticket:1001]
- update().values() and insert().values() take keyword
arguments.
Diffstat (limited to 'test')
-rw-r--r-- | test/dialect/postgres.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/dialect/postgres.py b/test/dialect/postgres.py index e68fd4d74..90cc0a477 100644 --- a/test/dialect/postgres.py +++ b/test/dialect/postgres.py @@ -780,6 +780,37 @@ class TimeStampTest(TestBase, AssertsExecutionResults): result = connection.execute(s).fetchone() self.assertEqual(result[0], datetime.datetime(2007, 12, 25, 0, 0)) - +class ServerSideCursorsTest(TestBase, AssertsExecutionResults): + __only_on__ = 'postgres' + + def setUpAll(self): + global ss_engine + ss_engine = engines.testing_engine(options={'server_side_cursors':True}) + + def tearDownAll(self): + ss_engine.dispose() + + def test_roundtrip(self): + test_table = Table('test_table', MetaData(ss_engine), + Column('id', Integer, primary_key=True), + Column('data', String(50)) + ) + test_table.create(checkfirst=True) + try: + test_table.insert().execute(data='data1') + + nextid = ss_engine.execute(Sequence('test_table_id_seq')) + test_table.insert().execute(id=nextid, data='data2') + + self.assertEquals(test_table.select().execute().fetchall(), [(1, 'data1'), (2, 'data2')]) + + test_table.update().where(test_table.c.id==2).values(data=test_table.c.data + ' updated').execute() + self.assertEquals(test_table.select().execute().fetchall(), [(1, 'data1'), (2, 'data2 updated')]) + test_table.delete().execute() + self.assertEquals(test_table.count().scalar(), 0) + finally: + test_table.drop(checkfirst=True) + + if __name__ == "__main__": testenv.main() |