Ignore:
Timestamp:
Jan 30, 2016, 2:55:18 PM (3 years ago)
Author:
cito
Message:

Port type cache and typecasting from pgdb to pg

So far, the typecasting in the classic module was been only done by
the C extension module and was not extensible through typecasting
functions in Python. This has now been made extensible by adding
a cast hook to the C extension module which has been hooked up to
a new type cache object that holds information on the types and the
associated typecast functions. All of this works very similar to the
pgdb module now, except that the basic types are still handled by
the C extension module and the Python typecast functions are only
called via the hook for types which are not supported internally.

Also added tests and a chapter on the type cache in the documentation,
and cleaned up the error messages in the C extension module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/contents/pgdb/typecache.rst

    r797 r798  
    6767    :type typ: str, list or None
    6868
    69 .. method:: TypeCache.typecast(typ, value)
     69.. method:: TypeCache.typecast(value, typ)
    7070
    7171    Cast the given value according to the given database type
     
    7373    :param str typ: PostgreSQL type name or type code
    7474    :returns: the casted value
    75 
    7675
    7776.. note::
     
    8281    :func:`pgdb.reset_typecast`.  If you do this, the current database
    8382    connections will continue to use their already cached typecast functions
    84     unless you call the :meth:`TypeCache.reset_typecast` method on the
    85     :attr:`Connection.type_cache` of the running connections.
     83    unless call the :meth:`TypeCache.reset_typecast` method on the
     84    :attr:`Connection.type_cache` objects of the running connections.
Note: See TracChangeset for help on using the changeset viewer.