Commit 43a09603 authored by Lukáš Lalinský's avatar Lukáš Lalinský

Docs, "closed" attributes

parent b58c7d94
......@@ -37,7 +37,7 @@ Parmetrized queries should use the question mark as a parameter placeholder.
For example::
SELECT * FROM table WHERE id = ?
cursor.execute("SELECT * FROM table WHERE id = ?", [my_id])
"""
......
......@@ -50,9 +50,11 @@ class Connection(object):
def close(self):
"""Closes the connection.
No further operations are allowed, either on the connection or any
of its cursors, once the cursor is closed.
of its cursors, once the connection is closed.
If the connection is used in a ``with`` statement, this method will
be automatically called at the end of the ``with`` block.
"""
if self._closed:
raise ProgrammingError('the connection is already closed')
......@@ -64,6 +66,11 @@ class Connection(object):
self._client.close()
self._closed = True
@property
def closed(self):
"""Read-only attribute specifying if the connection is closed or not."""
return self._closed
def commit(self):
"""Commits pending database changes.
......@@ -108,7 +115,7 @@ class Connection(object):
@property
def autocommit(self):
"""Read/write property for switching the connection's autocommit mode."""
"""Read/write attribute for switching the connection's autocommit mode."""
return self._autocommit
@autocommit.setter
......@@ -120,7 +127,7 @@ class Connection(object):
@property
def readonly(self):
"""Read/write property for switching the connection's readonly mode."""
"""Read/write attribute for switching the connection's readonly mode."""
return self._readonly
@readonly.setter
......
......@@ -85,8 +85,10 @@ class Cursor(object):
def close(self):
"""Closes the cursor.
No further operations are allowed once the cursor is closed.
If the cursor is used in a ``with`` statement, this method will
be automatically called at the end of the ``with`` block.
"""
if self._closed:
raise ProgrammingError('the cursor is already closed')
......@@ -98,6 +100,11 @@ class Cursor(object):
self._pos = None
self._closed = True
@property
def closed(self):
"""Read-only attribute specifying if the cursor is closed or not."""
return self._closed
@property
def description(self):
if self._signature is None:
......@@ -214,7 +221,7 @@ class Cursor(object):
@property
def connection(self):
"""Provides access to the :class:`Connection <phoenixdb.connection.Connection>` object this cursor was created from."""
"""Read-only attribute providing access to the :class:`Connection <phoenixdb.connection.Connection>` object this cursor was created from."""
return self._connection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment