diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-04-20 00:50:34 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-04-21 15:09:13 +0100 |
commit | 6fecc36b7f8cabe70376efb2f4fcc7a45032f307 (patch) | |
tree | 03866da5ab436a75c79383f4b055183627a49d39 | |
parent | 7ee09353ec8ce8338a7cad1ea04808ba203e268b (diff) | |
download | psycopg2-6fecc36b7f8cabe70376efb2f4fcc7a45032f307.tar.gz |
Connection method 'executing()' renamed to 'isexecuting()'.
-rw-r--r-- | doc/src/advanced.rst | 2 | ||||
-rw-r--r-- | doc/src/connection.rst | 2 | ||||
-rw-r--r-- | psycopg/connection_type.c | 12 | ||||
-rwxr-xr-x | tests/test_async.py | 24 |
4 files changed, 20 insertions, 20 deletions
diff --git a/doc/src/advanced.rst b/doc/src/advanced.rst index 88ca42c..3cd9def 100644 --- a/doc/src/advanced.rst +++ b/doc/src/advanced.rst @@ -334,7 +334,7 @@ client and available using the regular cursor methods: >>> acurs.fetchone()[0] 42 -When an asynchronous query is being executed, `connection.executing()` returns +When an asynchronous query is being executed, `connection.isexecuting()` returns `True`. Two cursors can't execute concurrent queries on the same asynchronous connection. diff --git a/doc/src/connection.rst b/doc/src/connection.rst index 2dbea6c..654e721 100644 --- a/doc/src/connection.rst +++ b/doc/src/connection.rst @@ -347,7 +347,7 @@ The ``connection`` class its status during asynchronous communication. - .. method:: executing() + .. method:: isexecuting() Return `True` if the connection is executing an asynchronous operation. diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index 919e7e4..84ce6ed 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -547,14 +547,14 @@ psyco_conn_fileno(connectionObject *self) } -/* extension: executing - check for asynchronous operations */ +/* extension: isexecuting - check for asynchronous operations */ -#define psyco_conn_executing_doc \ -"executing() -> bool -- Return True if the connection is " \ +#define psyco_conn_isexecuting_doc \ +"isexecuting() -> bool -- Return True if the connection is " \ "executing an asynchronous operation." static PyObject * -psyco_conn_executing(connectionObject *self) +psyco_conn_isexecuting(connectionObject *self) { /* synchronous connections will always return False */ if (self->async == 0) { @@ -612,8 +612,8 @@ static struct PyMethodDef connectionObject_methods[] = { METH_NOARGS, psyco_conn_lobject_doc}, {"fileno", (PyCFunction)psyco_conn_fileno, METH_NOARGS, psyco_conn_fileno_doc}, - {"executing", (PyCFunction)psyco_conn_executing, - METH_NOARGS, psyco_conn_executing_doc}, + {"isexecuting", (PyCFunction)psyco_conn_isexecuting, + METH_NOARGS, psyco_conn_isexecuting_doc}, #endif {NULL} }; diff --git a/tests/test_async.py b/tests/test_async.py index fe00555..6f3ec4c 100755 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -80,13 +80,13 @@ class AsyncTests(unittest.TestCase): def test_async_select(self): cur = self.conn.cursor() - self.assertFalse(self.conn.executing()) + self.assertFalse(self.conn.isexecuting()) cur.execute("select 'a'") - self.assertTrue(self.conn.executing()) + self.assertTrue(self.conn.isexecuting()) self.wait(cur) - self.assertFalse(self.conn.executing()) + self.assertFalse(self.conn.isexecuting()) self.assertEquals(cur.fetchone()[0], "a") def test_async_callproc(self): @@ -96,10 +96,10 @@ class AsyncTests(unittest.TestCase): except psycopg2.ProgrammingError: # PG <8.1 did not have pg_sleep return - self.assertTrue(self.conn.executing()) + self.assertTrue(self.conn.isexecuting()) self.wait(cur) - self.assertFalse(self.conn.executing()) + self.assertFalse(self.conn.isexecuting()) self.assertEquals(cur.fetchall()[0][0], '') def test_async_after_async(self): @@ -158,7 +158,7 @@ class AsyncTests(unittest.TestCase): # a commit should not work in asynchronous mode self.assertRaises(psycopg2.ProgrammingError, self.conn.commit) - self.assertTrue(self.conn.executing()) + self.assertTrue(self.conn.isexecuting()) # but a manual commit should self.wait(cur) @@ -180,12 +180,12 @@ class AsyncTests(unittest.TestCase): cur = self.conn.cursor() cur.execute("select 'c'") - self.assertTrue(self.conn.executing()) + self.assertTrue(self.conn.isexecuting()) # getting transaction status works self.assertEquals(self.conn.get_transaction_status(), extensions.TRANSACTION_STATUS_ACTIVE) - self.assertTrue(self.conn.executing()) + self.assertTrue(self.conn.isexecuting()) # setting connection encoding should fail self.assertRaises(psycopg2.ProgrammingError, @@ -198,7 +198,7 @@ class AsyncTests(unittest.TestCase): def test_reset_while_async(self): cur = self.conn.cursor() cur.execute("select 'c'") - self.assertTrue(self.conn.executing()) + self.assertTrue(self.conn.isexecuting()) # a reset should fail self.assertRaises(psycopg2.ProgrammingError, self.conn.reset) @@ -218,7 +218,7 @@ class AsyncTests(unittest.TestCase): # but after it's done it should work self.wait(cur) self.assertEquals(list(cur), [(1, ), (2, ), (3, )]) - self.assertFalse(self.conn.executing()) + self.assertFalse(self.conn.isexecuting()) def test_copy_while_async(self): cur = self.conn.cursor() @@ -248,7 +248,7 @@ class AsyncTests(unittest.TestCase): # scroll should fail if a query is underway self.assertRaises(psycopg2.ProgrammingError, cur.scroll, 1) - self.assertTrue(self.conn.executing()) + self.assertTrue(self.conn.isexecuting()) # but after it's done it should work self.wait(cur) @@ -350,7 +350,7 @@ class AsyncTests(unittest.TestCase): cur1.execute("select 1") self.wait(cur1) - self.assertFalse(self.conn.executing()) + self.assertFalse(self.conn.isexecuting()) # fetching from a cursor with no results is an error self.assertRaises(psycopg2.ProgrammingError, cur2.fetchone) # fetching from the correct cursor works |