Commit Graph

248 Commits

Author SHA1 Message Date
Chris Withers
1487800b6d New implementation of Range sorting that works for Python 2.5 to 3.3, at least. 2014-02-22 23:06:02 +00:00
Chris Withers
f739576f0a Provide a stable and consistent sort order for Range objects.
This matches postgres server-side behaviour and helps client applications that need to sort based on the primary key of tables where the primary key is or contains a range.
2014-02-22 23:06:02 +00:00
Daniele Varrazzo
434fbb02b1 Fixed error message on range parsing failed 2014-02-19 01:03:01 +00:00
Daniele Varrazzo
eb36e75b89 Fixed comparison of Range with non-range objects
Fixes ticket #164.

Patch from Chris Withers on master.
2013-06-18 14:16:06 +01:00
Piotr Kasprzyk
5f320e52f4 Fix multiple misspellings 2013-04-26 10:32:21 +01:00
Daniele Varrazzo
b8fbe599ac Make sure to return a bytes string from numeric range adapter 2013-04-21 20:30:03 +01:00
Daniele Varrazzo
29e96179f2 The UUID adapter returns bytes instead of str in Python 3
Also added __conform__ method to the adapter.
2013-04-07 22:20:38 +01:00
Daniele Varrazzo
884a7f7db6 A couple of typos fixed 2013-04-07 16:05:36 +01:00
Daniele Varrazzo
2b554937f2 Dropped __all__ from modules
They were only used to generate docs with Epydoc, now largely forgotten.

Imports in extras cleaned up to expose the API only.
2013-04-07 02:59:30 +01:00
Daniele Varrazzo
d5d6a1f4c7 Enable by default the range typecasters
Otherwise it would have been enabled importing psycopg2.extras,
which is a surprising behaviour.
2013-04-07 02:37:55 +01:00
Daniele Varrazzo
9e15f54fe8 Added cursor_factory connection attribute and connect() parameter 2013-04-07 02:30:12 +01:00
Daniele Varrazzo
b6873ee1ab Dropped support for Python 2.4 2013-03-20 23:40:13 +00:00
Daniele Varrazzo
97311967e8 Merge branch 'diagnostics' into devel 2013-03-18 02:21:09 +00:00
Daniele Varrazzo
9e79112e25 Expose the Diagnostics object in the extensions module 2013-03-17 23:58:10 +00:00
Daniele Varrazzo
06bfa801f4 Fixed range adaptation on Python 3 2013-03-16 22:12:41 +00:00
Daniele Varrazzo
e1ff432f4c Merge branch 'dead-bytes' into devel 2013-03-16 16:25:17 +00:00
Daniele Varrazzo
6df6e6adfe Fixed pickling of DictRow objects too 2012-12-11 01:10:45 +00:00
Daniele Varrazzo
99bedd1bb2 Fixed pickling of RealDictRow objects 2012-12-10 23:54:25 +00:00
Daniele Varrazzo
27cd6c4880 Added specific pool implementation for ZPsycopgDA
The implementation is based on psycopg 2.4, which should be less broken
(zope-wise) of the current one.

Instantiating psycopg2.pool.PersistentConnectionPool now raises a warning.

This should fix ticket #123, #125. The issue of the reset on
set_client_encoding() is still present but that's always been there and I'm no
good at fixing it.
2012-12-04 00:30:58 +00:00
Daniele Varrazzo
9a031db8b9 Fixed empty strings handling in composite caster
Closes ticket #141.
2012-12-03 14:19:09 +00:00
Daniele Varrazzo
2a9e5c7203 Dropped configuration of unused logger inside the pool module 2012-12-03 00:39:47 +00:00
Daniele Varrazzo
1feb179fba Fixed pickling of FixedOffsetTimezone objects
I have also verified that the fixed class can unpickle instance pickled with
the buggy one and viceversa.

Fixes ticket #135.
2012-10-21 21:47:32 +01:00
Daniele Varrazzo
a33c0670fd More idiomatic way to call FixedOffsetTimezone.__new__ superclass 2012-10-21 21:16:52 +01:00
Daniele Varrazzo
f5f2e2c092 Dropped redundant call to FixedOffsetTimezone.__init__ 2012-10-21 21:12:02 +01:00
Daniele Varrazzo
9f9da182f1 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
4244d5953a Merge branch 'range-type' into devel 2012-09-27 00:48:05 +01:00
Daniele Varrazzo
dda24f082f Merge branch 'json' into devel 2012-09-27 00:41:04 +01:00
Daniele Varrazzo
33043cd038 Merge branch 'composite-custom' into devel 2012-09-27 00:38:00 +01:00
Daniele Varrazzo
bc1d2f5d3a Merge remote-tracking branch 'github/connect-keywords' into devel 2012-09-26 13:15:33 +01:00
Daniele Varrazzo
20d3d0f66d 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
cf3c6f86ff Improved error message on connect when kwargs are passed together with dns 2012-09-26 11:47:06 +01:00
Daniele Varrazzo
cd316a94f1 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
b894539007 Fixed json doc error 2012-09-25 00:12:57 +01:00
Daniele Varrazzo
b8b669611e More helpful error messasge on Range order attempts 2012-09-25 00:07:08 +01:00
Daniele Varrazzo
7b1973354f Fixed SQL_IN when getquoted() is called without prepare() 2012-09-24 16:55:01 +01:00
Daniele Varrazzo
71e2f190c2 Json documentation improved 2012-09-24 11:51:35 +01:00
Daniele Varrazzo
a3418052e9 Don't create/register a json array typecaster if no oid provided 2012-09-24 11:23:09 +01:00
Daniele Varrazzo
c756d580f2 Added documentation for range types and adaptation 2012-09-24 00:49:44 +01:00
Daniele Varrazzo
b1953640d2 Don't need to implement __new__ to make an immutable class 2012-09-24 00:49:02 +01:00
Daniele Varrazzo
a858987844 Fixed search of types into schemas.
We don't need to look for stuff implicitly into pg_catalog as all
the builtin ranges are already registered. So just search into
'public' if the schema is not specified.
2012-09-24 00:49:02 +01:00
Daniele Varrazzo
841ddaba87 Range objects cannot be ordered 2012-09-23 22:54:50 +01:00
Daniele Varrazzo
25ef540aa3 Range objects are nonzero when not empty 2012-09-23 22:43:23 +01:00
Daniele Varrazzo
a96a4349ed Range objects are immutable and hashable 2012-09-23 22:40:13 +01:00
Daniele Varrazzo
e002ea5937 Dropped Range._empty attribute
We can do with just _bounds: it will make eq and hash easier to
implement in a consistent way
2012-09-23 22:10:33 +01:00
Daniele Varrazzo
d2cee6f9ad Added in operator for ranges 2012-09-23 22:01:39 +01:00
Daniele Varrazzo
94c6353d55 NumberRange renamed to NumericRange
I was avoiding Numeric to avoid conflicting with the 'numeric'
Postgres type, which is an alias for 'decimal'. But now that there
is a single numeric range I can use the preferred name
2012-09-23 21:11:06 +01:00
Daniele Varrazzo
45cbcc0713 Dropped Range classes for specific numeric types 2012-09-23 21:08:18 +01:00
Daniele Varrazzo
5e7c1d0b51 Added first implementation of Range type, adapter, typecaster 2012-09-23 21:03:36 +01:00
Daniele Varrazzo
9949e04c70 Added schema attribute to CompositeCaster 2012-09-22 15:10:40 +01:00
Daniele Varrazzo
59151886a0 Info about hstore versions history moved from code to docs 2012-09-22 02:10:58 +01:00