Commit Graph

1070 Commits

Author SHA1 Message Date
Daniele Varrazzo
e0cd6f0f00 Added tests for our own bytea parser
Because the parse function is not supposed to be exposed in Python,
use ctypes to directly inspect the C function.
2011-03-26 12:59:14 +00:00
Daniele Varrazzo
66c543b16c Parse bytea output format ourselves instead of using the libpq
PG 9.0 uses the hex format by default, and clients < 9.0 can't parse that
format, requiring client update and great care in what is linked at runtime,
and generally giving headache to users and transitively us.
2011-03-26 12:59:14 +00:00
Daniele Varrazzo
f34e44b3f4 Merge branch 'empty-query' into devel 2011-03-04 20:33:51 +00:00
Daniele Varrazzo
fcbe0466a6 Correctly detect an empty query sent to the backend
Closes ticket #46.
2011-03-04 20:30:43 +00:00
Daniele Varrazzo
f1d69f6dec Fixed detection of empty error from pq_raise
Avoid a system error in case err is set to an empty string.
2011-03-04 20:20:56 +00:00
Daniele Varrazzo
4a8b5f98f3 Bump to work on 2.4.1 2011-03-04 20:18:22 +00:00
Federico Di Gregorio
2212ea96a6 Preparing release 2.4
* NEWS file now uses 72 columns (better in emails and posts)
* Bumped versions
* Updated MonoDevelop file
2011-02-27 12:52:00 +01:00
Daniele Varrazzo
194447fbbf Merge branch 'msvc-cleanup' into devel
Merged Jason Erickson devel branch after collapsing a few commits together
where it made sense.
2011-02-25 10:29:19 +00:00
Jason Erickson
2997c0eb6c Windows MSVC: 64bit compiler sees 2 export symbols
The MSVC compiler sees a request for the main symbol (init__pyscopg) to be
exported twice during the build process and issues a warning in 64bit mode.
One symbol is from distutils exporting the library with the
build_ext.get_export_symbols() function, the other is from the #define
PyMODINIT_FUNC (define in pyport.h) that begins the main _psycopg module.
This patch overrides the get_export_symbols function and returns an empty
array of symbols to export if the compiler is MSVC.
2011-02-25 10:25:12 +00:00
Jason Erickson
7c2fa77c4b Windows MSVC: Fixed warning of incompatible types
Fixed incompatible type warning from XidObject * to PyObject * by
casting.
2011-02-25 10:25:12 +00:00
Jason Erickson
961e855bbd Windows MSVC: Fix Compiler Warning: getpid
Fix a compiler warning when using PSYCOPG_DEBUG on MSVC where getpid is
undefined.
2011-02-25 10:25:12 +00:00
Jason Erickson
631883f62f Windows MSVC: Fix data loss compiler warnings
Fixed MSVC compiler warnings where it was indicating a conversion
from a larger data type to smaller data type might have data loss.
2011-02-25 10:25:12 +00:00
Daniele Varrazzo
9e00196165 Fixed use of the new return value of HstoreAdapter.get_oids() 2011-02-25 01:37:02 +00:00
Daniele Varrazzo
5211e1474b Don't limit the hstore search to the public schema only
Looks like there is a case for installing hstore somewhere else (see
ticket #45). And after all the typecaster can be registered on a list of
OIDs, so let's grab them all.
2011-02-25 00:19:49 +00:00
Daniele Varrazzo
29ac03ef04 Check for failed allocation in the notice callback 2011-02-24 10:14:06 +00:00
Daniele Varrazzo
343687ebc8 Fixed runtests -> check in INSTALL file 2011-02-24 10:10:27 +00:00
Jason Erickson
6f0dfe6d2d Windows MSVC: Remove /Wp64 compiler flag
Remove the /Wp64 flag since it is deprecated starting in Visual Studio 2008.
2011-02-23 14:29:44 -07:00
Daniele Varrazzo
f9862211b1 NEWS for release 2.4 ordered in groups 2011-02-23 14:23:34 +00:00
Daniele Varrazzo
894d3f653c Raise an exception if the libpq fails to decode bytea in hex format 2011-02-23 14:04:27 +00:00
Daniele Varrazzo
c01a7edbf4 Fixed test for execution with older PostgreSQL versions 2011-02-23 08:43:01 +00:00
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