Commit Graph

1426 Commits

Author SHA1 Message Date
Daniele Varrazzo
9a7aee3d05 Fixed compatibility problem in setup for Python 2.4 2011-06-07 08:58:54 +01:00
Steve Lacy
ef18915396 Unify the way the MSVC compiler is detected
And do it only once in __init__ instead of different ways
and in different places.
2011-06-07 08:41:57 +01:00
Steve Lacy
c826446ff8 Clean up a bunch of lint from pylint/pyflakes/pep8 checking
- Don't override global variable name "ext" (use "extension" as function
  argument names)
- Improve function naming (get_compiler -> get_compiler_name)
- Other misc operator spacing and 80-column violation cleanup.
- Remove unneeded import (DistUtilsFileError)
2011-06-07 08:40:40 +01:00
Steve Lacy
f3526d0630 Refactoring of the pg_config detection code in setup.py
Pull all state and path searching into it's own class.
2011-06-07 08:40:19 +01:00
Daniele Varrazzo
816b5dda33 Merge branch 'copy-refcount-bug' into devel 2011-06-07 01:20:37 +01:00
Daniele Varrazzo
679af4a975 Fixed copyfile refcount in copy_expert
In case of early error, jumping to exit would have decref'd the borrowed
reference to file.

Issue spotted by Dave Malcolm, thanks!
2011-06-07 01:20:25 +01:00
Daniele Varrazzo
e9a485e30b Merge branch 'copy-refcount-bug' into devel 2011-06-07 00:14:11 +01:00
Daniele Varrazzo
b6e710b0fc Fixed refcount bug in copy_to() and copy_expert() methods too 2011-06-07 00:08:29 +01:00
Daniele Varrazzo
1888bf41c0 Added patch for refcount bug in copy_from
By Dave Malcolm. https://bugzilla.redhat.com/show_bug.cgi?id=711095
(slightly edited to increment the refcount before storing the pointer
in the cursor).
2011-06-07 00:08:29 +01:00
Daniele Varrazzo
2a1b2b5713 Added script to demonstrate the refcount bug during copy
from https://bugzilla.redhat.com/show_bug.cgi?id=711095
2011-06-07 00:08:29 +01:00
Jason Erickson
dd7ee7093a No strcasecmp function with MSVC
The MSVC compiler does not have the strcasecmp(x, y) function, which is a
case insensitve string compare function.  Instead, MSVC has a similar function,
lstrcmpi(x, y).  Modified config.h to use this function when building with
MSVC.
2011-06-05 23:33:28 +01:00
Daniele Varrazzo
442a0606fe Merge branch 'guc-cleanup' into devel 2011-06-05 16:31:25 +01:00
Daniele Varrazzo
709df38d79 Don't clobber an eventual Python exception set by a green thread 2011-06-05 16:30:37 +01:00
Daniele Varrazzo
869d48b6f0 Use the pqpath functions to get/set GUC parameters
Functions conn_setup(), conn_get_isolation_level(), conn_set_transaction(),
conn_switch_isolation_level(), conn_set_client_encoding() reimplemented
using the pqpath funtitons.

