Commit Graph

47 Commits

Author SHA1 Message Date
Daniele Varrazzo
e3054ac9f3 Added new_array_type() function
Allows the creation of a generic array typecaster from Python.
2011-09-22 15:51:21 +01:00
Daniele Varrazzo
cd6e2cd8f2 Don't leak private variables into the psycopg2.extensions interface 2011-09-22 14:34:14 +01:00
Daniele Varrazzo
531292bca5 Merge branch 'neg-escape' into devel 2011-05-30 22:09:23 +01:00
Daniele Varrazzo
281427f450 Fixed escape for negative numbers prefixed by minus operator
Closes ticket #57.
2011-05-30 22:00:20 +01:00
Daniele Varrazzo
19ec8809fd Use all the isolation levels accepted by PostgreSQL
In PG 9.1 repeatable read and serializable are distinct levels.
2011-05-11 13:01:20 +01:00
Daniele Varrazzo
ac5cde8834 Only use absolute imports in the package
In Python 3.2b2 the relative imports are not converted into explicit
ones (with .).
2011-01-08 01:24:28 +00:00
Daniele Varrazzo
88bb8eda3e None/IN adaptation ported to Python 3. 2011-01-02 00:44:14 +01:00
Daniele Varrazzo
3e94375cf7 Merge branch 'python2' into python3
Conflicts:
	ChangeLog
	NEWS-2.3
	lib/extensions.py
	psycopg/microprotocols.c
	setup.py
2011-01-01 17:14:54 +01:00
Daniele Varrazzo
fdfa2de1a1 Fixed adaptation of None in composite types (ticket #26).
Added an adapter for None: it is usually not invoked as adaptation to
NULL is a fast path in mogrify, but can be invoked by composite types.
Notice that composite types still have the option to fast-path None
(e.g. list adapter does).
2011-01-01 17:07:54 +01:00
Daniele Varrazzo
89c492d3a4 Added b() function to return bytes in both Py2 and Py3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
b96dcef8a2 Fixed PG -> Py encodings mapping with non-alnum chars.
We mangle the encoding names a little bit before asking it to the
backend: be sure to be able to find the equivalent Python code back or
decoding (unicode cast or Py3) will barf.
2010-12-21 04:02:14 +00:00
Daniele Varrazzo
2f29429e88 Expose the Xid object in the extension module. 2010-11-05 09:34:49 +00:00
Daniele Varrazzo
4f66de494b Added tpc_prepare and CONN_STATUS_PREPARED. 2010-11-05 09:34:48 +00:00
Daniele Varrazzo
4ec298e112 Notify object exposed in the extensions module. 2010-11-05 09:34:47 +00:00
Daniele Varrazzo
e8c2a14362 Added typecasters for arrays of specific MX/Py time-related types. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
8ba0f00d21 Added 'get_wait_callback()' function. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
1446f046e9 Added wait callback and functions to deal with it. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
d162c08cfa PY* and MX* typecasters imported into the extensions module. 2010-04-14 00:27:28 +01:00
Daniele Varrazzo
54e9c89ea4 DECIMAL typecaster imported into the extensions module. 2010-04-14 00:20:16 +01:00
Federico Di Gregorio
c1a24f4ca2 NOTIFYs fix and poll status changes
POLL_OK has been changed from 3 to 0 to let the user specify a short loop
just as "if not curs.poll()" instead of having to check for write and read
separately. For an example of this, see examples/notify.py.
2010-04-05 16:52:25 +02:00
Federico Di Gregorio
34317dc4c3 Support asynchronous connection building
After calling psycopg2.connect(dsn, async=True) you can poll the
connection that will tell you whether its file descriptor should be
waited on to become writable or readable or that the connection
attempt has succeeded.

Edited commit by Jan to not expose internal state in extensions.py.
2010-04-05 11:30:03 +02:00
Daniele Varrazzo
0dbe068df4 Stop the loop variable used to create __all__ leaking in the module. 2010-02-14 00:35:47 +01:00
Federico Di Gregorio
0089201ba2 Binary was not imported from _psycopg; now it is 2010-02-13 00:52:36 +01:00
Federico Di Gregorio
a9673f31d6 SQL_IN adapter is now automatically registered 2010-02-13 00:40:29 +01:00
Federico Di Gregorio
611606d532 Changes license to LGPL3 + OpenSSL exception on all source files 2010-02-12 23:34:53 +01:00
Federico Di Gregorio
eb25f9f154 Added adapter to handle float('inf') and float('nan') 2009-01-23 00:09:20 +01:00
Federico Di Gregorio
e664abb248 Added XXXARRAY imports to psycopg2.extenions 2008-05-30 00:39:50 +02:00
James Henstridge
938c456cee Merge changes from psycopg2/trunk via psycopg2.r243. 2008-05-05 10:37:24 +08: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
Federico Di Gregorio
a779c8ef99 .get_transaction_status() implementation. 2007-04-25 22:42:36 +00:00
Federico Di Gregorio
e59ef4de4b Moved SQL_IN to extensions and away from extras. 2007-01-16 10:58:05 +00:00
Federico Di Gregorio
269156d9bf Added some file-like attributes to lobject. 2006-09-02 05:33:03 +00:00
Federico Di Gregorio
64bd7ae61c Large objects landing.. 2006-09-02 04:57:50 +00:00
Federico Di Gregorio
36785f753b Work on large objects continue. 2006-09-01 17:15:27 +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
8eb118c63f Exposed connection status. 2006-09-01 08:20:11 +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
Daniele Varrazzo
3076046b3f * libpq.dll not used anymore. win32 setup uses pg_config too.
* Some typo fixed.
2006-01-05 16:56:40 +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
f4fee20b3b In extensions.py: COMMITED -> COMMITTED. (Closes: #73) 2005-11-19 14:20:41 +00:00
Federico Di Gregorio
c7c2c38bcd Epydoc clean. :D 2005-10-18 05:57:02 +00:00
Federico Di Gregorio
0c67c641a8 Better docstrings for lib/ modules. 2005-10-18 05:42:00 +00:00
Federico Di Gregorio
06c8434520 Fixed typo in psycopg2.extensions. 2005-10-08 03:05:43 +00:00
Federico Di Gregorio
e1688431e0 Isolation level changes. 2005-10-08 03:04:40 +00:00
Federico Di Gregorio
19cb161d27 Array tokenization seems working. 2005-03-23 10:32:30 +00:00
Federico Di Gregorio
1141149cd3 License changes. Fixes. Added register_adapter(). 2005-01-20 05:49:40 +00:00
Federico Di Gregorio
c904d97f69 Initial psycopg 2 import after SVN crash. 2004-10-19 03:17:12 +00:00