Commit Graph

1651 Commits

Author SHA1 Message Date
Daniele Varrazzo
f96b68d8c6 Fixed docstring for connection.lobject() 2011-02-23 01:53:56 +00:00
Daniele Varrazzo
1db9c9b8ce The cursor name can be a non-valid PostgreSQL identifier 2011-02-23 01:53:25 +00:00
Daniele Varrazzo
66555c5f11 Fixed call of memory functions without the GIL 2011-02-23 00:48:10 +00:00
Daniele Varrazzo
20f714f17c Added error checking to _pq_fetch_tuples() 2011-02-23 00:32:23 +00:00
Daniele Varrazzo
c1715f66fe More careful memory management
- Check return value of PyErr_Malloc and set an exception in case of error
- Avoid exposing variables with refcount 0 as connection attributes.
- PyErr_Free guards itself for NULL input
2011-02-23 00:32:23 +00:00
Daniele Varrazzo
143dc2e911 Added oid parameter to register_hstore()
The parameter is mostly useful with async connections that would need a
different protocol to be queried.

Issue reported by Jan "the Asynchronous".
2011-02-21 01:29:53 +00:00
Daniele Varrazzo
beffb02d56 Stricter declaration and correct use of psyco_set_error
It has long been used in wrong ways, with the function receiving a
connection or lobject instead of a cursor. It has always been unnoticed
(nobody has noticed the wrong object attached to the exception in the
wrong cases) but it started crashing the interpreter with Python 3.2 on
Windows.

Thanks to Jason Erickson for finding the problem and helping fixing it.
2011-02-21 00:31:09 +00:00
Daniele Varrazzo
a97e2a842d Tweaks to test timing to avoid errors on test VMs 2011-02-20 19:33:22 +00:00
Daniele Varrazzo
d74f777339 Check for memory errors in the connection init 2011-02-20 18:57:04 +00:00
Daniele Varrazzo
7996333ee7 Added regression test to check {} is also a valid string 2011-02-20 12:28:50 +00:00
Benjamin Poulain
5ee60571a5 Add a type converter to handle untyped empty arrays.
Empty array can be returned untyped by postgres. To handle
this case, a special handler is added for the type UNKNOWNOID.
If the value return by the database is strictly equal to "{}",
the value is converted. Otherwise, the conversion fallback on
the default handler.
2011-02-20 12:28:10 +00:00
Daniele Varrazzo
4bc4f85229 Merge remote branch 'jason/devel' into devel
Conflicts:
	psycopg/notify_type.c
2011-02-19 16:25:31 +00:00
Daniele Varrazzo
556b4d461e Documentation cleanup
Added several links to the Python documentation using the 'intersphinx'
extension.
2011-02-19 16:16:28 +00:00
Daniele Varrazzo
75c61c2e80 Added complete roundtrip test with copy_expert and Unicode 2011-02-19 14:35:56 +00:00
Daniele Varrazzo
6098ced761 Assume there may be files returning Unicode in Python 2 too
This is the case in Python 2.7 with files implementing io.TextIOBase.
2011-02-19 14:24:15 +00:00
Daniele Varrazzo
8a08114314 Correctly handle exceptions with non-ascii chars in the message
Previous implementation would have barfed in canse of non-utf-8 data in
the message.
2011-02-19 14:16:53 +00:00
Jason Erickson
4bc47d47a5 Python 3.2 hash() return value is arch dependant
Python 3.2 hash() function will now return a 64bit value when run on a 64bit
architecture, where as previously, it would always return a 32bit value.
Modified the code to use the now Py_hash_t typedef and for Python versions
less than 3.2, hard code Py_hash_t to long and Py_uhash_t to unsigned long.
2011-02-18 23:57:25 -07:00
Daniele Varrazzo
d263ecfee7 Display a note as a note in the cursor.lastrowid docs 2011-02-19 00:52:26 +00:00
Daniele Varrazzo
1f7774bd4e Cursor docs reordered
'cast()' moved in the retrieval functions. Methods only defined for
DBAPI compliance moved to the bottom.
2011-02-19 00:44:24 +00:00
Daniele Varrazzo
837f1e5e4f Set hidden visibility to a few functions not public 2011-02-19 00:25:23 +00:00
Daniele Varrazzo
c620f18be1 Provide cursor.description as named tuple if possible
If namedtuple() is not available, use regular tuples.
2011-02-19 00:05:43 +00:00
Daniele Varrazzo
e2cbc3411d Duplicate item in NEWS dropped, quotes cleanup 2011-02-19 00:00:34 +00:00
Jason Erickson
4fdc22451e Merge branch 'devel' of github.com:jerickso/psycopg into devel 2011-02-18 13:08:33 -07:00
Jason Erickson
9dc6811135 Again, increase timeout on concurrent_exec tests
Truly increase the sleep timeout to 4 seconds and the check to 7.  Previous
commit message indicated that, but reality was different.
2011-02-18 11:52:17 -07:00
Daniele Varrazzo
836f8a1aa1 Make Binary(None) work as expected, adapting to NULL
Issue reported by Stefano Dal Pra.
2011-02-18 14:19:57 +00:00
Daniele Varrazzo
8530ef1793 Download url set to the sdist location. 2011-02-18 13:53:57 +00:00
Daniele Varrazzo
99b3c72312 Some cleanup in mogrify
- Raise an exception on incomplete placeholders.
- Minor speedups.
- Don't change the string in place (??!!) if the placeholder is not s
  and the value is null.

