Commit Graph

1338 Commits

Author SHA1 Message Date
Daniele Varrazzo
fa032f09fb Attempt to fix issue #113.
If the network is down, trying to read blocking will hang the process hard
(ctrl-c not working). Send a cancel signal instead (as suggested in
http://archives.postgresql.org/pgsql-hackers/2012-07/msg00903.php) and go
back into a green polling: this should allow a further error (e.g. another
ctrl-c) to break the loop. In this case we cannot assume anything about
the state of the connection, so we close it.
2012-10-09 02:01:29 +01:00
Daniele Varrazzo
6d1b3b21e6 Added function conn_close_locked() 2012-10-09 02:01:29 +01:00
Daniele Varrazzo
f4f67ad985 Dropped compiler warning on Py 2.4 2012-10-06 01:22:05 +01:00
Daniele Varrazzo
387b7b6b36 Using super() in the connection/cursor subclasses
This opens to collaborative subclassing (e.g. you may want to have a
logging namedtuple cursor...)
2012-09-28 02:51:58 +01:00
Daniele Varrazzo
74e6efd717 Raise TypeError instead of InterfaceError on bad params on connect()
TypeError is the standard Python error raised in this case:

    $ python -c "(lambda a: None)(b=10)"
    TypeError: <lambda>() got an unexpected keyword argument 'b'

We only used to raise InterfaceError when connect was used without
any parameter at all, so it's hard to think a program depending on
that design. Furthermore the function has always raised (and still
does) OperationalError too, if the bad argument is detected by the
libpq, and that cannot be changed because we can't tell the
difference from a normal connection error.
2012-09-26 11:55:21 +01:00
Daniele Varrazzo
bc68b2ff1e Improved error message on connect when kwargs are passed together with dns 2012-09-26 11:47:06 +01:00
Daniele Varrazzo
32fae728b3 Dropped quirks in connection arguments handling
Now connect() raises an exception instead of swallowing keyword arguments
when a connection string is specified as well

Closes ticket #131.
2012-09-25 23:46:46 +01:00
Daniele Varrazzo
a733416241 Fixed SQL_IN when getquoted() is called without prepare() 2012-09-24 16:55:01 +01:00
Daniele Varrazzo
d183657c11 Info about hstore versions history moved from code to docs 2012-09-22 02:10:58 +01:00
Daniele Varrazzo
c7bee92160 Fixed infinite loop when parsing '{' as array 2012-09-20 03:19:24 +01:00
Daniele Varrazzo
72e9cf7b6d Fixed return value after malformed arrays 2012-09-10 04:20:39 +01:00
Daniele Varrazzo
fc5cc1df01 Fixed note on rollback on close in the doc
It's not like we call "rollback()": we close the connection and the
backend rolls back on its own. It may have differences, e.g. conn poolers.
2012-08-15 12:28:13 +01:00
Daniele Varrazzo
7cb754fbc9 Fixed smell of pizza in the docs 2012-08-15 12:25:35 +01:00
Daniele Varrazzo
bc400f6961 Fixed tests to run with PG 8.3 2012-09-04 21:23:19 +01:00
Federico Di Gregorio
64674787fd Fixed always true comparaison 2012-08-17 14:52:59 +02:00
Daniele Varrazzo
cc951b5fbe Fixed tpc_recover() with RealDictStuff
Same problem and correction of ticket #114.
2012-08-14 23:29:19 +01:00
Daniele Varrazzo
fd4153d632 Fixed register_hstore and register_composite with non-dbapi objects
Closed ticket #114.
2012-08-14 23:26:17 +01:00
Daniele Varrazzo
e369fb5f0d Fixed incorrect and outdated connection.commit() doc 2012-07-27 17:44:28 +01:00
Daniele Varrazzo
ee7890d700 Fixed typo in docs
Ticket #115 closed.
2012-07-08 22:52:24 +01:00
Daniele Varrazzo
ea203f0587 Added %% use to the docs 2012-05-29 23:53:02 +01:00
Daniele Varrazzo
c7d1271ab4 Fixed cursor name as unicode string on Python 3 2012-05-27 08:58:55 +01:00
Daniele Varrazzo
874a74fe94 Dropped GIL release around function calling PyMem_Malloc
Closes ticket #110.
2012-05-22 17:22:57 +01:00
Daniele Varrazzo
55828c2ea3 Fixed superclass methods call.
Methods execute() and callproc() in DictCursor and RealDictCursor should
call DictCursorBase methods, not _cursor's ones.

Reported by Alexey Luchko on the ML.
2012-05-08 15:48:07 +01:00
Daniele Varrazzo
667387e746 Fixed text docs build on Python 3
Thanks to Arfrever for the patch (ticket #107).
2012-04-11 18:18:40 +01:00
Daniele Varrazzo
47336c7428 Merge branch 'cursor-args-fix' into MAINT_2_4 2012-04-11 18:12:27 +01:00
Daniele Varrazzo
210eeb875d Bump to next dev release 2012-04-11 18:11:59 +01:00
Daniele Varrazzo
73df259f7b Added news entry about cursor() cleanup 2012-04-11 18:11:04 +01:00
Daniele Varrazzo
365a1b20a7 Added tests to verify cursor() arguments propagation 2012-04-11 18:00:18 +01:00
Daniele Varrazzo
c86ca7687f Fixed cursor() arguments propagation to other connection classes 2012-04-11 17:59:16 +01:00
Corry Haines
095cce5605 Allow user to override connection factory cursors
Prior to this change, using a extras.connection_factory would not allow
any other cursor to be used on that connection. It was set in stone.

This change allows all cursor options to pass through and override the
connection factory behaviors. This allows a connection_factory to be
dropped into existing code with no disruption.

This change also standardizes the extras.connection_factories to have
the same behavior and all pass through *args and **kwargs.
2012-04-11 17:36:04 +01:00
Daniele Varrazzo
27421f1e41 Name can be passed as None to cursor()
Makes invocation from subclasses and generic code easier.

Code simplified by using default values for keyword arguments
and avoiding needless conversions back and forth between Python and C
strings. Also added connection type check to cursor's init.
2012-04-11 17:32:10 +01:00
Daniele Varrazzo
c63891af8d Fixed bad error return code from cursor's init 2012-04-11 17:26:11 +01:00
Federico Di Gregorio
d7c8c1c49a Merge branch 'devel' 2012-03-28 23:09:15 +02:00
Federico Di Gregorio
037b704e9a Bumping up versions to prepare 2.4.5 2012-03-28 23:08:59 +02:00
Daniele Varrazzo
67064f8e03 All the FAQ have they own id that can be used in URLs to refer to 2012-03-09 16:55:02 +00:00
Daniele Varrazzo
5473d50a09 Added more information about the case of the missing lo_truncate
After some ML message and ticket #104.
2012-03-09 16:55:02 +00:00
Federico Di Gregorio
550130b19e Merge remote-tracking branch 'piro/devel' into devel
Conflicts:
	psycopg/lobject_int.c
2012-03-08 12:28:52 +01:00
Daniele Varrazzo
b8c75d9de0 Merge branch 'gcc-python-plugin' into devel 2012-03-05 02:48:11 +00:00
Daniele Varrazzo
37aa62ca52 Merge branch 'close-idempotent' into devel 2012-03-05 02:47:52 +00:00
Daniele Varrazzo
2c309dfdb4 Mention the static analysis cleanup in the news 2012-03-05 02:38:21 +00:00
Daniele Varrazzo
8707d8c399 Fixed iterator refcount in case of memory error during COPY 2012-03-05 02:09:20 +00:00
Daniele Varrazzo
735d50c782 Check if the object wrapped in binary is not None before trying the other types
Otherwise it seems we clobber some result with NULL.
2012-03-05 02:08:45 +00:00
Daniele Varrazzo
a9dc1b83ad Methods callbacks signatures match the flags they are exported with 2012-03-05 01:26:28 +00:00
Daniele Varrazzo
531084d561 Stricter types usage in several PyArg_ParseTuple calls 2012-03-04 18:01:08 +00:00
Daniele Varrazzo
0e832b97ea Proper type check in prepare() methods for list, binary, qstring 2012-03-04 17:59:51 +00:00
Daniele Varrazzo
84f2a370f6 close() methods don't raise errors if called on closed objects 2012-03-04 05:10:07 +00:00
Daniele Varrazzo
2cbedbee45 Dropped test about close() on closed connection raising an exception
This seems unnecessary and has caused problems to a few. The DB-SIG seems
agreeing on the change:
http://mail.python.org/pipermail/db-sig/2011-October/005811.html
2012-03-04 05:10:06 +00:00
Daniele Varrazzo
76cc838a93 Expressions rewritten in a more normal way
(double)'0'? :)
2012-03-04 04:47:21 +00:00
Daniele Varrazzo
5bbfd38dfb Check for errors in float adaptation 2012-03-04 04:43:14 +00:00
Daniele Varrazzo
6cece00958 Check failed list creation in array adaptation 2012-03-04 04:42:44 +00:00