Commit Graph

20 Commits

Author SHA1 Message Date
James Henstridge
6c2e3ab49b * Add HIDDEN attribute to datetime related global variables.
* Make const strings static, which essentially makes them labels for the 
  strings.
2008-01-22 00:13:42 +00:00
James Henstridge
e054004e8f Add more const qualifiers. 2008-01-21 21:01:08 +00:00
James Henstridge
eae563ac96 * psycopg/*.[ch]: add const qualifier to various string arguments
to functions (typecast functions and conn_switch_isolation_level).
2008-01-21 17:34:08 +00:00
James Henstridge
f18881983b * psycopg/typecast_array.c (typecast_array_scan): set an initial
value for quotes to keep gcc happy.

	* psycopg/*.c: add missing static modifier on many functions.
2008-01-13 16:05:59 +00:00
James Henstridge
729117af8b * psycopg/connection_int.c (conn_close): fix for new
pq_abort_locked() prototype.
	(conn_switch_isolation_level): fix for new pq_abort_locked()
	prototype, and use pq_complete_error() to show error message.
	(conn_set_client_encoding): same here.

	* psycopg/pqpath.c (pq_execute_command_locked): remove static
	modifier.
	(pq_complete_error): same here.
	(pq_abort_locked): add pgres and error arguments.
	(pq_abort): call pq_abort_locked() to reduce code duplication.
2008-01-10 18:14:44 +00:00
James Henstridge
d190d5918a 2007-12-23 James Henstridge <james@jamesh.id.au>
* psycopg/pqpath.c (pq_execute_command_locked): add an error
	argument to hold an error when no PGresult is returned by PQexec,
	rather than using pq_set_critical().
	(pq_complete_error): new function that converts the error returned
	by pq_execute_command_locked() to a Python exception.
	(pq_begin_locked): add error argument.
	(pq_commit): use pq_complete_error().
	(pq_abort): use pq_complete_error().
	(pq_abort_locked): always call pq_set_critical() on error, and
	clear the error message from pq_execute_command_locked().
	(pq_execute): use pq_complete_error() to handle the error from
	pq_begin_locked().

	* psycopg/pqpath.c (pq_begin): remove unused function.

	* psycopg/connection_type.c (psyco_conn_commit): if conn_commit()
	raises an error, just return NULL, since it is now setting an
	exception itself.
	(psyco_conn_rollback): same here.

	* psycopg/connection_int.c (conn_commit): don't drop GIL and lock
	connection before calling pq_commit().
	(conn_rollback): same here.
	(conn_close): use pq_abort_locked().
	(conn_switch_isolation_level): same here.
	(conn_set_client_encoding): same here.

	* psycopg/pqpath.h: add prototype for pq_abort_locked().

	* psycopg/pqpath.c (pq_commit): convert function to run with GIL
	held, and handle errors appropriately.
	(pq_abort): same here.
	(pq_abort_locked): new function to abort a locked connection.

2007-12-22  James Henstridge  <james@jamesh.id.au>

	* psycopg/pqpath.c (pq_raise): add a "pgres" argument so we can
	generate nice errors not related to a particular cursor.
	(pq_execute): use pq_begin_locked() rather than pq_begin().  Use
	pq_raise() to handle any errors from it.

	* psycopg/pqpath.c (pq_execute_command_locked): helper function
	used to execute a command-style query on a locked connection.
	(pq_begin_locked): a variant of pq_begin() that uses
	pq_execute_command_locked().
	(pq_begin): rewrite to use pq_begin_locked().
2008-01-10 06:14:20 +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
277f57ffb0 - Hard limit on the connection.notices list to avoid them
growing indefinitely.
  Notices are treated as a queue: when the queue is full 
  drop the oldest notice.
2007-11-09 02:28:47 +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
967ec370ed int->size_t transition. 2007-04-13 01:16:22 +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
2ae0c32031 ZPsycopgDA now uses connection-level type-casters. 2007-02-23 15:23:06 +00:00
Federico Di Gregorio
fb0b523586 Fixed string allocation (loses: #109) 2006-06-11 03:19:18 +00:00
Federico Di Gregorio
7db16edad3 Connection encoding case fix (closes: #83). 2006-01-01 09:10:17 +00:00
Federico Di Gregorio
ef3430d24f Implemented named cursors. 2005-10-22 06:59:31 +00:00
Federico Di Gregorio
6e69ac665f Default isolation level set to 2 if not set in the server. 2005-10-08 03:14:13 +00:00
Federico Di Gregorio
e1688431e0 Isolation level changes. 2005-10-08 03:04:40 +00:00
Federico Di Gregorio
67720de497 Fixed segfault in connection.set_client_encoding(). 2005-09-30 16:48:41 +00:00
Federico Di Gregorio
1b74bb897f async fixes and better connection/cursor management. 2004-12-10 10:34:57 +00:00
Federico Di Gregorio
c904d97f69 Initial psycopg 2 import after SVN crash. 2004-10-19 03:17:12 +00:00