Changeset 804 for trunk/docs


Ignore:
Timestamp:
Jan 31, 2016, 5:57:22 PM (4 years ago)
Author:
cito
Message:

Make the automatic conversion to arrays configurable

The automatic conversion of arrays to lists can now be
disabled with the set_array() method.

Location:
trunk/docs/contents
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/contents/changelog.rst

    r802 r804  
    5252      to Python as a list. PostgreSQL records are converted to named tuples as
    5353      well, but only if you use one of the get/insert/update/delete() methods.
    54       PyGreSQL uses a new fast built-in parser to achieve this.
     54      PyGreSQL uses a new fast built-in parser to achieve this.  The automatic
     55      conversion of arrays to lists can be disabled with set_array(False).
    5556    - The pkey() method of the classic interface now returns tuples instead
    5657      of frozenset. The order of the tuples is like in the primary key index.
  • trunk/docs/contents/pg/module.rst

    r803 r804  
    429429.. versionadded:: 4.2
    430430
     431get/set_array -- whether arrays are returned as list objects
     432-------------------------------------------------------------
     433
     434.. function:: get_array()
     435
     436    Check whether arrays are returned as list objects
     437
     438    :returns: whether or not list objects will be returned
     439    :rtype: bool
     440
     441This function checks whether PyGreSQL returns PostgreSQL arrays converted
     442to Python list objects, or simply as text in the internal special output
     443syntax of PostgreSQL.  By default, conversion to list objects is activated,
     444but you can disable this with the :func:`set_array` function.
     445
     446.. versionadded:: 5.0
     447
     448.. function:: set_array(on)
     449
     450    Set whether arrays are returned as list objects
     451
     452    :param on: whether or not list objects shall be returned
     453
     454This function can be used to specify whether PyGreSQL shall return PostgreSQL
     455arrays converted to Python list objects, or simply as text in the internal
     456special output syntax of PostgreSQL.  By default, conversion to list objects
     457is activated, but you can disable this by calling ``set_array(False)``.
     458
     459.. versionadded:: 5.0
     460
     461.. versionchanged:: 5.0
     462   Arrays had been returned as text strings only in earlier versions.
     463
    431464get/set_bytea_escaped -- whether bytea data is returned escaped
    432465---------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.