Commit Graph

1080 Commits

Author SHA1 Message Date
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
Daniele Varrazzo
2dab7d52f2 Fixed bytea encoding tests skipping when ctypes is not available 2011-03-26 14:27:58 +00:00
Daniele Varrazzo
7716cc6a0c Allow to specify --static-libpq on setup.py command line
Patch provided by Matthew Ryan (ticket #48).
2011-03-26 13:48:37 +00:00
Daniele Varrazzo
90536a187d Merge branch 'bytea-parser' into devel 2011-03-26 13:02:57 +00:00
Daniele Varrazzo
da58bee70a Added documentation for the bytea parser 2011-03-26 12:59:15 +00:00
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