Commit Graph

97 Commits

Author SHA1 Message Date
James Henstridge
83b03e5e36 If we are depending on Python 2.4, we don't need to make decimal module
support conditional.
2008-12-27 00:03:11 +09:00
James Henstridge
345a254ca0 Remove conditionals on support for booleans and datetimes, since they
are guaranteed to be available in Python 2.4.
2008-12-26 23:46:35 +09:00
James Henstridge
938c456cee Merge changes from psycopg2/trunk via psycopg2.r243. 2008-05-05 10:37:24 +08:00
James Henstridge
89cadcb553 2008-03-07 Jason Erickson <jerickso@stickpeople.com>
* psycopg/psycopgmodule.c (psyco_connect): fix off by one error in
	calculating the length of the DSN.
2008-03-06 16:15:41 +00:00
James Henstridge
fe853d0261 * psycopg/typecast.c (typecast_pydatetime): make array static.
(typecast_mxdatetime): same here.

	* psycopg/typecast_builtins.c (typecast_builtins): make array
	static.

	* psycopg/psycopgmodule.c: add hidden visibility to a bunch of
	global variables here.

	* psycopg/psycopg.h: add set QueryCanceledError and
	TransactionRollbackError to hidden visibility.
2008-01-21 21:41:17 +00:00
James Henstridge
e054004e8f Add more const qualifiers. 2008-01-21 21:01:08 +00:00
James Henstridge
f64cbeda46 * tests/test_transaction.py (DeadlockSerializationTestCase): port
over some tests for serialisation and deadlock errors,
	demonstrating that TransactionRollbackError is generated.
	(QueryCancelationTests): add a test to show that
	QueryCanceledError is raised on statement timeouts.

	* psycopg2da/adapter.py (_handle_psycopg_exception): rather than
	checking exception messages, check for TransactionRollbackError.

	* psycopg/pqpath.c (exception_from_sqlstate): return
	TransactionRollbackError for 40xxx errors, and QueryCanceledError
	for 57014 errors.
	(pq_raise): If we are using an old server, use
	TransactionRollbackError if the error message contains "could not
	serialize" or "deadlock detected".

	* psycopg/psycopgmodule.c (_psyco_connect_fill_exc): remove
	function, since we no longer need to store pointers to the
	exceptions in the connection.  This also fixes a reference leak.
	(psyco_connect): remove _psyco_connect_fill_exc() function call.

	* psycopg/connection.h (connectionObject): remove exception
	members from struct.

	* psycopg/connection_type.c (connectionObject_getsets): modify the
	exception attributes on the connection object from members to
	getsets.  This reduces the size of the struct.

	* lib/extensions.py: import the two new extensions.

	* psycopg/psycopgmodule.c (exctable): add new QueryCanceledError
	and TransactionRollbackError exceptions.
2008-01-16 05:14:24 +00:00
James Henstridge
5fe08ae83e 2007-12-22 James Henstridge <james@jamesh.id.au>
* psycopg/config.h: only print debug messages if
        psycopg_debug_enabled is true.

        * psycopg/psycopgmodule.c (init_psycopg): set
        psycopg_debug_enabled to true if the $PSYCOPG_DEBUG environment
        variable is set.
2007-12-22 13:03:41 +00:00
Federico Di Gregorio
d31b4add22 Applied win32 patch from Jason Erickson. 2007-12-21 00:18:55 +00:00
James Henstridge
fd5d2d5238 * psycopg/pqpath.c (pq_raise): only remove the first 8 characters
of the exception message if it actually gives the severity.

	* psycopg/pqpath.h (pq_resolve_critical): add prototype, since
	this function is being used from connection_int.c.

	* psycopg/psycopg.h: update psyco_set_error() prototype.

	* psycopg/psycopgmodule.c (psyco_errors_init): set pgerror, pgcode
	and cursor class attributes to None on psycopg2.Error so that the
	attributes will always be available (simplifies error handling).
	(psyco_set_error): add const qualifiers to msg, pgerror and pgcode
	arguments.
	Don't bother setting pgerror, pgcode or cursor to None if they are
	not provided -- the class defaults take care of this.
2007-12-19 14:29:03 +00:00
Daniele Varrazzo
e1dd9ca843 Fixed bug #192 (Decimal support not safe for use with multiple sub
interpreters) as proposed by Graham Dumpleton.

