Commit Graph

686 Commits

Author SHA1 Message Date
Daniele Varrazzo
305d86f38a Handle time zones with seconds in the UTC offset.
The offset is rounded to the nearest minute.
2010-05-20 02:16:04 +01:00
Daniele Varrazzo
e3d489f701 Bump to version 2.2.2-devel.
The -devel suffix appears in the docs we publish on the website, so it's
clear that they refer to the upcoming version.
2010-05-20 02:03:07 +01:00
Daniele Varrazzo
eacf6febfe Warn on declarations not at beginning of the block.
They are accepted by gcc but not by MS compilers.
2010-05-19 11:40:38 +01:00
Daniele Varrazzo
b597ccf917 Tests can be run again different coroutine libraries.
Use PSYCOPG2_TEST_GREEN=<something>, where <something> is 1 or a library
name. Currently eventlet is supported.
2010-05-19 11:40:13 +01:00
Federico Di Gregorio
23391a3c55 Preparing release 2.2.1 2010-05-17 21:51:25 +02:00
Jason Erickson
069695b4ae Additional Library for Windows linking and OpenSSL 1.0.0
Added the linking of crypt32.lib to the windows SSL build, as it seems that the current version of OpenSSL is looking for crypt32.lib as well.
2010-05-17 09:06:29 +02:00
Jason Erickson
1f1133b871 Micrsoft Visual C Compile Fix
Moved the declarations of variables/pointers to the beginning of the block, where MSVC wants them.
2010-05-17 09:06:14 +02:00
Federico Di Gregorio
e286970b62 Preparing release 2.2.0 2010-05-16 12:55:59 +02:00
Federico Di Gregorio
6521fb5a44 Fixed error related to calling C typecasters from Python ones 2010-05-15 19:34:56 +02:00
Federico Di Gregorio
36cbefdee1 Updated project and version for release 2.2.0 2010-05-15 17:51:54 +02:00
Daniele Varrazzo
a35498532a Fixed time test to be independent from the TZ it runs. 2010-05-15 14:27:24 +01:00
Daniele Varrazzo
c46a1dad63 Fixed TimeFromTicks for second values > 59.5. 2010-05-15 14:27:24 +01:00
Daniele Varrazzo
afea19651c Fixed TimestampFromTicks for second values > 59.5.
Bug reported and fixed by Jozsef Szalay on 2010-05-06 at 14:11:59.999920.
2010-05-15 14:27:24 +01:00
Daniele Varrazzo
b04bf41f99 Fixed decimal to float recipe to avoid using FLOAT.
FLOAT seems not working with NULLs.
2010-05-15 14:27:24 +01:00
Daniele Varrazzo
5e3f240ac9 Cast datetime into timestamptz when the tzinfo field is set. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
60e7522e47 Added evaluable representation for the FixedOffsetTimezone object. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
d30daac782 Fixed typo in LocalTimezone doc. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
bf1c76b792 Explicit cast of the SQL representation of time-related objects.
Allow the objects to be recognized as the proper type by Postgres in not
strong contexts: problem reported by Peter Eisentraut.

Added tests to check the types are respected in a complete Py -> PG ->
Py roundtrip without context.
2010-05-15 14:27:23 +01:00
Daniele Varrazzo
e8c2a14362 Added typecasters for arrays of specific MX/Py time-related types. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
c8aef26e15 Adapt buffer objects using an explicit cast on the string literal.
Don't rely on Postgres casting the literal according to the context:
this doesn't work e.g. passing the object as function argument where a
function with the same name but taking a text exists. It doesn't work
either when the object is in an ARRAY construct.

Added test to check the type is respected in a complete Py -> PG -> Py
roundtrip without context.

