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
Daniele Varrazzo
a97e2a842d
Tweaks to test timing to avoid errors on test VMs
2011-02-20 19:33:22 +00:00
Daniele Varrazzo
7996333ee7
Added regression test to check {} is also a valid string
2011-02-20 12:28:50 +00:00
Benjamin Poulain
5ee60571a5
Add a type converter to handle untyped empty arrays.
...
Empty array can be returned untyped by postgres. To handle
this case, a special handler is added for the type UNKNOWNOID.
If the value return by the database is strictly equal to "{}",
the value is converted. Otherwise, the conversion fallback on
the default handler.
2011-02-20 12:28:10 +00:00
Daniele Varrazzo
4bc4f85229
Merge remote branch 'jason/devel' into devel
...
Conflicts:
psycopg/notify_type.c
2011-02-19 16:25:31 +00:00
Daniele Varrazzo
75c61c2e80
Added complete roundtrip test with copy_expert and Unicode
2011-02-19 14:35:56 +00:00
Daniele Varrazzo
c620f18be1
Provide cursor.description as named tuple if possible
...
If namedtuple() is not available, use regular tuples.
2011-02-19 00:05:43 +00:00
Jason Erickson
4fdc22451e
Merge branch 'devel' of github.com:jerickso/psycopg into devel
2011-02-18 13:08:33 -07:00
Jason Erickson
9dc6811135
Again, increase timeout on concurrent_exec tests
...
Truly increase the sleep timeout to 4 seconds and the check to 7. Previous
commit message indicated that, but reality was different.
2011-02-18 11:52:17 -07:00
Daniele Varrazzo
836f8a1aa1
Make Binary(None) work as expected, adapting to NULL
...
Issue reported by Stefano Dal Pra.
2011-02-18 14:19:57 +00:00
Daniele Varrazzo
99b3c72312
Some cleanup in mogrify
...
- Raise an exception on incomplete placeholders.
- Minor speedups.
- Don't change the string in place (??!!) if the placeholder is not s
and the value is null.
The latter point can be done because downstream we don't accept anything
different from s anyway (in the Bytes_Format function).
Notice that now the format string is constant whatever the arguments.
This means that executemany is still more inefficient than it should be
as mogrify may work only on the parameters. However this is an
implementation only worthwhile if we start supporting real parameters.
Let's talk about that for the next release.
2011-02-18 02:33:42 +00:00
Daniele Varrazzo
63ac6cdde5
Added cursor.itersize
...
The value is used to control the number of records to fetch per network
roundtrip in named cursors iteration. Used to avoid the inefficient
arraysize default of 1 without giving this value the magic meaning of
2000.
2011-02-17 12:36:02 +00:00
Daniele Varrazzo
7756eae573
Merge remote branch 'jason/devel' into devel
2011-02-17 11:50:14 +00:00
Daniele Varrazzo
3ae2f221b3
Adapt bytearray and memoryview to bytes if available
2011-02-15 17:30:43 +00:00
Daniele Varrazzo
c96ba553da
Cleanup of skipping of testing methods on certain Py/PG versions
2011-02-15 17:11:07 +00:00
Daniele Varrazzo
be22dfb765
Skip test if clock_timestamp function is not available
2011-02-15 15:25:14 +00:00
Daniele Varrazzo
c1fe0b675a
Dropped correct roundtrip of empty array
...
The feature in itself is not extremely useful and instead PostgreSQL is
not always able to cast away from text[], which is a regression see
(ticket #42 ).
2011-02-15 10:27:47 +00:00
Jason Erickson
7c9d8192a3
Increase timeout on concurrent_execution test
...
With test_concurrent_execution test, checking two threads issuing a pg_sleep
of 2 seconds and and check if they complete in under 3 seconds occasionally
fails when the test is run in a virtual machine on a VM Server with other
virtual machines running. Increased the sleep to 4, and the check to 7,
giving 3 seconds buffer instead of 1 second.
2011-02-14 16:31:31 -07:00
Daniele Varrazzo
8ab7fa596c
Merge remote branch 'jason/devel' into devel
2011-02-12 20:19:07 +00:00
Daniele Varrazzo
4c336a51bc
Added test to check issue #40
2011-02-12 20:19:02 +00:00
Jason Erickson
e3095edad3
Python 3 conversion failure on Windows
...
Windows is not able to create a tempfile with NamedTemporaryFile and then
open it with a second file handle without closing the first one. Added
code to close the handle, and keep the file around a little longer so it
can be reopened and rewritten to again.
2011-02-11 17:40:23 -07:00
Jason Erickson
ed42746027
Merge branch 'devel' of git://github.com/dvarrazzo/psycopg into devel
2011-02-11 13:37:19 -07:00
Daniele Varrazzo
9e9c221637
Work around a 2to3 next fixer bug in a test
2011-02-11 17:54:41 +00:00
Jason Erickson
68ccac1766
Fixed linefeeds on merged files to unix linefeeds
...
Merge utility changed the linefeeds from unix to windows. Changed the
linefeeds back to unix linefeeds.
2011-02-10 17:16:10 -07:00
Jason Erickson
3fc4dcec06
Merge remote branch 'upstream/devel' into devel
...
Conflicts:
setup.py
tests/__init__.py
tests/testconfig.py
2011-02-10 16:07:38 -07:00
Jason Erickson
b075017ad9
Pulled down changes from dvarrazzo branch on gh
...
Pulled the master branch from of Daniele's psycopg branch on github and
merged the changes.
2011-02-10 15:59:31 -07:00
Daniele Varrazzo
7a058403ca
Fixed mapping for composite types defined in a schema
2011-02-09 02:22:03 +01:00
Federico Di Gregorio
da27142882
Merge branch 'python3' into python2
2011-02-06 16:47:05 +01:00
Daniele Varrazzo
fab31e9441
Fetch 'arraysize' records per roundtrip in named cursors iteration
...
Closes ticket #33 .
2011-02-05 15:24:00 +01:00
Daniele Varrazzo
b544354db2
COPY sends unicode to a file if it derives from io.TextIoBase
...
Fixes ticket #36 .
2011-02-05 15:12:37 +01:00
Jason Erickson
88cc5a986d
Use tests.dsn for the dsn connection string
...
Using self.conn.dsn as the dsn connection string actually has the password
'x'ed out. The initial connection replaces the password with 'x' to
obfuscate it. Using tests.dsn instead of self.conn.dsn ensures that the
correct connection string is used.
2011-02-02 17:14:29 -07:00
Jason Erickson
dcd2e19bde
Add PSYCOPG2_TESTDB_PASSWORD variable for tests
...
Add a check for the PSYCOPG2_TESTDB_PASSWORD environment variable if the
database user (or database settings) requires a password.
2011-02-02 17:14:12 -07:00
Daniele Varrazzo
8a1de1ec4e
Added test to verify named cursor efficiency.
...
Iter shouldn't fetch one record at time.
2011-02-01 03:01:47 +00:00
Daniele Varrazzo
bde443a902
Fixed standard_conforming_strings filtering in Python 3 tests
2011-01-18 02:45:31 +00:00
Daniele Varrazzo
9f90f049ab
Merge branch 'python2' into python3
...
Conflicts:
tests/bug_gc.py
tests/types_extras.py
2011-01-18 02:11:58 +00:00
Daniele Varrazzo
153c30f24b
Skip composite type tests if the server doesn't support them
2011-01-18 02:09:49 +00:00
Daniele Varrazzo
ca3d9da83b
Skip GC bug test if uuid is not available
2011-01-18 02:09:49 +00:00
Daniele Varrazzo
06059a216f
Fixed hstore test in PG 9.x with standard_conforming_strings off
2011-01-18 00:58:33 +00:00
Daniele Varrazzo
8e1257d7d0
Fixed check for pg_sleep availability in tests
...
The function is available since PG 8.2.
2011-01-18 00:57:27 +00:00
Daniele Varrazzo
3ba0631dbb
A few large objects tests fixed
...
The behavior changed in Python 3 after the lobject-decode merge.
2011-01-10 22:05:47 +00:00
Daniele Varrazzo
ba1d77a297
Large object mode parsing refactored
...
Added parsing of text/binary mode.
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
f63167a92c
Added tests to check large objects decoding
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
79048ff19a
Merge branch 'python2' into python3
...
Conflicts:
NEWS-2.3
tests/__init__.py
tests/test_lobject.py
tests/test_quote.py
tests/testutils.py
2011-01-10 00:46:02 +00:00
Daniele Varrazzo
48588e5f69
Invalidate large objects after a two-phase commit operation
2011-01-10 00:20:55 +00:00
Daniele Varrazzo
935c25730a
Fixed segfault in large object close.
...
Check that the connection is not closed/faulty before attempting lo_close.
2011-01-10 00:11:14 +00:00
Daniele Varrazzo
38641b93ea
Test decorator moved into the test utilities module
2011-01-09 23:44:58 +00:00
Daniele Varrazzo
15a09da96d
Added license to unit tests
...
As the test suite is now part of the source distribution.
2011-01-09 23:44:35 +00:00
Daniele Varrazzo
f8c4335f35
Avoid ResourceWarning in tests in Python 3.2
2011-01-08 23:54:48 +00:00
Daniele Varrazzo
43c8fce45c
Silence warnings due to deprecated TestCase methods
...
With a veiled criticism.
2011-01-08 23:54:17 +00:00
Daniele Varrazzo
7c1b03bd45
All tests made executable.
2011-01-07 00:58:29 +00:00
Daniele Varrazzo
80bd6e2794
Merge branch 'python2' into python3
...
Conflicts:
NEWS-2.3
psycopg/connection_type.c
tests/test_connection.py
tests/types_basic.py
2011-01-03 21:43:02 +01:00
Daniele Varrazzo
5f6e773575
Broken circular reference in async execution
...
If a connection is destroyed before an async operation is completed, the
`async_cursor` member creates a reference loop, leaving the connection and
the cursor alive. `async_cursor` is now a weak reference.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
19ff51ae75
The cursor is weakly referenceable
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
04cf90cc21
The connection is weakly referenceable
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
8b0af283f6
Don't register the unicode typecaster globally during tests
...
It can invalidate the results in further runs in the same process.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
131c6a25e9
Unregister test adapters to keep a more precise references count
2011-01-03 21:34:46 +01:00
Daniele Varrazzo
a01700d478
Fixed test suite execution as a script
...
Don't know why I changed the defaultTest argument into a function when I
converted the test suite into a package: that argument should be really
a string.
2011-01-03 20:45:03 +01:00
Daniele Varrazzo
929d62053a
Merge branch 'python2' into python3
...
Conflicts:
NEWS-2.3
setup.py
2011-01-02 03:28:00 +01:00
Daniele Varrazzo
3cc8719998
Added missing test to the test suite.
2011-01-02 03:00:44 +01:00
Daniele Varrazzo
88bb8eda3e
None/IN adaptation ported to Python 3.
2011-01-02 00:44:14 +01:00
Daniele Varrazzo
7ac0bdd661
Added PostgreSQL composite types typecaster to Python tuples.
2011-01-02 00:34:13 +01:00
Daniele Varrazzo
159cda3688
Added cursor.cast() method
...
The method exposes the typecasters lookup algorithm. Useful to create
recursive typecasters.
2011-01-01 22:55:10 +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
b5a8facb9c
Added test to show failed adaptation of None in records.
2010-12-31 18:54:50 +01:00
Daniele Varrazzo
0a4eeb4e13
Fixed notification tests to run on Py3.
...
Call 2to3 on the dynamically generated scripts.
2010-12-31 03:18:27 +01:00