Commit Graph

1832 Commits

Author SHA1 Message Date
Daniele Varrazzo
e1266d52cd More functions annotated for static analysis
Also more return values checked for values < 0 for errors, instead of
checking == 0 and leaving the positive side unchecked
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
5bfb6cdefe Use more compact macros to annotate functions for the static checker 2012-03-01 02:53:28 +00:00
Daniele Varrazzo
f2e4a8ed78 Functions setting exception return a negative value on error
This works around another shortcoming of the static checker; also to be
discussed with the author.
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
9432787279 Work around a false positive returned by the static checker
To be submitted to the author.
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
a167822e26 Use the newly provided attributes to validate exceptions raising
Be more consistent in using 0 for success, <0 for failure, and to check
for values < 0 instead of specific -1.
2012-03-01 02:53:28 +00:00
Marti Raudsepp
b97599166e Update all links to PostgreSQL docs to the current version.
I also checked all links and anchors to make sure they're still valid.
2012-02-28 18:28:07 +02:00
Daniele Varrazzo
67712e4226 Fixed possible NULL dereferencing in fetchmany()/fetchall() 2012-02-24 22:26:02 +00:00
Daniele Varrazzo
6d76e81166 Fixed possible NULL dereferencing in callproc() 2012-02-24 22:26:02 +00:00
Daniele Varrazzo
94a53b48df Building rows simplified
Dropped repeated checks for tuple_factory.
Internal functions refactored a bit.
2012-02-24 22:26:02 +00:00
Daniele Varrazzo
efee049338 Added error check in _mogrify for failed tuple creation 2012-02-24 22:26:02 +00:00
Daniele Varrazzo
0ee641361b Flag a few other functions returning borrowed refs 2012-02-24 22:26:01 +00:00
Daniele Varrazzo
4ecfd48671 Fixed possible NULL dereferencing in notice process 2012-02-24 22:25:56 +00:00
Daniele Varrazzo
a6df55f4e3 Flag the psycopg_ensure_*() functions as stealing a ref 2012-02-24 10:41:02 +00:00
Daniele Varrazzo
5f3f35a2c2 Mark getnextarg function as returning a borrowed reference 2012-02-24 04:25:08 +00:00
Daniele Varrazzo
fc78fb09c0 Dropped unused pq_resolve_critical() return value 2012-02-24 04:00:12 +00:00
Daniele Varrazzo
4eea8bc912 Dropped redundant check on the status before rollback
The check is better done inside the critical section.
2012-02-24 03:28:20 +00:00
Daniele Varrazzo
5fcbe7bd0f Check/set connection status at commit inside the critical section
Failing to do so was causing the issue reported in ticket #103. The issue
as reported was fixed when SET ISOLATION LEVEL was dropped, but the real
problem wasn't fixed.
2012-02-24 03:28:20 +00:00
Daniele Varrazzo
b2c61eaa18 Merge branch 'types-arrays' into devel 2012-02-24 00:35:21 +00:00
Daniele Varrazzo
a165f86127 Added docs about how to create a generic array typecaster 2012-02-24 00:33:28 +00:00
Daniele Varrazzo
0c337a2029 Added support for inet array 2012-02-23 23:56:55 +00:00
Daniele Varrazzo
36b6c80ed1 register_uuid takes more iterables types as oids argument
Also added docs for the function parameters.
2012-02-23 23:51:28 +00:00
Daniele Varrazzo
9ffa1f4b59 Fixed inet test that wasn't testing anything 2012-02-23 23:35:05 +00:00
Daniele Varrazzo
98d6d96ee3 Fixed exception testing on Python 3
...and so caught exceptions are local to the except suite in Py3.
(Lo sapevate? Sapevatelo!)
2012-02-23 23:15:42 +00:00
Daniele Varrazzo
e57f3284eb Merge branch 'cursors-rownumber' into devel 2012-02-23 23:05:40 +00:00
Daniele Varrazzo
1d7e6afcf0 Ticket #100 closed
Note that rownumber is still broken for named cursors: it is reset to zero
when each itersize block is fetched.
2012-02-23 23:04:54 +00:00
Daniele Varrazzo
b8597dc1d3 Fixed NamedTupleCursor rownumber during iteration.
The correction is similar to the other one for the other subclasses.

