Commit Graph

467 Commits

Author SHA1 Message Date
James Henstridge
7d80c05748 * tests/test_transaction.py
(TransactionTestCase.test_failed_commit): Expect IntegrityError
	instead of OperationalError.

	* psycopg/pqpath.c (exception_from_sqlstate): new function that
	converts an SQLSTATE error code to the corresponding exception
	class.
	(pq_raise): use exception_from_sqlstate() to pick which exception
	to use when working with protocol version 3.
	(pq_complete_error): Let pq_raise() pick an appropriate exception
	rather than forcing OperationalError.
2008-01-11 15:10:21 +00:00
James Henstridge
86597f6939 * psycopg/adapter_binary.c (binary_quote): apply Brandon Rhodes'
patch from ticket #209 to check return value from
	PyObject_AsCharBuffer().  This fixes the segfault.
	(binary_quote): switch from PyObject_AsCharBuffer() to
	PyObject_AsReadBuffer() to support buffer objects that don't
	implement the bf_getcharbuf protocol.

	* tests/types_basic.py (TypesBasicTests.testBinary): Test round
	tripping of bytea buffers.  Currently segfaults.
2008-01-10 22:19:23 +00:00
Daniele Varrazzo
67afd678b0 Added 'make check' target, running all the available tests.
Most of the updates have been provided by James Henstridge.

Closes ticket #195.
2007-11-11 10:40:12 +00:00
Daniele Varrazzo
75cb5d75d7 Use escape string syntax for string escape if connected to a server
requiring it.

Added a connection flag to store whether E''-style quoting is required: this
avoids repeated PQparameterStatus() calls.

Added a test case to verify correct behavior on strings, unicode and binary 
data. Tested with PG versions from 7.4 to 8.3b2, with any server
'standard_conforming_strings' setting and with 'PSYCOPG_OWN_QUOTING' too.
2007-11-11 08:53:44 +00:00
Daniele Varrazzo
a6ea092acc - Tabs fixed. 2007-11-11 03:58:45 +00:00
Federico Di Gregorio
1ed16c8265 Added test for DateTime object allocation bug. 2007-09-19 13:40:18 +00:00
Federico Di Gregorio
c9e701baa9 Fixed bug #194 (and added nice MD project not that C/C++ is supported.) 2007-09-08 08:54:30 +00:00
Federico Di Gregorio
9f9af5f907 Fixed patch from #119. 2006-09-01 12:36:38 +00:00
Federico Di Gregorio
f88b973bd1 Empty binary buffer segfault fix (closes: #119). 2006-09-01 08:23:51 +00:00
Federico Di Gregorio
95365f0f3e Added DBAPI 2.0 conformance tests in tests/. 2006-02-11 06:55:17 +00:00
Federico Di Gregorio
c281a38236 Releasing 2.0b4. 2005-07-17 04:26:27 +00:00
Federico Di Gregorio
b300cd2550 Fixed .execute() segfault. 2005-06-02 04:30:31 +00:00
Federico Di Gregorio
2804f9a6a9 Regression tests fixes. 2005-05-27 08:43:33 +00:00
Federico Di Gregorio
9316c6af53 Optimizations to type casting (in preparation to array support.) 2005-03-12 06:39:47 +00:00
Federico Di Gregorio
131b8ac1c5 Preparing 1.99.12. 2005-03-03 06:52:28 +00:00
Federico Di Gregorio
9bf185f6a9 Added unit test for DictCursor. 2005-01-13 16:50:29 +00:00
Federico Di Gregorio
6ad60725be Writing tests... 2004-12-20 02:33:12 +00:00