Bug and solution reported by Peter Eisentraut.
2010-05-15 14:27:23 +01:00
Daniele Varrazzo
2020790ba1 Typo fixed. 2010-05-15 14:27:02 +01:00
Daniele Varrazzo
73db6bee01 Keep the connection in blocking mode unless it is not async.
Dropped set/unset nonblocking mode for copy and lobject operations:
lobjects don't work in nonblocking mode so they will hardly be supported
in green/async branches.  Support for copy is still feasible, but it
will be done in other code paths (called by poll).
2010-05-09 20:37:48 +01:00
Daniele Varrazzo
e29424a230 Dropped large object support when psycopg is in green mode.
Async mode and large object are not compatible, albeit I haven't found
an authoritative source yet.
2010-05-09 20:34:02 +01:00
Daniele Varrazzo
2596cf7125 Simplified psyco_wait() function interface. 2010-04-25 23:08:08 +01:00
Daniele Varrazzo
8efa1fa6af Dropped compiling warning. 2010-04-25 23:08:08 +01:00
Daniele Varrazzo
dab098c1cb Cleaned up documentation for connection status constants.
Dropped reference to unused/internal states.
2010-04-23 13:28:49 +01:00
Daniele Varrazzo
cb40342afa poll implementation for async, sync and green connection unified. 2010-04-23 13:28:49 +01:00
Daniele Varrazzo
0da4befe78 Added function to advance the state after flush attempt. 2010-04-23 13:28:38 +01:00
Daniele Varrazzo
f3b3483df3 Added a function to advance the state after a read attempt.
Dropped calls to PQisBusy/PQconsumeInput in the connection code.
2010-04-23 13:24:36 +01:00
Daniele Varrazzo
e82d2be64b More lenient test timeout for a slow (or busy) machine. 2010-04-23 13:24:35 +01:00
Daniele Varrazzo
1edbd16577 Dropped curs_get_last_result function.
The result is read from a pqpath function and put on the async_cursor by
a function that also checks for is presence and dismiss it after its
usage.
2010-04-23 13:24:35 +01:00
Daniele Varrazzo
a66de9808f Added 'pq_get_last_result()' function.
The function reads the last result after an asynchronous query.
2010-04-23 13:24:35 +01:00
Daniele Varrazzo
5be0fc52ca Reusable parts of the green polling refactored out.
The functions _conn_poll_connecting() and _conn_poll_query() will be
usable by the async connections too.
2010-04-23 13:24:35 +01:00
Daniele Varrazzo
df959c20be Making sync and async connection setup somewhat more consistent. 2010-04-23 13:24:35 +01:00
Daniele Varrazzo
d915cb12a8 Functions to poll in ready state moved on the connection. 2010-04-23 13:24:35 +01:00
Daniele Varrazzo
9f5d835de6 Functions conn_poll_* renamed to conn_poll_connect_*.
These functions are used only during async connections, not for polling
afterwards.
2010-04-23 13:24:35 +01:00
Daniele Varrazzo
d2d1160260 Documentation about coroutines support reviewed. 2010-04-23 13:20:56 +01:00
Daniele Varrazzo
7af0bf0b54 Set the async_status to ASYNC_DONE after a query with wait callback.
Failing in doing that broke notifications reception.

The responsibility for changing the async_status has been moved to the
poll function: this is consistent with how the async branch is
implemented.

With this commit all the test suite passes in "green" mode.
2010-04-21 16:20:16 +01:00
Daniele Varrazzo
d71520db9a Read the server version only after connection established. 2010-04-21 15:31:07 +01:00
Daniele Varrazzo
8fed0aa57d Forbid COPY-related methods in green mode.
With the current implementation, at best they would silently block. They
actually hang everything.

Implementation posponed after some refactoring of the polling system,
because it will be probably possible to provide an implementation for
'poll()' during COPY which is good for both async and green modes.
2010-04-21 15:21:33 +01:00
Daniele Varrazzo
c1f0d4d46c Read notifications when polling an idle sync connection. 2010-04-21 15:21:33 +01:00
Daniele Varrazzo
4bb0c3bdf6 Use the wait callback in the connection setup queries. 2010-04-21 15:21:33 +01:00
Daniele Varrazzo
0ec73a18b4 'pq_execute_command_locked()' calls the wait callback if set.
The function is called without holding the GIL. Because it is necessary
to execute the Python callback if set, we need to re-acquire the GIL and
tnen release it again. In order to correctly bookkeep the thread state,
the pointer of the _save variable is passed to the function.
2010-04-21 15:21:33 +01:00
Daniele Varrazzo
7a06c0455b Try to restore the connection state after a wait callback error. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
a54932ee9c Added documentation for the green features. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
127f92f9db Changed 'psyco_wait()' to only take the connection. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
0dd5d3f1d9 Correctly flush async queries in 'green' mode. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
8ba0f00d21 Added 'get_wait_callback()' function. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
a7c41a0388 'pq_execute()' uses the user wait callback if provided. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
55270cab9f 'poll()' can raise a Python exception in case of error. 2010-04-21 15:21:32 +01:00