Dropped analogous function in the connection, as it had to take the lock,
thus it was hard to build consistent pieces of functionality with it.
2011-06-05 16:26:01 +01:00
Daniele Varrazzo
8f876d4b5d Avoid a deadlock using concurrent green threads on the same connection
Use the async_cursor property to store an indication that something is
running (even if it is not necessarily a cursor running the query).
2011-06-05 16:22:54 +01:00
Daniele Varrazzo
cf6a4ec062 Added pqpath functions to get/set the value for GUC parameters
The aim of these function is to allow the connection to make a better use
of the pqpath functions instead of using PQexec for these small things.
Also, the functions are to be called with the connection lock: this makes
composing higher level functions using them easier.
2011-06-05 15:36:02 +01:00
Daniele Varrazzo
dcc9e84a68 Don't encode the pg_config path on Python 3 on Windows
It can deal with unicode ok, and fails if it gets bytes.
2011-06-04 22:26:21 +01:00
Daniele Varrazzo
a0d16fcfb2 Avoid a ton of warnings when building on mingw
mingw doesn't support visibility hidden even if gcc can.
2011-06-04 22:19:56 +01:00
Daniele Varrazzo
62a8ef308a Fixed version check 2011-06-04 14:21:18 +01:00
Daniele Varrazzo
c8ec747903 Don't fail import if mx.DateTime module is not found at import time
A better fix for ticket #53.
2011-06-04 14:16:24 +01:00
Daniele Varrazzo
05659c0d16 Cleanup of notice processing
The function is always called in the context of functions grabbing the
connection lock, so just use the same critical section instead of releasing
and re-acquiring it. It is not a problem as serious as the notifies process
(ticket #55) as the notices are a psycopg structure, not libpq. However the
change allows again processing notices/notifies in the same place,
which makes sense conceptually, plus we save some lock dance.
2011-06-04 01:49:03 +01:00
Daniele Varrazzo
d9c0b8166f Process notifies when data is received, not when the result is parsed
Notifies process access the connection, is not limited to the result, so
There is the possibility of loss of protocol sync in multithread programs.

Closes ticket #55.
2011-06-04 01:31:36 +01:00
Daniele Varrazzo
3aad3d3143 Fixed test to run on Python <= 2.5
tuple.index() is not available on these versions.
2011-06-03 09:31:06 +01:00
Daniele Varrazzo
0eb5e0430e Merge branch 'transaction-control' into devel 2011-06-03 01:48:24 +01:00
Daniele Varrazzo
530ba78881 Documentation for set_transaction() and autocommit improved 2011-06-03 01:46:56 +01:00
Daniele Varrazzo
5748ae14bf Test tweaked to deal with missing usecs in BC timestamps
Probably depending on compile time options. On my test db usecs
are available from PG 8.4.
2011-06-03 00:54:33 +01:00
Daniele Varrazzo
4d3c6865ee Use only the isolation levels available on old PG versions 2011-06-03 00:40:54 +01:00
Daniele Varrazzo
c2d1f1f2e6 Dropped isolation level from the connection object
Don't issue a SET TRANSACTION ISOLATION LEVEL at every begin: use PG's
GUC default, eventually set by set_transaction.

Dropped the last query at connection, yay!

Method set_isolation_level() and property isolation_level refactored using
the new structures, keeping the previous semantic.
2011-06-03 00:10:24 +01:00
Daniele Varrazzo
389f2cf1d0 Added autocommit property on connection 2011-06-02 01:16:22 +01:00
Daniele Varrazzo
ea03ffbf76 Added partial implementation for set_transaction
autocommit to be implemented yet.
2011-06-01 09:07:02 +01:00
Daniele Varrazzo
a69facc7f0 Adding docs for the planned set_transaction/autocommit features 2011-05-31 00:05:50 +01:00
Daniele Varrazzo
531292bca5 Merge branch 'neg-escape' into devel 2011-05-30 22:09:23 +01:00
Daniele Varrazzo
281427f450 Fixed escape for negative numbers prefixed by minus operator
Closes ticket #57.
2011-05-30 22:00:20 +01:00
Daniele Varrazzo
19ec8809fd Use all the isolation levels accepted by PostgreSQL
In PG 9.1 repeatable read and serializable are distinct levels.
2011-05-11 13:01:20 +01:00
Daniele Varrazzo
834c7d1288 Fixed a few docstrings mixed up 2011-05-11 12:59:31 +01:00
Daniele Varrazzo
af424821b7 Don't build mx.DateTime support if the module can't be imported
Previously we only checked for the existence of the include files, but this
doesn't imply the presence of the module. Particularly true in restricted
environments such as virtualenv.

Closes ticket #53.
2011-05-11 12:59:31 +01:00
Daniele Varrazzo
c687f1d816 Bump to next development release 2011-05-11 12:59:31 +01:00
Federico Di Gregorio
ab685c2fc0 Merge branch 'devel' 2011-05-11 09:58:49 +02:00
Federico Di Gregorio
9080b30741 Preparing release 2.4.1 2011-05-11 09:58:34 +02:00
Daniele Varrazzo
de6aff31b8 Skip a test on the proper PG function 2011-04-27 12:18:50 +01:00
Daniele Varrazzo
c61ec094a3 Don't fetch all the records iterating a NamedTuple cursor on a named cursor 2011-04-26 19:26:19 +01:00
Daniele Varrazzo
ffa7a62b93 Fixed interaction between NamedTuple and named cursor
Build the nametuple after fetching the first resutl, or else
cursor.description will be empty.
2011-04-26 19:18:39 +01:00
Daniele Varrazzo
80891e64b3 Dropped unused import 2011-04-26 19:16:10 +01:00
Daniele Varrazzo
c08799b0b0 Fixed SystemError clobbering libpq errors raised without SQLSTATE
Bug vivisectioned by Eric Snow
<http://archives.postgresql.org/psycopg/2011-04/msg00019.php>.
2011-04-24 02:59:28 +01:00
Daniele Varrazzo
746afdf69f Added missing vertical spaces in NEWS 2011-04-15 01:11:22 +01:00
Daniele Varrazzo
e316d7bcd4 Merge branch 'fix-encoding' into devel 2011-04-09 14:47:07 +01:00
Daniele Varrazzo
e3605b33c1 Updated NEWS with the connection encoding fix 2011-04-08 14:36:49 +01:00
Daniele Varrazzo
19653a88ec Store a normalized version of the PG encoding in the connection
This way looking up into extensions.encodings will not break.
2011-04-08 13:48:11 +01:00
Daniele Varrazzo
88803695ac Normalize the encoding name at connection
The encoding can be set by PGCLIENTENCODING, which may be an alternative
spelling. Bug reported by Peter Eisentraut.

At this point the idea of considering one of the random spellings such as
EUC_CN as somewhat "blessed" is debunked. So just store the cleaned-up
version of the encoding in the mapping table. Note that the cleaned-up
version was needed by the unicode adapter: this requirement has been
surpassed as the connection now contains a copy of the Python codec name
set whenever the client encoding is set.
2011-04-08 13:48:11 +01:00
Daniele Varrazzo
bf48706868 Don't check the test db exists at psycopg2.tests import time 2011-03-30 15:52:49 +01:00