Commit Graph

265 Commits

Author SHA1 Message Date
Daniele Varrazzo
ad3a198919 Fixed reference leak with arguments referenced more than once in queries
Plus, some more care in objects life cycle, mostly in exceptions handling.

Closes ticket #81.
2011-12-11 02:52:06 +00:00
Daniele Varrazzo
0fccc10777 Tests in order
Just to know where to put the next one
2011-11-18 00:10:53 +00:00
Daniele Varrazzo
417203f68e Added test to check connect() with no parameters 2011-11-17 21:51:24 +00:00
Daniele Varrazzo
625cc1b402 Escape parameters to the connection strings as required by PQconnectdb 2011-11-17 21:51:24 +00:00
Daniele Varrazzo
99ac79511c Added test module to verify the dsn manipulation 2011-11-17 21:51:24 +00:00
Daniele Varrazzo
dc94a3cb2d Check for connection closed before getting the isolation level
Closes ticket #74

Also added test to check regressions in isolation_level,
set_isolation_level, set_session, autocommit.
2011-11-16 23:51:05 +00:00
Daniele Varrazzo
865fb2d792 Work around mxDateTime 3.2.0 segfault in tests 2011-11-01 07:42:08 +00:00
Daniele Varrazzo
6fc167a7b1 Unregister the composite array caster after the test
Otherwise the refcount script will report a leak.
2011-10-19 22:00:59 +01:00
Daniele Varrazzo
0f4fd0d828 Test suite fixed to make it compatible with the ctypes implementation 2011-10-19 02:25:53 +01:00
Daniele Varrazzo
d79661c87f All unit test modules have a test_ prefix
Both for consistency and for test discovery.
2011-10-19 02:20:43 +01:00
Daniele Varrazzo
37a9eb3615 Test and document the named cursor stealing technique 2011-10-14 23:17:24 +01:00
Daniele Varrazzo
5fa1729000 Skip test on array of records on PG 8.3 2011-10-05 00:44:44 +01:00
Daniele Varrazzo
e4424bdfdc Fixed tests to run with antebellum Postgres versions 2011-10-05 00:12:35 +01:00
Daniele Varrazzo
8963b8adcb Added support for arrays of composite types 2011-09-22 19:57:42 +02:00
Daniele Varrazzo
2f9ceeac64 Added support for arrays of hstores 2011-09-22 19:56:58 +02:00
Daniele Varrazzo
c4e6d7d982 Fixed typecasting of arrays containing consecutive backslashes 2011-09-22 18:14:16 +01:00
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
8fb08efae7 Allocate dynamically memory for the list of columns in COPY
Some bloke finds the limit of 8K too restrictive... ticket #68.
2011-09-12 02:21:59 +01:00
Daniele Varrazzo
d67d50b434 Fixed interaction between RealDictCursor and named cursors
Closes ticket #67.
2011-09-12 02:20:53 +01:00
Federico Di Gregorio
880aa07a58 WITH HOLD documentation a argument parsing changes
Now any true value will do for the withhold parameter.
2011-08-10 19:21:12 +02:00
Federico Di Gregorio
a59d88c703 Merge remote-tracking branch 'piro/devel' into devel 2011-08-10 18:36:24 +02:00
Federico Di Gregorio
479bdf7458 New 'withhold' parameter for connection.cursor() 2011-08-10 18:25:46 +02:00
Daniele Varrazzo
9870ca4dce Fixed NamedTupleCursor.executemany() (ticket #65) 2011-08-09 11:44:30 +01:00
Federico Di Gregorio
2f6336ea78 First try at curs.withhold implementation 2011-07-05 10:28:34 +02:00
Daniele Varrazzo
d2b28abced Method set_transaction() renamed to set_session()
In fact it doesn't change "the transaction", as there has to be no
transaction when invoked. The effect instead is to execute SET SESSION
CHARACTERISTICS.
2011-06-08 14:22:11 +01:00
Daniele Varrazzo
679af4a975 Fixed copyfile refcount in copy_expert
In case of early error, jumping to exit would have decref'd the borrowed
reference to file.

Issue spotted by Dave Malcolm, thanks!
2011-06-07 01:20:25 +01:00
Daniele Varrazzo
3aad3d3143 Fixed test to run on Python <= 2.5
tuple.index() is not available on these versions.
2011-06-03 09:31:06 +01:00
Daniele Varrazzo
0eb5e0430e Merge branch 'transaction-control' into devel 2011-06-03 01:48:24 +01:00
Daniele Varrazzo
5748ae14bf Test tweaked to deal with missing usecs in BC timestamps
Probably depending on compile time options. On my test db usecs
are available from PG 8.4.
2011-06-03 00:54:33 +01:00
Daniele Varrazzo
4d3c6865ee Use only the isolation levels available on old PG versions 2011-06-03 00:40:54 +01:00
Daniele Varrazzo
389f2cf1d0 Added autocommit property on connection 2011-06-02 01:16:22 +01:00
Daniele Varrazzo
ea03ffbf76 Added partial implementation for set_transaction
autocommit to be implemented yet.
2011-06-01 09:07:02 +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
de6aff31b8 Skip a test on the proper PG function 2011-04-27 12:18:50 +01:00
Daniele Varrazzo
c61ec094a3 Don't fetch all the records iterating a NamedTuple cursor on a named cursor 2011-04-26 19:26:19 +01:00
Daniele Varrazzo
ffa7a62b93 Fixed interaction between NamedTuple and named cursor
Build the nametuple after fetching the first resutl, or else
cursor.description will be empty.
2011-04-26 19:18:39 +01:00
Daniele Varrazzo
88803695ac Normalize the encoding name at connection
The encoding can be set by PGCLIENTENCODING, which may be an alternative
spelling. Bug reported by Peter Eisentraut.

At this point the idea of considering one of the random spellings such as
EUC_CN as somewhat "blessed" is debunked. So just store the cleaned-up
version of the encoding in the mapping table. Note that the cleaned-up
version was needed by the unicode adapter: this requirement has been
surpassed as the connection now contains a copy of the Python codec name
set whenever the client encoding is set.
2011-04-08 13:48:11 +01:00
Daniele Varrazzo
bf48706868 Don't check the test db exists at psycopg2.tests import time 2011-03-30 15:52:49 +01:00
Daniele Varrazzo
2dab7d52f2 Fixed bytea encoding tests skipping when ctypes is not available 2011-03-26 14:27:58 +00:00
Daniele Varrazzo
e0cd6f0f00 Added tests for our own bytea parser
Because the parse function is not supposed to be exposed in Python,
use ctypes to directly inspect the C function.
2011-03-26 12:59:14 +00:00
Daniele Varrazzo
66c543b16c Parse bytea output format ourselves instead of using the libpq
PG 9.0 uses the hex format by default, and clients < 9.0 can't parse that
format, requiring client update and great care in what is linked at runtime,
and generally giving headache to users and transitively us.
2011-03-26 12:59:14 +00:00
Daniele Varrazzo
fcbe0466a6 Correctly detect an empty query sent to the backend
Closes ticket #46.
2011-03-04 20:30:43 +00:00
Daniele Varrazzo
9e00196165 Fixed use of the new return value of HstoreAdapter.get_oids() 2011-02-25 01:37:02 +00:00
Daniele Varrazzo
5211e1474b Don't limit the hstore search to the public schema only
Looks like there is a case for installing hstore somewhere else (see
ticket #45). And after all the typecaster can be registered on a list of
OIDs, so let's grab them all.
2011-02-25 00:19:49 +00:00
Daniele Varrazzo
894d3f653c Raise an exception if the libpq fails to decode bytea in hex format 2011-02-23 14:04:27 +00:00
Daniele Varrazzo
c01a7edbf4 Fixed test for execution with older PostgreSQL versions 2011-02-23 08:43:01 +00:00
Daniele Varrazzo
1db9c9b8ce The cursor name can be a non-valid PostgreSQL identifier 2011-02-23 01:53:25 +00:00
Daniele Varrazzo
143dc2e911 Added oid parameter to register_hstore()
The parameter is mostly useful with async connections that would need a
different protocol to be queried.

Issue reported by Jan "the Asynchronous".
2011-02-21 01:29:53 +00:00