Commit Graph

505 Commits

Author SHA1 Message Date
Daniele Varrazzo
63ac6cdde5 Added cursor.itersize
The value is used to control the number of records to fetch per network
roundtrip in named cursors iteration. Used to avoid the inefficient
arraysize default of 1 without giving this value the magic meaning of
2000.
2011-02-17 12:36:02 +00:00
Daniele Varrazzo
bccbcf42d0 Added adaptation for objects supporting the new-style buffer interface
Supporting this interface is required to adapt memoryview on Python 2.7 as they
don't support the old style. But because the old style is long deprecated it
makes sense to start supporting the new one.
2011-02-16 01:30:25 +00:00
Daniele Varrazzo
3ae2f221b3 Adapt bytearray and memoryview to bytes if available 2011-02-15 17:30:43 +00:00
Daniele Varrazzo
e4a84b9ce9 Fixed error message on Binary(str) in Python 3 2011-02-15 15:53:07 +00:00
Daniele Varrazzo
c1fe0b675a Dropped correct roundtrip of empty array
The feature in itself is not extremely useful and instead PostgreSQL is
not always able to cast away from text[], which is a regression see
(ticket #42).
2011-02-15 10:27:47 +00:00
Daniele Varrazzo
8ab7fa596c Merge remote branch 'jason/devel' into devel 2011-02-12 20:19:07 +00:00
Marti Raudsepp
9cb72a38da Add negative infinity support for Python->pg conversion 2011-02-12 20:19:02 +00:00
Jason Erickson
560f52106c Windows manifest changes based upon architecture
Apparently, using * for the architecture has the potential to not work on
on some amd64 systems.  Added checks and split the manifest based upon
architecture.
2011-02-11 10:01:38 -07:00
Jason Erickson
b075017ad9 Pulled down changes from dvarrazzo branch on gh
Pulled the master branch from of Daniele's psycopg branch on github and
merged the changes.
2011-02-10 15:59:31 -07:00
Jason Erickson
8d28509f49 Change win32 build to reinsert VC Library Manifest
Added a change at the end of the build process that would reinsert the VC library manifest.  This patch will fix issues when an embedded program does not have a manifest pointing to the VC 2008 runtime library, such as in an apache/mod_python situation.

Signed-off-by: Jason Erickson <jerickso@stickpeople.com>
2011-02-10 13:17:14 -07:00
Federico Di Gregorio
da27142882 Merge branch 'python3' into python2 2011-02-06 16:47:05 +01:00
Daniele Varrazzo
fab31e9441 Fetch 'arraysize' records per roundtrip in named cursors iteration
Closes ticket #33.
2011-02-05 15:24:00 +01:00
Daniele Varrazzo
b544354db2 COPY sends unicode to a file if it derives from io.TextIoBase
Fixes ticket #36.
2011-02-05 15:12:37 +01:00
Daniele Varrazzo
b358c54f02 More efficient cursor.iter: fetch many records at time. 2011-02-04 12:22:07 +00:00
Daniele Varrazzo
d40b394c50 Merge branch 'python2' into python3 2011-02-01 02:27:45 +00:00
Daniele Varrazzo
a2dcf504b5 Hopefully really fixed crash in datetime adapter.
Verified with gcc 4.3. Notice that on gcc 4.4 the bug was not present.
2011-02-01 02:00:47 +00:00
Daniele Varrazzo
789dda1173 lobject read and write can deal with both bytes and unicode
On write, unicode is encoded in connection encoding.
On read, respect the lobject mode 't' or 'b'.
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
ba1d77a297 Large object mode parsing refactored
Added parsing of text/binary mode.
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
79048ff19a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	tests/__init__.py
	tests/test_lobject.py
	tests/test_quote.py
	tests/testutils.py
2011-01-10 00:46:02 +00:00
Daniele Varrazzo
48588e5f69 Invalidate large objects after a two-phase commit operation 2011-01-10 00:20:55 +00:00
Daniele Varrazzo
935c25730a Fixed segfault in large object close.
Check that the connection is not closed/faulty before attempting lo_close.
2011-01-10 00:11:14 +00:00
Daniele Varrazzo
9deb16484d Don't define a CObject API in Python 3.2
The API is not available: a PyCapsule should be used. Nobody seems
needing it for now.
2011-01-08 01:24:16 +00:00
Daniele Varrazzo
b8c8cddc2d Fixed argument parsing in lobject.read
Using an int instead of a Py_ssize_t randomly crashed Python 3.1 64 bit.
2011-01-04 02:27:02 +01:00
Daniele Varrazzo
80bd6e2794 Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	psycopg/connection_type.c
	tests/test_connection.py
	tests/types_basic.py
2011-01-03 21:43:02 +01:00
Daniele Varrazzo
abd7991968 Fixed refcount bug with connection destroyed in a 2PC transaction 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
5f6e773575 Broken circular reference in async execution
If a connection is destroyed before an async operation is completed, the
`async_cursor` member creates a reference loop, leaving the connection and
the cursor alive. `async_cursor` is now a weak reference.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
19ff51ae75 The cursor is weakly referenceable 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
04cf90cc21 The connection is weakly referenceable 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
5888b03608 Fixed "historical" reference leak in TimestampFromTicks
Added an internal function with C signature to avoid the creation of a
tuple to be later unpacked. When the tuple was decref'd, Python 2.4 64
bits regularly segfaulted; Python 2.5 less regularly; don't know about
other versions.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
39dd577c90 Use the proper printf placeholders to avoid warnings on 64 bit builds 2011-01-03 20:44:57 +01:00
Daniele Varrazzo
b276e3b05d Fixed compiling on Python versions before 2.6
Added a few macros not defined in Py 2.4. Don't know about 2.5.
2011-01-03 19:18:50 +01:00
Daniele Varrazzo
9eae66e8cf Added Py3 compatibility macro for Py_TPFLAGS_HAVE_WEAKREFS 2011-01-03 16:56:26 +01:00
Daniele Varrazzo
929d62053a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	setup.py
2011-01-02 03:28:00 +01:00
Daniele Varrazzo
159cda3688 Added cursor.cast() method
The method exposes the typecasters lookup algorithm. Useful to create
recursive typecasters.
2011-01-01 22:55:10 +01:00
Daniele Varrazzo
3e94375cf7 Merge branch 'python2' into python3
Conflicts:
	ChangeLog
	NEWS-2.3
	lib/extensions.py
	psycopg/microprotocols.c
	setup.py
2011-01-01 17:14:54 +01:00
Daniele Varrazzo
30921b58a8 Dropped conversion from None to NULL in adapter.
It was an error as the string is not conform to the protocol. The error
is masked by the None fast path in _mogrify, but surfaces when adapting
a tuple contains a None.
2010-12-31 18:55:33 +01:00
Daniele Varrazzo
ac25816962 Use the same Bytes_Format function for both Python 2 and 3.
This makes the behaviour between the two versions similar. It also have
the effect of a more specific error message in case an user specifies a
placeholder different from 's'.
2010-12-31 03:22:19 +01:00
Daniele Varrazzo
2930ed3d59 Dropped support for all format specifiers except s in PyBytes_Format. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
6882ac31d4 Dropped warnings in PyBytes_Format function. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
96a950d3eb Fixed 2-phase commit support in Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
89fb60de4b Column names in copy methods can be unicode. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
73917c15e1 Fixed COPY FROM to deal with decoded files. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
bc28cc8b00 Use unicode keys as strings in Py3.
This fixes pyformat style argument passing. Unicode and bytes don't
compare equal (even if they hash the same).
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
061079c918 In Py3, decode the tuple values before passing to the typecaster.
Not sure this is the best way to go: it is now impossible to write a
binary typecaster in Python; furthermore it is the opposite approach of
the codecs, which should return bytes.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
f6fefbea64 Function psycopg_ensure_bytes converted in a "filter" stealing a ref. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
3214c23f51 Fixed adaptation in several adapters.
The getquoted methods always return bytes. The str() convert this
representation to string on the fly.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
2e22eef727 Added utility function to convert bytes to string in Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
d3f3f1caf0 Added utility method to return a string in the connection encoding.
In Py2 the result is plain string, in Py3 an unicode decoded in the
connection encoding.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
56e4c2bd55 Redefining the microprotocol on Py3 as returning bytes. 2010-12-31 03:18:26 +01:00
Daniele Varrazzo
014b6a6d5b Use psycopg_ensure_bytes() to unify Py2/3 code paths. 2010-12-31 03:18:26 +01:00