If running in the main interpreter, use a cached version of the Decimal
object. Else repeat the object lookup.
2007-10-21 03:22:55 +00:00
Daniele Varrazzo
63773ad1e0 Added missing DECREF. 2007-10-18 17:29:15 +00:00
Federico Di Gregorio
967ec370ed int->size_t transition. 2007-04-13 01:16:22 +00:00
Federico Di Gregorio
d6f2aa27b7 Fixed mem and ref leak in connect(). 2007-04-10 06:51:35 +00:00
Federico Di Gregorio
e5829292cd Fixed both Python 2.5 and 64 bit problems. 2007-04-10 06:36:18 +00:00
Federico Di Gregorio
6598a279e2 Added support for per-cursor and per-connection typecasters. 2007-02-22 15:16:54 +00:00
Federico Di Gregorio
5642a68adb Encodings from Karsten. 2007-01-19 14:38:01 +00:00
Federico Di Gregorio
8c2c72a48a Applied patch from #148. 2007-01-16 11:32:01 +00:00
Federico Di Gregorio
a9d307140e mx fix to build on win32. 2006-09-02 09:00:47 +00:00
Federico Di Gregorio
2007652589 mx fix to build on win32. 2006-09-02 09:00:39 +00:00
Federico Di Gregorio
b8f3cef62f psycopg is enlarging.. 2006-09-01 16:27:02 +00:00
Federico Di Gregorio
64933f2004 Merge from 2_0_x branch up to r814. 2006-09-01 13:46:57 +00:00
Federico Di Gregorio
b3fdd80452 Fixed OperationalError in connection objects. 2006-09-01 11:55:27 +00:00
Federico Di Gregorio
ec865ae932 .connect() port parameter as string or int (closes: #120). 2006-09-01 08:29:30 +00:00
Federico Di Gregorio
5e590d604f Fixed memory leak (closes: #114). 2006-07-31 00:02:08 +00:00
Federico Di Gregorio
94d663c6b6 Fixed memory overflow. 2006-02-11 06:57:34 +00:00
Daniele Varrazzo
202c002c5c * Docstrings added/fixed
* Added __all__ attributes to Python modules to explicit the package API
2006-01-12 18:36:57 +00:00
Federico Di Gregorio
96ff591d79 Extra attributes for ProgrammingError exception. 2006-01-05 08:13:03 +00:00
Federico Di Gregorio
7db16edad3 Connection encoding case fix (closes: #83). 2006-01-01 09:10:17 +00:00
Daniele Varrazzo
ad76b5ba3c * psycopg/psycopgmodule.c: fixed exceptions refcount.
* fixed lots of doctrings and added Epydoc-generated docs support.
2005-11-26 07:47:48 +00:00
Federico Di Gregorio
65fe7db04d Does not crash on importing needed modules. (Closes: #32) 2005-11-15 11:51:05 +00:00
Federico Di Gregorio
f03b94d84b Run-time check for Decimal on Python 2.3. 2005-11-03 01:35:17 +00:00
Federico Di Gregorio
ef3430d24f Implemented named cursors. 2005-10-22 06:59:31 +00:00
Federico Di Gregorio
c7c2c38bcd Epydoc clean. :D 2005-10-18 05:57:02 +00:00
Federico Di Gregorio
6b0b634bae Code cleanup. 2005-10-18 01:29:47 +00:00
Federico Di Gregorio
a237209a5e Default tzinfo_factory for cursors. 2005-10-17 16:04:43 +00:00
Federico Di Gregorio
206aa79225 Working on TZ issues. 2005-10-17 15:01:14 +00:00
Federico Di Gregorio
5715a74388 Applied patches to fix docstrings. 2005-10-17 06:17:34 +00:00
Federico Di Gregorio
0c56bc95df Fixed connection parameters. 2005-06-13 04:25:09 +00:00
Federico Di Gregorio
1af8b57706 ZPsycopgDA work. 2005-05-26 07:34:27 +00:00
Federico Di Gregorio
d57ceaadc6 Release 2.0 beta 1. 2005-05-09 09:48:40 +00:00
Federico Di Gregorio
65a4b86fa2 chunk/buffer patch applied. 2005-05-09 08:11:43 +00:00
Federico Di Gregorio
48d8bd39a1 Array support completed (closes: #1). 2005-04-10 05:38:34 +00:00
Federico Di Gregorio
4805a93569 mingw patch from Daniele Varazzo. 2005-04-10 03:05:39 +00:00
Federico Di Gregorio
fdb68599c7 psycopg1 compatibility module. 2005-04-03 06:13:24 +00:00
Federico Di Gregorio
cd672525e1 Adaptation fixes (a lot.) 2005-02-28 15:50:55 +00:00
Federico Di Gregorio
c904d97f69 Initial psycopg 2 import after SVN crash. 2004-10-19 03:17:12 +00:00