
s/Uc           @   s;  d  Z  d d UxJ dR D]B Z e d e d d Ue d e d d Ue d e d d Uq Wd d l Z d d l Z d d l m Z m Z m Z dT dU Z Z	 dW dX Z
 Z dZ d[ Z Z d e f d     YZ d e f d      YZ d! e f d"     YZ d# e f d$     YZ d% e f d&     YZ d' e f d(     YZ d) e f d*     YZ d+ e f d,     YZ d- e f d.     YZ d/ e f d0     YZ d1 e f d2     YZ d3 e f d4     YZ d5 e f d6     YZ d7 e f d8     YZ d9 e f d:     YZ d; e f d<     YZ d d= l  m! Z! d d> d d? d d e# d@  Z$ dA Z% dB Z& dC Z' dD Z( e rke Z) n e* Z) dE Z+ dF Z, dG Z- dH   Z. dI   Z/ dJ   Z0 dK   Z1 dL   Z2 dM   Z3 dN   Z4 d dO l  m5 Z5 m6 Z6 e e e e e$ e e e e e e e e e e e e5 e! e6 g Z7 d dP l8 m9 Z9 e9   dQ Z: [9 d S(\   s   Mathieu Fenniaks   from struct import StructNt   it   ht   qt   dt   ft   iiit   iit   qiit   diit   ihihiht   cit   bht   ccccs   _struct = Struct('!s   ')s
   _unpack = s   _struct.unpack_froms   _pack = s   _struct.packii   (   t   binary_typet   integer_typest   PY2i   i   i   i?   t   Warningc           B   s   e  Z d  Z RS(   s   Generic exception raised for important database warnings like data
    truncations.  This exception is not currently used by pg8000.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   t   __name__t
   __module__t   __doc__(    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   0   s   t   Errorc           B   s   e  Z d  Z RS(   s   Generic exception that is the base exception of all other error
    exceptions.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   :   s   t   InterfaceErrorc           B   s   e  Z d  Z RS(   si  Generic exception raised for errors that are related to the database
    interface rather than the database itself.  For example, if the interface
    attempts to use an SSL connection but the server refuses, an InterfaceError
    will be raised.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   D   s   t   DatabaseErrorc           B   s   e  Z d  Z RS(   s   Generic exception raised for errors that are related to the database.
    This exception is currently never raised by pg8000.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   P   s   t	   DataErrorc           B   s   e  Z d  Z RS(   s   Generic exception raised for errors that are due to problems with the
    processed data.  This exception is not currently raised by pg8000.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   Z   s   t   OperationalErrorc           B   s   e  Z d  Z RS(   s=  
    Generic exception raised for errors that are related to the database's
    operation and not necessarily under the control of the programmer. This
    exception is currently never raised by pg8000.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   d   s   t   IntegrityErrorc           B   s   e  Z d  Z RS(   s  
    Generic exception raised when the relational integrity of the database is
    affected.  This exception is not currently raised by pg8000.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   p   s   t   InternalErrorc           B   s   e  Z d  Z RS(   sN  Generic exception raised when the database encounters an internal error.
    This is currently only raised when unexpected state occurs in the pg8000
    interface itself, and is typically the result of a interface bug.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR   {   s   t   ProgrammingErrorc           B   s   e  Z d  Z RS(   s&  Generic exception raised for programming errors.  For example, this
    exception is raised if more parameter fields are in a query string than
    there are available parameters.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR      s   t   NotSupportedErrorc           B   s   e  Z d  Z RS(   s   Generic exception raised in case a method or database API was used which
    is not supported by the database.

    This exception is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR      s   t   ArrayContentNotSupportedErrorc           B   s   e  Z d  Z RS(   s   
    Raised when attempting to transmit an array where the base type is not
    supported for binary data transfer by the interface.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR      s   t   ArrayContentNotHomogenousErrorc           B   s   e  Z d  Z RS(   sl   
    Raised when attempting to transmit an array that doesn't contain only a
    single type of object.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR      s   t   ArrayContentEmptyErrorc           B   s   e  Z d  Z RS(   s   Raised when attempting to transmit an empty array. The type oid of an
    empty array cannot be determined, and so sending them is not permitted.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR      s   t!   ArrayDimensionsNotConsistentErrorc           B   s   e  Z d  Z RS(   sf   
    Raised when attempting to transmit an array that has inconsistent
    multi-dimension sizes.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR       s   t   Byteac           B   s   e  Z d  Z RS(   s   Bytea is a str-derived class that is mapped to a PostgreSQL byte array.
    This class is only used in Python 2, the built-in ``bytes`` type is used in
    Python 3.
    (   R   R   R   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR!      s   t   Intervalc           B   s   e  Z d  Z d d d d  Z d   Z d   Z d   Z e d   e  Z e d   e  Z	 e d   e  Z
 d	   Z d
   Z d   Z RS(   s
  An Interval represents a measurement of time.  In PostgreSQL, an interval
    is defined in the measure of months, days, and microseconds; as such, the
    pg8000 interval type represents the same information.

    Note that values of the :attr:`microseconds`, :attr:`days` and
    :attr:`months` properties are independently measured and cannot be
    converted to each other.  A month may be 28, 29, 30, or 31 days, and a day
    may occasionally be lengthened slightly by a leap second.

    .. attribute:: microseconds

        Measure of microseconds in the interval.

        The microseconds value is constrained to fit into a signed 64-bit
        integer.  Any attempt to set a value too large or too small will result
        in an OverflowError being raised.

    .. attribute:: days

        Measure of days in the interval.

        The days value is constrained to fit into a signed 32-bit integer.
        Any attempt to set a value too large or too small will result in an
        OverflowError being raised.

    .. attribute:: months

        Measure of months in the interval.

        The months value is constrained to fit into a signed 32-bit integer.
        Any attempt to set a value too large or too small will result in an
        OverflowError being raised.
    i    c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t   microsecondst   dayst   months(   t   selfR#   R$   R%   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   __init__   s    		c         C   sV   t  | t  s t d   n4 t | k  o5 t k  n sI t d   n	 | |  _ d  S(   Ns$   microseconds must be an integer types6   microseconds must be representable as a 64-bit integer(   t
   isinstanceR   t	   TypeErrort   min_int8t   max_int8t   OverflowErrort   _microseconds(   R&   t   value(    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   _setMicroseconds   s    c         C   sV   t  | t  s t d   n4 t | k  o5 t k  n sI t d   n	 | |  _ d  S(   Ns   days must be an integer types.   days must be representable as a 32-bit integer(   R(   R   R)   t   min_int4t   max_int4R,   t   _days(   R&   R.   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   _setDays   s    c         C   sV   t  | t  s t d   n4 t | k  o5 t k  n sI t d   n	 | |  _ d  S(   Ns   months must be an integer types0   months must be representable as a 32-bit integer(   R(   R   R)   R0   R1   R,   t   _months(   R&   R.   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt
   _setMonths   s    c         C   s   |  j  S(   N(   R-   (   R&   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   <lambda>  s    c         C   s   |  j  S(   N(   R2   (   R&   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR6     s    c         C   s   |  j  S(   N(   R4   (   R&   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR6     s    c         C   s   d |  j  |  j |  j f S(   Ns,   <Interval %s months %s days %s microseconds>(   R%   R$   R#   (   R&   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   __repr__	  s    c         C   sO   | d  k	 oN t | t  oN |  j | j k oN |  j | j k oN |  j | j k S(   N(   t   NoneR(   R"   R%   R$   R#   (   R&   t   other(    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   __eq__  s    $c         C   s   |  j  |  S(   N(   R:   (   R&   R9   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   __neq__  s    (   R   R   R   R'   R/   R3   R5   t   propertyR#   R$   R%   R7   R:   R;   (    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyR"      s   !								(   t
   Connectiont	   localhosti8  c         K   s   t  |  | | | | | |  S(   sT  Creates a connection to a PostgreSQL database.

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_; however, the arguments of the
    function are not defined by the specification.

    :param user:
        The username to connect to the PostgreSQL server with. If this is not
        provided, pg8000 looks first for the PGUSER then the USER environment
        variables.

        If your server character encoding is not ``ascii`` or ``utf8``, then
        you need to provide ``user`` as bytes, eg.
        ``"my_name".encode('EUC-JP')``.

    :keyword host:
        The hostname of the PostgreSQL server to connect with.  Providing this
        parameter is necessary for TCP/IP connections.  One of either ``host``
        or ``unix_sock`` must be provided. The default is ``localhost``.

    :keyword unix_sock:
        The path to the UNIX socket to access the database through, for
        example, ``'/tmp/.s.PGSQL.5432'``.  One of either ``host`` or
        ``unix_sock`` must be provided.

    :keyword port:
        The TCP/IP port of the PostgreSQL server instance.  This parameter
        defaults to ``5432``, the registered common port of PostgreSQL TCP/IP
        servers.

    :keyword database:
        The name of the database instance to connect with.  This parameter is
        optional; if omitted, the PostgreSQL server will assume the database
        name is the same as the username.

        If your server character encoding is not ``ascii`` or ``utf8``, then
        you need to provide ``database`` as bytes, eg.
        ``"my_db".encode('EUC-JP')``.

    :keyword password:
        The user password to connect to the server with.  This parameter is
        optional; if omitted and the database server requests password-based
        authentication, the connection will fail to open.  If this parameter
        is provided but not requested by the server, no error will occur.

    :keyword ssl:
        Use SSL encryption for TCP/IP sockets if ``True``.  Defaults to
        ``False``.

    :rtype:
        A :class:`Connection` object.
    (   R=   (   t   usert   hostt	   unix_sockt   portt   databaset   passwordt   sslt   kwargs(    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   connect  s    7s   2.0i   t   formati  i  iZ  i   c         C   s   t  j |  | |  S(   s   Constuct an object holding a date value.

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.

    :rtype: :class:`datetime.date`
    (   t   datetimet   date(   t   yeart   montht   day(    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   Date  s    c         C   s   t  j |  | |  S(   s   Construct an object holding a time value.

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.

    :rtype: :class:`datetime.time`
    (   RI   t   time(   t   hourt   minutet   second(    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   Time  s    c         C   s   t  j  |  | | | | |  S(   s   Construct an object holding a timestamp value.

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.

    :rtype: :class:`datetime.datetime`
    (   RI   (   RK   RL   RM   RP   RQ   RR   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt	   Timestamp  s    c         C   s   t  t j |   d    S(   s  Construct an object holding a date value from the given ticks value
    (number of seconds since the epoch).

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.

    :rtype: :class:`datetime.date`
    i   (   RN   RO   t	   localtime(   t   ticks(    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   DateFromTicks  s    	c         C   s   t  t j |   d d !  S(   s  Construct an objet holding a time value from the given ticks value
    (number of seconds since the epoch).

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.

    :rtype: :class:`datetime.time`
    i   i   (   RS   RO   RU   (   RV   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   TimeFromTicks  s    	c         C   s   t  t j |   d    S(   s  Construct an object holding a timestamp value from the given ticks value
    (number of seconds since the epoch).

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.

    :rtype: :class:`datetime.datetime`
    i   (   RT   RO   RU   (   RV   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   TimestampFromTicks  s    	c         C   s   t  r t |   S|  Sd S(   s   Construct an object holding binary data.

    This function is part of the `DBAPI 2.0 specification
    <http://www.python.org/dev/peps/pep-0249/>`_.

    :rtype: :class:`pg8000.types.Bytea` for Python 2, otherwise :class:`bytes`
    N(   R   R!   (   R.   (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   Binary  s    
(   t   utct   Cursor(   t   get_versionst   version(   R    R   R   R   R   R   R   R   R   R	   s   cis   bhR   i   i i   l        l     l        l            l         l            (;   t
   __author__t   fmtRI   RO   t   sixR   R   R   t   min_int2t   max_int2R0   R1   R*   R+   t	   ExceptionR   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   t   objectR"   t   coreR=   R8   t   FalseRG   t   apilevelt   threadsafetyt
   paramstylet   STRINGt   BINARYt   bytest   NUMBERt   DATETIMEt   ROWIDRN   RS   RT   RW   RX   RY   RZ   R[   R\   t   __all__t   _versionR]   t   __version__(    (    (    sG   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/__init__.pyt   <module>   st    





S8											