Commit Graph

1195 Commits

Author SHA1 Message Date
Federico Di Gregorio
2f6336ea78 First try at curs.withhold implementation 2011-07-05 10:28:34 +02:00
Marko Kreen
cb1d163f4f lazy import for uuid module
Attached patch moves uuid import from inside try-except
to register_uuid function.  Reason: uuid module import is *very*
heavy.  It goes into OS searching for various .dll/.so libraries,
lauches 'ldconfig' and so on...

With this patch, 200x python -c 'import psycopg2.extras'
goes from 22s to 7s.  (plain 'import psycopg2' is 6s)

--
marko
2011-06-28 17:28:43 +02:00
Federico Di Gregorio
f8a5dabdc1 Preparing release 2.4.2 2011-06-12 21:40:44 +02:00
Federico Di Gregorio
3ec9677978 Aligned casing of isolation levels with PostgreSQL documentation 2011-06-12 21:40:31 +02:00
Daniele Varrazzo
d76d136b4f Introductory docs section on transaction control improved
Added big fat warning about idle in transaction and reference to
set_session().
2011-06-08 14:38:57 +01:00
Daniele Varrazzo
d2b28abced Method set_transaction() renamed to set_session()
In fact it doesn't change "the transaction", as there has to be no
transaction when invoked. The effect instead is to execute SET SESSION
CHARACTERISTICS.
2011-06-08 14:22:11 +01:00
Daniele Varrazzo
1a51cfe274 Better error message if deferrable is used in PG < 9.1 2011-06-08 10:59:27 +01:00
Daniele Varrazzo
0a1bbb56cd Dropped redundant semicolons at the end of internal queries
For consistency with other queries, and probably we give less work to do
to the server parser (a ridiculously tiny amount).
2011-06-08 09:22:35 +01:00
Daniele Varrazzo
5c13dac5ff Merge branch 'setup-cleanup' into devel 2011-06-08 08:22:03 +01:00
Jason Erickson
5ee7bac66b No manifest reinsertion into 2.4/2.5 with MSVC
Python versions 2.4 and 2.5 for MSVC on Windows do not need to manifest file
reinserted into the DLL.  The VC compiler for these versions does not have the
mt.exe executable to insert the manifest file.
2011-06-08 08:21:32 +01:00
Daniele Varrazzo
178698f9e8 Merge branch 'setup-cleanup' into devel 2011-06-07 23:58:58 +01:00
Daniele Varrazzo
7b017e7944 Mention Steve and his work in the NEWS file
That's Steve's Job! :D
2011-06-07 23:58:37 +01:00
Daniele Varrazzo
dc92161dda Delay detection of the compiler in setup.py
At init time, build_ext is not configured, so neither the --compiler option
nor settings in setup.cfg/distutil.cfg is effective.

Steve, I told you distutils was a mess :)
2011-06-07 23:28:17 +01:00
Daniele Varrazzo
d0b97feab3 More cleanup in pg_config detection from Windows registry 2011-06-07 22:35:22 +01:00
Steve Lacy
575afa2e0e Properly detect pg_config.exe on Windows.
I'm fairly certain this is correct, submitting so I can pull on my Windows
box and do some testing there.
2011-06-07 22:35:22 +01:00
Steve Lacy
46dc7e66f8 Fix pg_config commandline option broken in a previous change
- Make sure to declare self.pg_config in initialize_options.
- Don't declare PostgresConfig in __init__, as its scope is limited.
- Pass build_ext instance to PostgresConfig to avoid having to
  call the option parser directly.
2011-06-07 22:22:08 +01:00
Steve Lacy
57a6cf3144 Code to find an executable on the current PATH refactored 2011-06-07 22:18:56 +01:00
Daniele Varrazzo
6d907df14d Fixed documentation for COPY methods
The size parameter in copy_from was undocumented (ticket #59).
2011-06-07 11:16:10 +01:00
Daniele Varrazzo
9b5ac79513 Fixed default size for read copy buffer
The original commit stated it should have been 8192.
2011-06-07 11:16:06 +01:00
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