The latter point can be done because downstream we don't accept anything
different from s anyway (in the Bytes_Format function).

Notice that now the format string is constant whatever the arguments.
This means that executemany is still more inefficient than it should be
as mogrify may work only on the parameters. However this is an
implementation only worthwhile if we start supporting real parameters.

Let's talk about that for the next release.
2011-02-18 02:33:42 +00:00
Daniele Varrazzo
b6d6fbbe8c Use a global object for NULL
Small optimization as NULL is a frequent value to build.
2011-02-17 20:09:52 +00:00
Daniele Varrazzo
c51165e2aa Indentation fixed 2011-02-17 19:53:04 +00:00
Daniele Varrazzo
c76cace2ef Improved documentation for cursor.description
Describe what actually happens between Psycopg and PostgreSQL, not the
basic template copied from the DBAPI.
2011-02-17 13:38:18 +00:00
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
7756eae573 Merge remote branch 'jason/devel' into devel 2011-02-17 11:50:14 +00:00
Daniele Varrazzo
1ba5f104c9 Import _psycopg as the first module in the package
Failing to do so, the real cause of the _psycopg import failed may get
hidden and people may get a misleading error such as "cannot import name
tz" instead.
2011-02-17 10:45:18 +00:00
Daniele Varrazzo
3b10ef8998 Documentation about new support for binary objects improved 2011-02-16 02:54:30 +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
c96ba553da Cleanup of skipping of testing methods on certain Py/PG versions 2011-02-15 17:11:07 +00:00
Daniele Varrazzo
e4a84b9ce9 Fixed error message on Binary(str) in Python 3 2011-02-15 15:53:07 +00:00
Daniele Varrazzo
be22dfb765 Skip test if clock_timestamp function is not available 2011-02-15 15:25:14 +00:00
Daniele Varrazzo
522af403c6 Added FAQ entry about the PYTHON_EGG_CACHE problem 2011-02-15 12:50:37 +00:00
Daniele Varrazzo
5b2d54669f Fixed reference to NEWS file in the manifest 2011-02-15 12:29:14 +00:00
Daniele Varrazzo
d4eb28aed5 Dropped reference to release 2.3.3 in the docs 2011-02-15 11:00:08 +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
84352e8cfb Bump version number 2011-02-15 10:26:48 +00:00
Federico Di Gregorio
93c19d18f1 Added to manifest "*.manifest" files needed by win32/VC 2011-02-15 09:25:05 +01:00
Jason Erickson
7c9d8192a3 Increase timeout on concurrent_execution test
With test_concurrent_execution test, checking two threads issuing a pg_sleep
of 2 seconds and and check if they complete in under 3 seconds occasionally
fails when the test is run in a virtual machine on a VM Server with other
virtual machines running.  Increased the sleep to 4, and the check to 7,
giving 3 seconds buffer instead of 1 second.
2011-02-14 16:31:31 -07:00
Jason Erickson
7dfb40ce43 Windows manifest check now checks compiler type
Initial compiler check was only checking two python versions.  Changed the
check not to check python version, but compiler version, to be compatible
with more versions of python.
2011-02-14 16:03:38 -07:00
Federico Di Gregorio
3762c67cd4 Merge branch 'devel' 2011-02-13 12:28:18 +01:00
Daniele Varrazzo
3842026bed Bumped to 2.4 beta2
We may release a Windows package to let people test if ticket #20 is
fixed.
2011-02-12 20:19:14 +00:00
Daniele Varrazzo
8ab7fa596c Merge remote branch 'jason/devel' into devel 2011-02-12 20:19:07 +00:00