Commit Graph

1330 Commits

Author SHA1 Message Date
Jan Urbański
b99eac18f8 Make cursor.scroll() raise an exception in asynchronous mode
The exception is raised if an asynchronous query is in progress,
otherwise it will behave normally (since the data is already on the
client side).
2010-04-05 16:24:45 +02:00
Jan Urbański
727670c269 Make some methods raise an exception in asynchronous mode
The methods changed are connection.commit(), rollback(), reset(),
set_isolation_level(), set_client_encoding(), lobject(), cursor(str)
as well as cursor.execute() and cursor.callproc() if another query is
in progress and cursor.executemany(), cursor.copy_{from,to,expert)().
2010-04-05 16:23:44 +02:00
Jan Urbański
01799e9137 Make asynchronous connections produce asynchronous cursors by default
Drop the async kwarg from cursor.execute(), cursors created by
asynchronous connections will be asynchronous by default, ones created
by synchronous connections will be synchronous.

Mind that this might break third party subclasses of
psycopg2.extensions.cursor, if they try to chain to the superclass in
their execute() implementation and are passing the async kwarg. The
example cursors in psycopg2.extras have been fixed no to do that.
2010-04-05 11:41:32 +02:00
Jan Urbański
d8ab5ac8a1 Make asynchronous connections always use autocommit
Clients using async connections are expected to do their own
transaction management by sending (asynchronously) BEGIN and COMMIT
statements.
As a bonus, it allows to drop one step from the async connection
building, namely getting the default isolation level from the server.
2010-04-05 11:37:06 +02:00
Jan Urbański
062a9602ae Ref the async cursor before storing it in the connection 2010-04-05 11:36:09 +02:00
Jan Urbański
eb646f71fa Add tests for the asynchronous API 2010-04-05 11:32:03 +02:00
Jan Urbański
91ef0e09ed Change the API for asynchronous queries to use cursor.poll()
The isread() API was not safe, because the query might have not been
sent fully to the server after calling execute(). To make the async
API complete, a similar mechanism to async connections must be used.

The cursor now has a poll() method that you would use identically to
the poll() method of the connection class.
2010-04-05 11:31:50 +02:00
Jan Urbański
9b259a8a54 Disallow some methods depending on the connection's sync/async mode 2010-04-05 11:31:37 +02:00
Federico Di Gregorio
34317dc4c3 Support asynchronous connection building
After calling psycopg2.connect(dsn, async=True) you can poll the
connection that will tell you whether its file descriptor should be
waited on to become writable or readable or that the connection
attempt has succeeded.