Also added tests for rowcount and rownumber during different fetch styles.
Just in case.
2012-02-23 22:58:58 +00:00
Daniele Varrazzo
ebec522a07 Fixed rownumber for cursor subclasses during iterations
Regression introduced to fix ticket #80. Don't use fetchmany to get the
chunks of values. I did it that way because I was ending up into infinite
recursion calling __iter__ from __iter__: the solution has been the
"while 1: yield next()" idiom.
2012-02-23 22:55:13 +00:00
Daniele Varrazzo
7221ea9ec5 Added test to check rowcount behaves fine during named cursor iteration
Actually *it doesn't*: once we iterate the first itersize records, rowcount
is reset to zero. If we want to fix it we need an extra member in the
cursor.
2012-02-23 22:04:22 +00:00
Daniele Varrazzo
71d1690870 Test methods reordered to improve readability 2012-02-23 21:27:45 +00:00
Daniele Varrazzo
3b36100ec1 Dropped hardcoded list of exceptions in init functions
Use the already available exctable array.

This stops the gcc-python-plugin complaining about access to potentially
uninitialized memory.
2012-02-23 20:09:28 +00:00
Daniele Varrazzo
09be4dc5d1 Fixed potential failures while setting exceptions attributes 2012-02-23 19:48:46 +00:00
Daniele Varrazzo
7d67ecbed3 Fixed potential NULL incref 2012-02-23 19:47:36 +00:00
Daniele Varrazzo
1b27820389 Fixed refcount of exceptions dicts 2012-02-23 19:36:30 +00:00
Daniele Varrazzo
08fbd86495 Check errors in module typecasters init 2012-02-23 19:20:51 +00:00
Daniele Varrazzo
ff61cf25b6 Fixed refcount of None if namedtuples are not available 2012-02-23 18:50:06 +00:00
Daniele Varrazzo
026899e0c1 Check errors when populating encodings map 2012-02-23 18:50:06 +00:00
Daniele Varrazzo
dca6cffd6e Dropped custom array parsing for UUID[]
Use the C generic array parsing exposed by new_array_type().
2012-02-23 14:41:55 +00:00
Daniele Varrazzo
f782470d71 Parens don't need escaping in regexp char classes 2012-02-23 14:41:51 +00:00
Daniele Varrazzo
1332d4a0d8 Fixed never raised exception in composite parsing 2012-02-23 14:41:46 +00:00
Daniele Varrazzo
4e1d96082a Typos fixed in copy methods 2012-02-23 14:41:41 +00:00
Nate Eagleson
1bc73896dc Clean up comments in setup.cfg 2012-02-22 11:59:48 +00:00
Nate Eagleson
f3f3dbbca9 Fix typos in the INSTALL document
Also remove a bit of extraneous whitespace.
2012-02-22 11:59:48 +00:00
Daniele Varrazzo
91388d2c51 Cite Menno's TZ improvements into news file 2012-01-30 13:32:58 +00:00
Menno Smits
bca7200b3f Cache FixedOffsetTimezone instances
Avoid creating new a new FixedOffsetTimezone instance if one with the
same offset and name has been created before. This will save memory
when returning many rows containing "timestamp with timezone" columns,
and also improves comparability.
2012-01-30 13:27:40 +00:00
Menno Smits
1469a56512 Fixed repr for FixedOffsetTimezone for offsets west of UTC (negative)
The offset displayed was always positive and somewhat confusing. The
offset displayed now is the offset that the instance was created
with.

Also added some tests for initialisation.
2012-01-30 13:27:01 +00:00
Menno Smits
35ff2def34 Renamed shadowed test method 2012-01-29 19:35:38 +00:00
Daniele Varrazzo
78895e6943 Added doc for Error.cursor 2012-01-19 01:30:46 +00:00
Daniele Varrazzo
db987250c8 Avoid installing Error.__reduce_ex__ on Python 2.4
It is not used by the pickle protocol, and if called manually fails in an
unsettling way, probably because the exceptions were old-style classes.
2012-01-14 18:01:15 +00:00
Daniele Varrazzo
43daba38e7 Make Error and subclasses picklable
Useful for multiprocessing interaction.
Closes ticket #90.
2012-01-14 17:34:09 +00:00
Daniele Varrazzo
28f1013c2a Dropped duplicate import 2012-01-14 17:28:37 +00:00