Edited commit by Jan to not expose internal state in extensions.py.
2010-04-05 11:30:03 +02:00
Jan Urbański
1f6ffbba0f Block and clear the result of asynchronous queries where necessary
Remove the big loop in pq_fetch with the select() call, among
others. Code paths that don't support asynchronous queries should now
be adequately guarded.
2010-04-05 11:28:20 +02:00
Federico Di Gregorio
3d2c315049 Checks for pointers should be explicit, i.e., (ptr != NULL) 2010-04-05 11:27:34 +02:00
Jan Urbański
cc37fd1ea9 Add curs_get_last_result, a function to get the last result from a connection 2010-04-05 11:24:57 +02:00
Jan Urbański
75a0299a48 Add pq_flush, a function to flush the output buffer 2010-04-05 11:07:53 +02:00
Federico Di Gregorio
3f2c1f6489 /me does not like empty for loops 2010-04-05 11:07:19 +02:00
Jan Urbański
53748443d8 Make pq_clear_async clear the whole pending result and export it 2010-04-05 11:01:44 +02:00
Jan Urbański
e0d789466a Support large objects truncating.
The lobject.truncate(len=0) method will be available if psycopg2 has
been built against libpq from 8.3 or later (which is when the lobject
truncating support has been introduced).
2010-03-29 09:19:35 +02:00
Federico Di Gregorio
0edd520593 Preparing release 2.0.14 (final) 2010-03-13 21:15:50 +01:00
Federico Di Gregorio
b5373bd90a Merge remote branch 'piro/python2' into python2 2010-03-12 17:37:04 +01:00
Federico Di Gregorio
21a6a64fd1 Changed setup.py to detect PostgreSQL "alpha" versions 2010-03-11 22:42:00 +01:00
Daniele Varrazzo
99620c1454 A bunch of typo fixed in the docs 2010-03-03 18:43:24 +01:00
Federico Di Gregorio
855674faf1 Fixed Python 2.4 segfault related to decimal implementation 2010-02-28 20:52:03 +01:00
Daniele Varrazzo
17a4cc9f67 All the docs todo points dropped: todo list removed. 2010-02-26 01:10:15 +00:00
Daniele Varrazzo
140e6ad4f2 Added notes about stuff changed in ver. 2.0.14. 2010-02-26 01:09:08 +00:00
Daniele Varrazzo
97ced0d4f1 Use the default role for cross referencing Python objects. 2010-02-26 00:49:19 +00:00
Daniele Varrazzo
4412826556 Added documentation for the 'pool' module. 2010-02-26 00:46:23 +00:00
Federico Di Gregorio
3636bc4201 Release candidate 1 2010-02-22 19:45:48 +01:00
Federico Di Gregorio
b99f2d5f8e Added a couple more questions to the FAQ 2010-02-22 19:38:47 +01:00
Federico Di Gregorio
6733c64412 Varrazzo has two "r"! 2010-02-22 09:09:44 +01:00
Federico Di Gregorio
1b3e16e6fe MANIFEST.in does not prune docs/html/_sources anymore 2010-02-22 09:06:28 +01:00
Federico Di Gregorio
b46035c222 Merge remote branch 'remotes/piro/python2' into python2 2010-02-22 09:05:40 +01:00
Federico Di Gregorio
fd6d3185b4 Preparing release 2.0.14 2010-02-21 01:26:43 +01:00
Federico Di Gregorio
4712ad1550 Added documentation to project 2010-02-21 01:09:40 +01:00
Federico Di Gregorio
192034dc38 Fixed problem with decimal.Decimal conversions 2010-02-21 01:04:00 +01:00
Daniele Varrazzo
50f5daef8b Added FAQ section to the documentation. 2010-02-18 04:12:49 +00:00
Daniele Varrazzo
29feed31b6 Cleaned up parameters style from the docs. 2010-02-18 04:12:46 +00:00
Daniele Varrazzo
a320f25a2a Completed documentation for errorcodes module. 2010-02-16 00:38:44 +00:00
Daniele Varrazzo
96b7912bcf Typo fixed in DictRow doc. 2010-02-16 00:38:15 +00:00
Daniele Varrazzo
8001795b95 More uniform titles style in docs index. 2010-02-16 00:37:47 +00:00
Daniele Varrazzo
491bbb111c Fixed code block. 2010-02-16 00:37:17 +00:00
Daniele Varrazzo
289ab1cd8d Binary adapter imported from the correct module. 2010-02-16 00:36:59 +00:00
Daniele Varrazzo
c72fbf0b0f Fixed example (with doctest) for Inet 2010-02-16 00:36:48 +00:00
Daniele Varrazzo
9ba6102f66 Added documentation for database large objects. 2010-02-16 00:36:32 +00:00
Daniele Varrazzo
d08d9ab199 Added errorcodes.lookup() function. 2010-02-15 01:38:49 +00:00
Daniele Varrazzo
3da7a33ffb Added script to update the errorcodes module. 2010-02-15 01:12:13 +00:00
Daniele Varrazzo
bcfdbd1903 Error codes updated to include all errors between PostgreSQL 8.1 and 8.4. 2010-02-15 01:07:28 +00:00
Daniele Varrazzo
be30f43181 Inet adapter fixed. 2010-02-14 20:14:17 +00:00
Daniele Varrazzo
cf3b7e7e50 Whitespace fixed 2010-02-14 19:45:22 +00:00
Daniele Varrazzo
c167a6f07f Manifest contains both rendered and source documentation. 2010-02-14 16:45:36 +00:00
Daniele Varrazzo
b744c92f58 Documentation dir reordered. 2010-02-14 16:45:36 +00:00
Daniele Varrazzo
620f77cb77 Generate text documentation in a single file. 2010-02-14 16:45:31 +00:00