
s/Uc           @   s  d  Z  d d l Z d d l m Z d d l m Z m Z m Z m Z m Z m	 Z	 m
 Z
 m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) m* Z* m+ Z+ m, Z, m- Z- d d l. m/ Z/ d d l0 Z0 d d l1 Z1 d d l2 m3 Z3 d d l4 m5 Z5 d d	 l6 m7 Z7 d d
 l8 m9 Z9 m: Z: d d l; m< Z< m= Z= d d l> m? Z? d d l@ mA ZA mB ZB mC ZC mD ZD mE ZE mF ZF mG ZG d d lH mI ZI d d lJ mK ZK d d lL mM ZM d d lN mO ZO d d lP ZP d d lQ mR ZR y d d lS mT ZT Wn eU k
 rsn Xe d  ZV d e jW f d     YZX eX   ZY eE reZ Z[ n  d Z\ d Z] eA d  Z^ eA d  eA d  f Z_ d   Z` e j d d d  Za ea jb d eY  Zc eO ea jd    Ze e j jf Zf d d d Zg d eg d Zh d   Zi d    Zj d!   Zk d"   Zl d#   Zm d$   Zn e j jo jb d eY  Zp e j jq jb d eY  Zr d%   Zs d&   Zt d'   Zu d(   Zv d)   Zw d*   Zx d+   Zy d,   Zz d-   Z{ d.   Z| d/   Z} d0   Z~ eB r/d1   Z n	 d2   Z d3   Z d4   Z eA d5  Z eA d6  Z d7   Z e" d  Z eA d6  Z d8   Z d9   Z d: f  d;     YZ eB re j e _D n  eA d<  Z eA d=  Z eA d>  Z eA d?  Z eA d@  Z eA dA  Z eA dB  Z eA dC  Z eA dD  Z eA dE  Z eA dF  Z eA dG  Z eA dH  Z eA dI  Z eA dJ  Z eA dK  Z eA dL  Z eA dM  Z eA dN  Z eA dO  Z eA dP  Z eA dQ  Z eA dB  Z eA dO  Z eA d>  Z eA dR  Z eA dC  Z eA dS  Z eA dD  Z e e" dT  Z e e" dT  Z e e" dT  Z e e" dT  Z eA d>  Z eA dQ  Z eA d>  Z eA dD  Z eA dU  Z eA dC  Z eA dO  Z eA dQ  Z eA dR  Z eA dV  Z eA dW  Z eA dX  Z eA dY  Z eA d=  Z eA dZ  Z eA dA  Z eA dB  Z d[   Z e e e? e eG d\   eZ eG d]   e g d^   Z d_ e f d`     YZ da e f db     YZ i dc dd 6de df 6dg dh 6di dj 6Z i e dk 6e dl 6dm dn 6do dp 6dq dr 6ds dt 6du dv 6dw dx 6dy dz 6d{ d| 6d} d~ 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z d   Z d   Z d   Z d   Z d   Z d   Z d S(   s   Mathieu FenniakiN(   t	   timedeltai   (*   t   Intervalt   min_int2t   max_int2t   min_int4t   max_int4t   min_int8t   max_int8t   Byteat   NotSupportedErrort   ProgrammingErrort   InternalErrort   IntegrityErrort   OperationalErrort   DatabaseErrort   InterfaceErrort   Errort   ArrayContentNotHomogenousErrort   ArrayContentEmptyErrort!   ArrayDimensionsNotConsistentErrort   ArrayContentNotSupportedErrort   Warningt   i_unpackt	   ii_unpackt
   iii_unpackt   h_packt   d_unpackt   q_unpackt   d_packt   f_unpackt   q_packt   i_packt   h_unpackt
   dii_unpackt
   qii_unpackt	   ci_unpackt	   bh_unpackt   ihihih_unpackt   cccc_unpackt   ii_packt   iii_packt   dii_packt   qii_pack(   t   warn(   t   pack(   t   md5(   t   Decimal(   t   dequet   defaultdict(   t   countt   islice(   t   map(   t   bt   PY2t   integer_typest   nextt   PRE_26t	   text_typet   u(   t   exc_info(   t   UUID(   t   deepcopy(   t   timegm(   t   LooseVersion(   t   loadsi    t   UTCc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   t  S(   N(   t   ZERO(   t   selft   dt(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   utcoffsetF   s    c         C   s   d S(   NRA   (    (   RC   RD   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   tznameI   s    c         C   s   t  S(   N(   RB   (   RC   RD   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   dstL   s    (   t   __name__t
   __module__RE   RF   RG   (    (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRA   D   s   		t    t   ALTERt   CREATEc      
      sG  d } d } d } d } d } t  } t  } g    g  }	 t d   t d   }
 | } d  } xt |  D]\ } } | d t |  k  r | | d } n d  } | | k rY| d k r |	 j |  | d k r | } qV| } q| d	 k r|	 j |  | } q|  d
 k r3| d k r3|	 j t |
   q|  d k r[| d k r[|	 j d  q|  d k r| d k r| }   j d  q|  d k r| d k r| d k r| }   j d  q|  d! k rI| d k rId }  | rt  } |	 j |  qV| d k rt } qV| d k r:| } |	 j t |
   qVt	 d   q|	 j |  n| | k r| d k r|	 j |  | rt  } q| d k rt } q| } q|  d" k r| d k r| rt  } |	 j |  q| d k rt } qt	 d | d   q|	 j |  n| | k r| d	 k rI| } |	 j |  q|  d# k r| d k r| r}t  } |	 j |  q| d k rt } qt	 d | d   q|	 j |  nJ| | k rc| d k r| d k r|	 j |  | } q|  d$ k rS| d k rS| r't  } |	 j |  q`| d k r<t } q`t	 d | d   q|	 j |  n| | k r|  d k r,  d c | 7<| d  k s| j
   r | d k r | } y?   j   d d d  } |	 j d t | d     d =Wq)t k
 r%|	 j d t t      q)Xq q|  d k r| d k r| d k r| } y?   j   d d d  } |	 j d t | d     d =Wqt k
 r|	 j d t t      qXq | d k rq   d c | 7<q|  d k r| } qn  | } qg W|  d% k r%d   } n   f d    } d j |	  | f S(&   Ni    i   i   i   i   c         S   s   d t  |   S(   Nt   $(   t   str(   t   x(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   <lambda>o   s    t   't   Et   "t   qmarkt   ?t   numerict   :RM   t   namedt    t   pyformatt   %t   (t   formatt   ss*   Only %s and %% are supported in the query.s   '%s:   ' not supported in a quoted string within the query strings   \s;   ' not supported in a quoted string within the query string.it   _t   )s   ()c         S   s   |  S(   N(    (   t   vals(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   make_args   s    c            s   t    f d    D  S(   Nc         3   s   |  ] }   | Vq d  S(   N(    (   t   .0t   p(   Ra   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pys	   <genexpr>   s    (   t   tuple(   Ra   (   t   placeholders(   Ra   sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRb      s    (   s   formatRZ   (   RZ   s   format(   RZ   s   format(   RZ   s   format(   s   numerics   qmarks   format(   t   FalseR3   R1   t   Nonet	   enumeratet   lent   appendR7   t   TrueR   t   isalnumt   indexRN   t
   ValueErrort   join(   t   stylet   queryt   OUTSIDEt	   INSIDE_SQt	   INSIDE_QIt	   INSIDE_ESt	   INSIDE_PNt   in_quote_escapet   in_param_escapet   output_queryt	   param_idxt   statet   prev_ct   it   ct   next_ct   pidxRb   (    (   Rf   sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   convert_paramstyle\   s    				$								%'$
i  t   tzinfoi   i?   c         C   sy   t  |  |  d } y t t d |  SWnJ t k
 rt | t k rN t j j S| t k rd t j j St	   d  n Xd  S(   Ni    t   microsecondsi   (
   R   t   EPOCHR    t   OverflowErrort   INFINITY_MICROSECONDSt   datetimet   maxt   MINUS_INFINITY_MICROSECONDSt   minR;   (   t   datat   offsett   lengtht   micros(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamp_recv_integer  s    

c         C   s   t  t t |  |  d  S(   Ni    (   t   utcfromtimestampt   EPOCH_SECONDSR   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamp_recv_float  s    c         C   sg   |  t  j  j k r t } nB |  t  j  j k r6 t } n' t t |  j    t d  |  j	 } t
 |  S(   Ng    .A(   R   R   R   R   R   t   intR>   t	   timetupleR   t   microsecondR   (   t   vR   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamp_send_integer!  s    		$c         C   s"   t  t |  j  |  j d t  S(   Ng    .A(   R   R>   R   R   R   (   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamp_send_float-  s    c         C   s   t  |  j t  j d d    S(   NR   (   R   t
   astimezonet   utct   replaceRh   (   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamptz_send_integer1  s    c         C   s   t  |  j t  j d d    S(   NR   (   R   R   R   R   Rh   (   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamptz_send_float7  s    c         C   sm   t  |  |  d } y t t d |  SWn> t k
 rh | t k rH t S| t k rX t St   d  n Xd  S(   Ni    R   i   (	   R   t   EPOCH_TZR    R   R   t   DATETIME_MAX_TZR   t   DATETIME_MIN_TZR;   (   R   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamptz_recv_integerD  s    c         C   s   t  |  | |  j d t  S(   NR   (   R   R   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   timestamptz_recv_floatQ  s    c         C   sr   |  j  } y | t |  j d  7} Wn t k
 r7 n Xy |  j } Wn t k
 r^ d } n Xt | |  j |  S(   Ng    .Ai    (   R   R   t   secondst   AttributeErrort   monthsR*   t   days(   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   interval_send_integerU  s    	
c         C   sp   |  j  d d } y | |  j 7} Wn t k
 r5 n Xy |  j } Wn t k
 r\ d } n Xt | |  j |  S(   Ng     @@i    (   R   R   R   R   R)   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   interval_send_floatd  s    
c         C   s`   t  |  |  \ } } } | d k rL t | d  \ } } t j | | |  St | | |  Sd  S(   Ni    g    .A(   R"   t   divmodR   R    R   (   R   R   R   R   R   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   interval_recv_integers  s
    c         C   sn   t  |  |  \ } } } | d k rL t | d  \ } } t j | | |  St t | d d  | |  Sd  S(   Ni    g    .Ai  (   R!   R   R   R    R   R   (   R   R   R   R   R   R   t   secsR   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   interval_recv_float|  s
    c         C   s   t  |  |  d S(   Ni    (   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   int8_recv  s    c         C   s   t  |  |  d S(   Ni    (   R    (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   int2_recv  s    c         C   s   t  |  |  d S(   Ni    (   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   int4_recv  s    c         C   s   t  |  |  d S(   Ni    (   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   float4_recv  s    c         C   s   t  |  |  d S(   Ni    (   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   float8_recv  s    c         C   s   |  S(   N(    (   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt
   bytea_send  s    c         C   s   t  |  | | | ! S(   N(   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt
   bytea_recv  s    c         C   s   |  | | | !S(   N(    (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    c         C   s   |  j  S(   N(   t   bytes(   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   uuid_send  s    c         C   s   t  d |  | | | ! S(   NR   (   R<   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   uuid_recv  s    s   t    c         C   s   |  r
 t  St S(   N(   t   TRUEt   FALSE(   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   bool_send  s    c         C   s   t  S(   N(   t   NULL(   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   null_send  s    c         C   s   t  |  | | | ! S(   N(   R   (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   int_in  s    t   Cursorc           B   s   e  Z d  Z d   Z e d    Z e d    Z e d    Z d   Z d d d  Z
 d   Z d   Z d d	  Z d
   Z d   Z d   Z d   Z d d  Z d   Z RS(   s<  A cursor object is returned by the :meth:`~Connection.cursor` method of
    a connection. It has the following attributes and methods:

    .. attribute:: arraysize

        This read/write attribute specifies the number of rows to fetch at a
        time with :meth:`fetchmany`.  It defaults to 1.

    .. attribute:: connection

        This read-only attribute contains a reference to the connection object
        (an instance of :class:`Connection`) on which the cursor was
        created.

        This attribute is part of a DBAPI 2.0 extension.  Accessing this
        attribute will generate the following warning: ``DB-API extension
        cursor.connection used``.

    .. attribute:: rowcount

        This read-only attribute contains the number of rows that the last
        ``execute()`` or ``executemany()`` method produced (for query
        statements like ``SELECT``) or affected (for modification statements
        like ``UPDATE``).

        The value is -1 if:

        - No ``execute()`` or ``executemany()`` method has been performed yet
          on the cursor.
        - There was no rowcount associated with the last ``execute()``.
        - At least one of the statements executed as part of an
          ``executemany()`` had no row count associated with it.
        - Using a ``SELECT`` query statement on PostgreSQL server older than
          version 9.
        - Using a ``COPY`` query statement on PostgreSQL server version 8.1 or
          older.

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

    .. attribute:: description

        This read-only attribute is a sequence of 7-item sequences.  Each value
        contains information describing one result column.  The 7 items
        returned for each column are (name, type_code, display_size,
        internal_size, precision, scale, null_ok).  Only the first two values
        are provided by the current implementation.

        This attribute is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
    c         C   sF   | |  _  d |  _ d  |  _ d |  _ t   |  _ d  |  _ t |  _	 d  S(   Ni   i(
   t   _ct	   arraysizeRh   t   pst
   _row_countR/   t   _cached_rowst   portal_nameRg   t   portal_suspended(   RC   t
   connection(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   __init__  s    					c         C   s   t  d d d |  j S(   Ns'   DB-API extension cursor.connection usedt
   stackleveli   (   R+   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR      s    c         C   s   |  j  S(   N(   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   rowcount  s    c         C   s
   |  j    S(   N(   t   _getDescription(   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   	  s    c      	   C   s{   |  j  d  k r d  S|  j  d } t |  d k r6 d  Sg  } x8 | D]0 } | j | d | d d  d  d  d  d  f  qC W| S(   Nt   row_desci    t   namet   type_oid(   R   Rh   Rj   Rk   (   RC   R   t   columnst   col(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    (c         C   s   z yf |  j  j j   | |  _ |  j  j rR |  j  j rR |  j  j |  d d  n  |  j  j |  | |  Wn] t k
 r |  j  d k r t	 d   q |  j  j
 d k r t	 d   q t   d  n XWd |  j  j j   Xd S(   se  Executes a database operation.  Parameters may be provided as a
        sequence, or as a mapping, depending upon the value of
        :data:`pg8000.paramstyle`.

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

        :param operation:
            The SQL statement to execute.

        :param args:
            If :data:`paramstyle` is ``qmark``, ``numeric``, or ``format``,
            this argument should be an array of parameters to bind into the
            statement.  If :data:`paramstyle` is ``named``, the argument should
            be a dict mapping of parameters.  If the :data:`paramstyle` is
            ``pyformat``, the argument value may be either an array or a
            mapping.

        :param stream: This is a pg8000 extension for use with the PostgreSQL
            `COPY
            <http://www.postgresql.org/docs/current/static/sql-copy.html>`_
            command. For a COPY FROM the parameter must be a readable file-like
            object, and for COPY TO it must be writable.

            .. versionadded:: 1.9.11
        s   begin transactions   Cursor closeds   connection is closedi   N(   R   t   _lockt   acquiret   streamt   in_transactiont
   autocommitt   executeRh   R   R   t   _sockR;   t   release(   RC   t	   operationt   argsR   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s     	c         C   s\   g  } x. | D]& } |  j  | |  | j |  j  q Wd | k rI d n	 t |  |  _ d S(   s1  Prepare a database operation, and then execute it against all
        parameter sequences or mappings provided.

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

        :param operation:
            The SQL statement to execute
        :param parameter_sets:
            A sequence of parameters to execute the statement with. The values
            in the sequence should be sequences or mappings of parameters, the
            same as the args argument of the :meth:`execute` method.
        iN(   R   Rk   R   t   sum(   RC   R   t
   param_setst	   rowcountst
   parameters(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   executemanyH  s
    c         C   s_   y t  |   SWnJ t k
 r" d St k
 r> t d   n t k
 rZ t d   n Xd S(   s   Fetch the next row of a query result set.

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

        :returns:
            A row as a sequence of field values, or ``None`` if no more rows
            are available.
        s#   attempting to use unexecuted cursorN(   R7   t   StopIterationRh   t	   TypeErrorR
   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   fetchone]  s    
c         C   sP   y, t  t |  | d k r! |  j n |   SWn t k
 rK t d   n Xd S(   s  Fetches the next set of rows of a query result.

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

        :param size:

            The number of rows to fetch when called.  If not provided, the
            :attr:`arraysize` attribute value is used instead.

        :returns:

            A sequence, each entry of which is a sequence of field values
            making up a row.  If no more rows are available, an empty sequence
            will be returned.
        s#   attempting to use unexecuted cursorN(   Re   R2   Rh   R   R   R
   (   RC   t   num(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   fetchmanyp  s
    )c         C   s2   y t  |   SWn t k
 r- t d   n Xd S(   s$  Fetches all remaining rows of a query result.

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

        :returns:

            A sequence, each entry of which is a sequence of field values
            making up a row.
        s#   attempting to use unexecuted cursorN(   Re   R   R
   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   fetchall  s    c         C   s   d |  _ d S(   s   Closes the cursor.

        This method is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        N(   Rh   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   close  s    c         C   s   |  S(   so   A cursor object is iterable to retrieve the rows from a query.

        This is a DBAPI 2.0 extension.
        (    (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   __iter__  s    c         C   s   d S(   s   This method is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_, however, it is not
        implemented by pg8000.
        N(    (   RC   t   sizes(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   setinputsizes  s    c         C   s   d S(   s   This method is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_, however, it is not
        implemented by pg8000.
        N(    (   RC   t   sizet   column(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   setoutputsize  s    c         C   s*  zy! |  j  j j   |  j j   SWn t k
 r|  j r |  j  j |   |  j  j t	  |  j  j
   |  j  j |   |  j s |  j  j |   q n  y |  j j   SWqt k
 r|  j d  k r t d   qt |  j d  d k r t d   qt    qXn XWd  |  j  j j   Xd  S(   Ns   A query hasn't been issued.R   i    s   no result set(   R   R   R   R   t   popleftt
   IndexErrorR   t   send_EXECUTEt   _writet   SYNC_MSGt   _flusht   handle_messagest   close_portalR   Rh   R
   Rj   R   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   __next__  s*     		N(   RH   RI   t   __doc__R   t   propertyR   R   t   descriptionR   Rh   R   R   R   R   R   R   R   R   R   R   (    (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    3			,						t   Nt   Rt   St   Kt   Zt   TRR   t   Dt   Ct   1t   2t   3R^   t   nt   tt   AR   t   dt   Gt   Ht   Bt   PRd   t   Xi   t   Mt   qt   Wt   Ft   Lt   Ic         C   s   t  d   |  j t  D  S(   Nc         s   s&   |  ] } | d  d !| d f Vq d S(   i    i   N(    (   Rc   R^   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pys	   <genexpr>  s    (   t   dictt   splitt	   NULL_BYTE(   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   data_into_dict  s    s   [] 'us   {}i   t   MulticastDelegatec           B   s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C   s   g  |  _  d  S(   N(   t	   delegates(   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    c         C   s   |  j  |  |  S(   N(   t   add(   RC   t   delegate(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   __iadd__  s    c         C   s   |  j  j |  d  S(   N(   R  Rk   (   RC   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   |  j  j |  |  S(   N(   R  t   remove(   RC   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   __isub__!  s    c         O   s%   x |  j  D] } | | |   q
 Wd  S(   N(   R  (   RC   R   t   kwargsR  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   __call__%  s    (   RH   RI   R   R  R  R  R  (    (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s
   				t
   Connectionc           B   s  e  Z d  Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z	 e d    Z
 e d    Z e d	    Z d
 Z e e  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d    Z% d!   Z& d"   Z' d#   Z( d$   Z) d%   Z* d&   Z+ d'   Z, d(   Z- d)   Z. d*   Z/ d+   Z0 d,   Z1 d-   Z2 d.   Z3 d/   Z4 d0   Z5 e6 d1  Z7 e6 d2  Z8 d3   Z9 RS(4   s2	  A connection object is returned by the :func:`pg8000.connect` function.
    It represents a single physical connection to a PostgreSQL database.

    .. attribute:: Connection.notifies

        A list of server-side notifications received by this database
        connection (via the LISTEN/NOTIFY PostgreSQL commands).  Each list
        element is a two-element tuple containing the PostgreSQL backend PID
        that issued the notify, and the notification name.

        PostgreSQL will only send notifications to a client between
        transactions.  The contents of this property are generally only
        populated after a commit or rollback of the current transaction.

        This list can be modified by a client application to clean out
        notifications as they are handled.  However, inspecting or modifying
        this collection should only be done while holding the
        :attr:`notifies_lock` lock in order to guarantee thread-safety.

        This attribute is not part of the DBAPI standard; it is a pg8000
        extension.

        .. versionadded:: 1.07

    .. attribute:: Connection.notifies_lock

        A :class:`threading.Lock` object that should be held to read or
        modify the contents of the :attr:`notifies` list.

        This attribute is not part of the DBAPI standard; it is a pg8000
        extension.

        .. versionadded:: 1.07

    .. attribute:: Connection.autocommit

        Following the DB-API specification, autocommit is off by default.
        It can be turned on by setting this boolean pg8000-specific autocommit
        property to True.

        .. versionadded:: 1.9

    .. exception:: Connection.Error
                   Connection.Warning
                   Connection.InterfaceError
                   Connection.DatabaseError
                   Connection.InternalError
                   Connection.OperationalError
                   Connection.ProgrammingError
                   Connection.IntegrityError
                   Connection.DataError
                   Connection.NotSupportedError

        All of the standard database exception types are accessible via
        connection instances.

        This is a DBAPI 2.0 extension.  Accessing any of these attributes will
        generate the warning ``DB-API extension connection.DatabaseError
        used``.
    c         C   s   |  j  t  S(   N(   t	   _getErrorR   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   i  s    c         C   s   |  j  t  S(   N(   R!  R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   j  s    c         C   s   |  j  t  S(   N(   R!  R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   k  s    c         C   s   |  j  t  S(   N(   R!  R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   l  s    c         C   s   |  j  t  S(   N(   R!  R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   m  s    c         C   s   |  j  t  S(   N(   R!  R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   n  s    c         C   s   |  j  t  S(   N(   R!  R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   o  s    c         C   s   |  j  t  S(   N(   R!  R
   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   p  s    c         C   s   |  j  t  S(   N(   R!  R	   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   r  s    id   c         C   s   t  d | j d d | S(   Ns#   DB-API extension connection.%s usedR   i   (   R+   RH   (   RC   t   error(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR!  |  s    c   !         s  d  _  t d  t d  t d  t d  t d  t d  t d  f  _ t j    _ | d  k r y t j d	  _	 Wq t
 k
 r y t j d
  _	 Wq t
 k
 r t d   q Xq Xn	 |  _	 t  j	 t  r  j	 j d   _	 n  |  _ t  _ d   _ t d     _ d  _ d  _ y| d  k rv| d  k	 rvt j t j t j   _ nT | d  k	 rt t d  st d   n  t j t j t j   _ n t d   | d  k r| d  k	 r j j | | f  n | d  k	 r j j |  n  | rz y~  j j   d d  l  }  j j! t" d d    j j# d  }	 |	 t d  k r| j$  j   _ n t d   Wn t% k
 rt d   n XWd   j j&   Xn   j j' d d   _( Wn7 t j) k
 r( j j*   t d t+   d   n X j( j,  _-  j( j.  _/ t0 r_ j( j1  _2 n  j( j3  _2 d   _4 t5    _6 t5    _7 t5    _8  j7  j9 7_7  f d   }
  f d   }  f d   }  f d   } t: t; t< t= t> d   t> d      i t? d! 6      f d"   }  f d#   }  f d$   } t@ r f d%    d&   }  f d'   } n'  f d(    d)   }  f d*   }  f d+   }  f d,   }  f d-   }  f d.   } t  f d/   i& tA | f d0 6tA tB f d1 6tA  f d2 6tA tC f d3 6tA tD f d4 6tE | f d5 6tA tF f d6 6tA  f d7 6tE tG f d8 6tE tG f d9 6tE | f d: 6tA tH f d; 6tA tI f d< 6tA  f d= 6tE  f d> 6tA | f d? 6tA | f d@ 6tA | f dA 6tA | f dB 6tA | f dC 6tA | f dD 6tA | f dE 6tA | f dF 6tA | f dG 6tA | f dH 6tA  f dI 6tA  f dJ 6tE | f dK 6tE | f dL 6tA tJ f dM 6tA tK f dN 6tA tL f dO 6tE | f dP 6tA | f dQ 6tE | f dR 6tA  f dS 6tA tM f dT 6tE | f dU 6  _N i d tA tO f tP d   6d0 tA tQ f tR 6d= tE | f tS 6d< tA tT f tU 6d= tE |
 f tV 6dK tE | f tW jX 6dL tE | f tW jY 6dM tA tZ f dM 6dN tA t[ f dN 6dO tA t\ f tW j] 6dO tA t\ f t^ 6dR tE | f t? 6dT tA t_ f t` 6 _a i  jb tW jW 6 jc td 6 jc te 6 _f t@ rLd1 tA tg f  ja th <d= tE |
 f  ja t <d= tE | f  ja ti <n d1 tA tg f  ja tj <y d dV lk ml  mm } mn } mo  mp } mq }  f dW   }    f dX   } dY tE | f  ja | <dY tE | f  ja | <dY tE | f  ja | <dY tE | f  ja | <tE | f  jN dY <Wn t% k
 r6	n Xi  jr ts 6 jt tu 6 j9 tv 6 jw tx 6 jy tz 6 j{ t| 6 j} t~ 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 j t 6 _ dZ } t t |  t d[   j	 t  } | d  k	 r
t | t  rb
| j d  } n  | j t d\  | t  n  | j d   j2 t t |  d]    j2 |   j-    j    _ z y  j j   d  }  _) xR | tz t~ f k rDt  j/ d^   \ } }   j |  j/ |  d]  d   q
W j) d  k	 r` j)  n  Wn  j     n XWd   j j&   Xt  _ g   _ t j    _ d  S(_   Nt   utf8t   INSERTt   DELETEt   UPDATEt   MOVEt   FETCHt   COPYt   SELECTt   PGUSERt   USERsk   The 'user' connection parameter was omitted, and neither the PGUSER or USER environment variables were set.c           S   s
   t  t  S(   N(   R0   R  (    (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP     s    i    t   AF_UNIXs9   attempt to connect to unix socket on unsupported platforms)   one of host or unix_sock must be providedii   i/i   R   s   Server refuses SSLsE   SSL required but ssl module not available in this python installationt   modet   rwbs   communication errorc            s   |  j    j  S(   N(   t   encodet   _client_encoding(   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   text_out  s    c            s   |  j    j   j  S(   N(   t	   isoformatR0  R1  (   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   time_out  s    c            s^   |  t  j j k r" d j   j  S|  t  j j k rD d j   j  S|  j   j   j  Sd  S(   Nt   infinitys	   -infinity(   R   t   dateR   R0  R1  R   R3  (   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   date_out  s
    c            s   t  |   j   j  S(   N(   RN   R0  R1  (   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   unknown_out  s    s   {}s   []R.   c            s   g  } d  } x |  | | | !j  j  j   j t d  t d   D]i } | d k ry | d k ry | j d  n( | d k r | d k r | j d	  n  | j |  | } qK Wt d
 j	 |     S(   NR   Rh   t   [t   ]t   ,R   s	   Decimal('t   es   ')RY   (   R9  R:  R;  R   (   R9  R;  (   R:  R;  (   R9  R:  R;  R<  (
   Rh   t   decodeR1  t	   translateR   R:   t   extendRk   t   evalRp   (   R   t   idxR   t   arrR}   R   (   t   glblsRC   t	   trans_tab(    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   array_in  s    %
c            s9  | | } t  |  |  \ } } } | d 7}   j | d } g  } x8 t |  D]* }	 | j t |  |  d  | d 7} qP Wg  }
 xk | | k  r t |  |  \ } | d 7} | d k r |
 j d   q |
 j | |  | |   | | 7} q Wx@ t | d  D]. } t t	 t t
 t |
  g |     }
 qW|
 S(   Ni   i   i    i   i   i(   R   t   pg_typest   rangeRk   R   R   Rh   t   reversedt   listR3   t   zipt   iter(   R   RA  R   t	   final_idxt   dimt   hasnullt   typeoidt
   conversiont   dim_lengthsR~   t   valuest   element_len(   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt
   array_recv  s&    


,c            s5   t  d |  | | | !j   j  j d d  d  S(   NR9  RJ   R;  R:  (   R@  R=  R1  R   (   R   RA  R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   vector_in<  s    c            s   t  |  | | | !  j  S(   N(   t   unicodeR1  (   R   R   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   text_recvA  s    c         S   s   |  | d k S(   Ns   (    (   R  t   ot   l(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   bool_recvE  s    c            s!   t  t |  | | | !  j   S(   N(   R@   RV  R1  (   R   R   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   json_inH  s    c            s   t  |  | | | !  j  S(   N(   RN   R1  (   R   R   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRW  M  s    c         S   s   |  | d k S(   Ni   (    (   R   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRZ  Q  s    c            s!   t  t |  | | | !  j   S(   N(   R@   RN   R1  (   R   R   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR[  T  s    c            s   t  |  | | d ! } t  |  | d | d ! } t |  | d | | !j   j   } t j | | t  |  t  | t  |  d   S(   Ni   i   i   i   i@B (   R   R.   R=  R1  R   t   time(   R   R   R   t   hourt   minutet   sec(   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   time_inX  s    $c            s   |  | | d !j    j  } | d k r3 t j j S| d k rI t j j St j t |  t |  | d | d ! t |  | d | d !  Sd  S(   Ni   t   infis   -infi   i   i   i
   (   R=  R1  R   R6  R   R   R   (   R   R   R   t   year_str(   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   date_in`  s    

!c            s!   t  |  | | | !j   j   S(   N(   R.   R=  R1  (   R   R   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt
   numeric_ink  s    c            s   t  |   j   j  S(   N(   RN   R0  R1  (   R  (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   numeric_outo  s    c              s
   t    f S(   N(   t   FC_TEXT(    (   RW  (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRP   s  s    i   i   i   i   i   i   i   i   i   i   ir   i  i  i  i=  i  i  i  i  i  i  i  i  i  i  i  i  i:  i;  iZ  i  i  i  i  i  i  i  i  (   t
   ip_addresst   IPv4Addresst   IPv6Addresst
   ip_networkt   IPv4Networkt   IPv6Networkc            s   t  |   j   j  S(   N(   RN   R0  R1  (   R   (   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   inet_out  s    c            sD   |  | | | !j   j  } d | k r6  | t  S  |  Sd  S(   Nt   /(   R=  R1  Rg   (   R   R   R   t   inet_str(   Rg  Rj  RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   inet_in  s
    ie  i   t   user t	   database i   i   (   R1  R4   t   _commands_with_countt	   threadingt   LockR   Rh   t   ost   environt   usert   KeyErrorR   t
   isinstanceR9   R0  t   passwordRg   R   t   _xidR0   t   _cachest   statement_numbert   portal_numbert   sockett   AF_INETt   SOCK_STREAMt   _usockt   hasattrR-  R
   t   connectR   t   sslt   sendallR'   t   recvt   wrap_sockett   ImportErrorR   t   makefileR   R"  R   R;   t   flushR   t   readt   _readR8   t
   writelinesR   t   writet   _backend_key_dataR  t   NoticeReceivedt   ParameterStatusReceivedt   NotificationReceivedt   handle_PARAMETER_STATUSR  RJ  R3   t   ordR:   R.   R5   t	   FC_BINARYR   R   R   Rf  R   R   R   R   R   R   R   R   RF  R   t   typeR   t   boolR   R   t   floatRN   R   R6  R\  R   R   R   R    R   R   R<   t   py_typest   inspect_datetimet   array_inspectRI  Re   t   inspect_funcsR   R   t   longR   t	   ipaddressRg  Rh  Ri  Rj  Rk  Rl  t   handle_NOTICE_RESPONSEt   NOTICE_RESPONSEt   handle_AUTHENTICATION_REQUESTt   AUTHENTICATION_REQUESTt   PARAMETER_STATUSt   handle_BACKEND_KEY_DATAt   BACKEND_KEY_DATAt   handle_READY_FOR_QUERYt   READY_FOR_QUERYt   handle_ROW_DESCRIPTIONt   ROW_DESCRIPTIONt   handle_ERROR_RESPONSEt   ERROR_RESPONSEt   handle_DATA_ROWt   DATA_ROWt   handle_COMMAND_COMPLETEt   COMMAND_COMPLETEt   handle_PARSE_COMPLETEt   PARSE_COMPLETEt   handle_BIND_COMPLETEt   BIND_COMPLETEt   handle_CLOSE_COMPLETEt   CLOSE_COMPLETEt   handle_PORTAL_SUSPENDEDt   PORTAL_SUSPENDEDt   handle_NO_DATAt   NO_DATAt   handle_PARAMETER_DESCRIPTIONt   PARAMETER_DESCRIPTIONt   handle_NOTIFICATION_RESPONSEt   NOTIFICATION_RESPONSEt   handle_COPY_DONEt	   COPY_DONEt   handle_COPY_DATAt	   COPY_DATAt   handle_COPY_IN_RESPONSEt   COPY_IN_RESPONSEt   handle_COPY_OUT_RESPONSEt   COPY_OUT_RESPONSEt   message_typest	   bytearrayR   R  R?  Rk   Rj   t   cursort   _cursorR#   t   _closeR   t   notifiest   notifies_lock(!   RC   Rx  t   hostt	   unix_sockt   portt   databaseR{  R  t	   sslmodulet   respR2  R4  R7  R8  RE  RT  RU  RZ  R[  R`  Rc  Rd  Re  Rh  Ri  Rk  Rl  Rm  Rp  t   protocolt   valt   codet   data_len(    (   RC  Rg  Rj  RC   RW  RD  sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s   	$$							 	* 		
.


















$
 %
		c         C   sS   t  |  } | t d k r. t d  |  _ n! t | t | t | t  |  _ d  S(   Nt   28000s"   md5 password authentication failed(   R  t   RESPONSE_CODER   R"  R
   t   RESPONSE_SEVERITYt   RESPONSE_MSG(   RC   R   R   t   msg_dict(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   d  S(   N(    (   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   d  S(   N(    (   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   d  S(   N(    (   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   t  | _ d  S(   N(   Rl   R   (   RC   R   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  !  s    c         C   s   d  S(   N(    (   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  $  s    c         C   s   t  |  _ d  S(   N(   Rl   t
   _copy_done(   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  ,  s    c         C   s4   t  |  \ } } | j d  k r0 t d   n  d  S(   Ns7   An output stream is required for the COPY OUT response.(   R$   R   Rh   R   (   RC   R   R   t	   is_binaryt   num_cols(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  /  s    c         C   s   | j  j |  d  S(   N(   R   R  (   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  :  s    c         C   sH  t  |  \ } } |  j j   s' t  | j d  k rE t d   n  t r x t r | j j	 d  } | sp Pn  |  j
 t t t |  d   |  j
 |  |  j   qN Wnq t d  } xb t r| j j |  } | d k r Pn  |  j
 t t | d   |  j
 | |   |  j   q W|  j
 t  |  j
 t  |  j   d  S(   Ns5   An input stream is required for the COPY IN response.i    i   i    (   R$   R   t   lockedt   AssertionErrorR   Rh   R   R5   Rl   R  R   R  R   Rj   R   R  t   readintot   COPY_DONE_MSGR   (   RC   R   R   R  R  t   bffrt
   bytes_read(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  =  s0    	!	c         C   s   |  j  |  t |  d } d } | j t |  | } | | | | !j d  } | | d 7} | j t |  | } z' |  j j   |  j j | | f  Wd  |  j j	   Xd  S(   Ni    i   t   asciii   (
   R  R   t   findR  R=  R  R   R  Rk   R   (   RC   R   R   t   backend_pidRA  t   nullt	   condition(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  `  s    c         C   s
   t  |   S(   s   Creates a :class:`Cursor` object bound to this
        connection.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        (   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  x  s    c         C   s<   z' |  j  j   |  j |  j d d  Wd |  j  j   Xd S(   s   Commits the current database transaction.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        t   commitN(   R   R   R   R  Rh   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s<   z' |  j  j   |  j |  j d d  Wd |  j  j   Xd S(   s   Rolls back the current database transaction.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        t   rollbackN(   R   R   R   R  Rh   R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s~   y> |  j  t  |  j   |  j j   |  j j   d  |  _ Wn9 t k
 r] t d   n t	 k
 ry t d   n Xd  S(   Ns   connection is closed(
   R   t   TERMINATE_MSGR   R   R   R  Rh   R   R   Ro   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    
c         C   s0   z |  j  j   |  j   Wd |  j  j   Xd S(   s   Closes the database connection.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        N(   R   R   R  R   (   RC   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    c         C   s  |  j  j   s t  t |  d } | d k r4 nT| d k r |  j d  k r^ t d   n  |  j t |  j j	 d  t
  |  j   n | d k rEt d  j t | d   } |  j d  k r t d   n  t d	  t t |  j j	 d  |  j  j   j	 d  |  j   j	 d  } |  j t | t
  |  j   nC | d k rnt d t |  d   n t d t |  d   d  S(   Ni    i   sG   server requesting password authentication, but no password was providedR  i   RY   i   sK   server requesting MD5 password authentication, but no password was providedR-   i   i   i   i   i	   s   Authentication method s    not supported by pg8000.s    not recognized by pg8000.(   i   i   i   i   i   i	   (   R   R  R  R   R{  Rh   R   t   _send_messaget   PASSWORDR0  R  R   R4   Rp   R&   R-   Rx  t	   hexdigestRN   (   RC   R   R  t	   auth_codet   saltt   pwd(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s8    % c         C   s   | t  k |  _ d  S(   N(   t   IDLER   (   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   | |  _  d  S(   N(   R  (   RC   R   R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s)   | j  d  k r |  j d S|  j d Sd  S(   NiZ  i  (   R   Rh   R  (   RC   t   value(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   g  } x | D] } t  |  } y | j |  j |  Wq t k
 r y | j |  j | |   Wq t k
 r t d t t   d  d   q Xq Xq W| S(   Ns   type i   s   not mapped to pg type(   R  Rk   R  Ry  R  R	   RN   R;   (   RC   RR  t   paramsR  t   typ(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   make_params  s    c      	   C   s   t  |  d } d } x t |  D] } | | | j t |  !} | t |  d 7} t t d t | |    } | | d
 <| d 7} | j d j	 |  |  j
 | d \ | d <| d <q# Wd  S(   Ni    i   i   t	   table_oidt   column_attrnumR   t	   type_sizet   type_modifierR]   R   i   R   t	   pg8000_fct   func(   R  R  s   type_oidR  R  s   format(   R    RG  R  R  Rj   R  RJ  R%   R   Rk   RF  (   RC   R   R  R1   RA  R~   R   t   field(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  	  s     

c            s  | d  k r d } n  d d l m }   j | } y | d | \ } } Wn: t k
 r t | |  \ } } | | f | d | <n X| |  }   j |  }	 t d   |	 D  | f }
 y | d |
 } | | _ WnWt k
 r2d t	   j
  }   j
 d 7_
 | j d  t } i g  d 6t d	   |	 D  d
 6} | | _ t d   |	 D  } t |  } | j | j   j  t  | j t t |	    x< |	 D]4 \ } } } | j t | d k rd n |   qW  j t |    j t t |    j t  y   j   Wn< t k
 r_  j d  k rOt d   q`t   d  n X  j |  t   f d   | d D  } t d   | d D  | d <| t t |	   t d d t |  |  t t |	   | d <t t |   t d d t |  |  | d <| | d |
 <n X| j  j!   d | _" d t	   j#  | _$   j# d 7_# | j$ j d  t | _% | j% t& j' | _( t | j% | d  } xh t) | | d
  D]S \ } } | d  k rt* } n% | |  } | j t t |    | j |  qW| j | d    j t+ |    j, |    j t    j     j |  | j- r  j. rt d   qn   j/ |  d  S(   Ni   (   t
   paramstylet	   statementc         s   s   |  ] \ } } } | Vq d  S(   N(    (   Rc   t   oidRO   t   y(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pys	   <genexpr>(  s    R   t   pg8000_statement_R  R   c         s   s   |  ] } | d  Vq d S(   i   N(    (   Rc   RO   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pys	   <genexpr>3  s    t   param_funcsc         s   s   |  ] } | d  Vq d S(   i   N(    (   Rc   RO   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pys	   <genexpr>7  s    ii  s   connection is closedc         3   s$   |  ] }   j  | d  d Vq d S(   R   i    N(   RF  (   Rc   t   f(   RC   (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pys	   <genexpr>_  s    c         s   s   |  ] } | d  Vq d S(   R  N(    (   Rc   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pys	   <genexpr>a  s    t   input_funcst   !t   ht   bind_1t   bind_2t   pg8000_portal_s   With autocommit on, it's not possible to retrieve more rows than the pg8000 cache size, as the portal is closed when the transaction is closed.(    (0   Rh   RY   R  R}  Ry  R   R  Re   R   RN   R~  R0  R  R  R?  R1  R   Rj   R   R  t   PARSEt   DESCRIBEt	   STATEMENTR   R   R   R   R   R   R;   R   R,   R   t   clearR   R  R   t   portal_name_binR   t   _row_cache_size_bint   execute_msgRJ  R   t   BINDR   R   R   R   (   RC   R  R   Ra   R  t   cacheR  Rb   R   R  t   keyR   t   statement_namet   statement_name_bint	   param_fcsR  R  t   fct	   send_funct	   output_fct   retvalR  (    (   RC   sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    		
)."	 	
		c         C   s   yH |  j  |  |  j  t t |  d   |  j  |  |  j  t  Wnb t k
 r t t   d  d k r t d   q t   d  n t k
 r t d   n Xd  S(   Ni   i   s   write to closed files   connection is closed(	   R   R   Rj   t	   FLUSH_MSGRo   RN   R;   R   R   (   RC   R  R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s    t  | _ |  j t | j  d  S(   N(   Rg   R   R  t   EXECUTER  (   RC   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    	c         C   s   d  S(   N(    (   RC   t   msgR   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s   | d  j  t  } | d } | |  j k ri t | d  } | j d k rW | | _ qi | j | 7_ n  | t k r x) |  j D] } |  j | d j   q Wn  d  S(   Nii    R   (   R  t   BINARY_SPACERs  R   R   t   DDL_COMMANDSR}  R  (   RC   R   R  RR  t   commandt	   row_countt   k(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    
c         C   s   d } g  } xq | j  d D]b } t | |  d } | d 7} | d k rY | j d   q | j | | | |   | | 7} q W| j j |  d  S(   Ni   R  i    i   i(   R   R   Rk   Rh   R   (   RC   R   R  t   data_idxt   rowR  t   vlen(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    
c         C   s   d  } |  _ yS xL | t k r^ t |  j d   \ } } |  j | |  j | d  |  q WWn |  j     n X|  j d  k	 r |  j  n  d  S(   Ni   i   (   Rh   R"  R  R#   R  R  R  (   RC   R  R  R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    )
c         C   s?   |  j  t t | j  |  j t  |  j   |  j |  d  S(   N(   R  t   CLOSEt   PORTALR  R   R   R   R   (   RC   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR     s    
c         C   s   t  |  } |  j |  d  S(   N(   R  R  (   RC   R   R   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s    c         C   s  | j  t  } | |  | | d d !} } | t d  k rj | j d  j   } t j | |  |  _ n$| t d  k r| t d  k r%d t t	 f |  j
 d <t t f |  j d <d t t f |  j
 d <t t f |  j d <d	 t t f |  j
 t <d	 t t f |  j
 t j <t t f |  j d	 <qd t t f |  j
 d <t t f |  j d <d t t f |  j
 d <t t f |  j d <d	 t t f |  j
 t <d	 t t f |  j
 t j <t t f |  j d	 <n | t d
  k rt | j d   |  _ |  j t d  k  r4t d  t d  t d  t d  t d  f |  _ q|  j t d  k  rt d  t d  t d  t d  t d  t d  f |  _ qn  d  S(   Ni   it   client_encodingR  t   integer_datetimest   oniZ  i  i  t   server_versions   8.2.0R$  R%  R&  R'  R(  s   9.0.0R)  (   R  R  R4   R=  t   lowert   pg_to_py_encodingst   getR1  R  R   R  R   RF  R   R   R   R   R   R    R   R   R   R   R   R   R   R?   t   _server_versionRs  (   RC   R   R   t   posR  R  t   encoding(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR    s:    $$c   
         sX  t  |  } | d  k r' t d   n  t |   t  t  rut  t t t } } } x t |  D] } | d  k r qi n  t | k  o t	 k  n r qi n  t
 } t | k  o t k  n r qi n  t
 } t | k  o t k  n r qi n  t
 } qi W| r d } d t t   }  q| rCd } d t t   }  q| rfd } d t t   }  qt d   n yH |  j | f  d	 \   }    d
 k rd   t } n  t   } WnU t k
 rt d t    d   n+ t k
 rt d t   d   n X| t k r9    f d   }	 n   f d   }	 | | |	 f S(   Ns   array has no valuesi  i   i  i   i  i   s'   numeric not supported as array contentsi    i  i   s   oid s     not supported as array contentss   type c            s!  xQ t  |   D]C \ } } } t |  t d   f  s t d t     q q Wt |   t |   } t |   } t	 t
 t |  |     } x$ | D] } | j t | d   q Wx_ t |   D]Q } | d  k r | t d  7} q  |  } | t t |   7} | | 7} q W| S(   Ns#   not all array elements are of type i   i(   t
   walk_arrayRz  R  Rh   R   RN   t   array_check_dimensionst   array_has_nullt   array_dim_lengthsR  R(   Rj   R?  R'   t   array_flattenR   (   RB  t   aR~   R   t   has_nullRQ  R   t
   inner_data(   R  R  R  (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt
   send_arrayd  s"    
c            s   xQ t  |   D]C \ } } } t |  t d   f  s t d t     q q Wt |   t |   } xO t  |  D]A \ } } } | d  k r d | | <qw   |  j d  | | <qw Wt	 t |   j
 t  j d  S(   Ns#   not all array elements are of type R   R  (   R6  Rz  R  Rh   R   RN   R7  R=   R=  R:   R>  t	   arr_transR0  (   RB  R;  R~   R   t   ar(   R  R  (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR>  |  s    
(   t   array_find_first_elementRh   R   R  t
   issubclassR6   Rl   R:  R   R   Rg   R   R   R   R   R  R   R   R   R   R  t   pg_array_typesRy  RN   R	   (
   RC   R  t   first_elementt   int2_okt   int4_okt   int8_okR   t	   array_oidR  R>  (    (   R  R  R  sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR  +  s\    
	c         C   s   | | | f S(   s)  Create a Transaction IDs (only global_transaction_id is used in pg)
        format_id and branch_qualifier are not used in postgres
        global_transaction_id may be any string identifier supported by
        postgres returns a tuple
        (format_id, global_transaction_id, branch_qualifier)(    (   RC   t	   format_idt   global_transaction_idt   branch_qualifier(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   xid  s    c         C   s/   | |  _  |  j r+ |  j |  j d d  n  d S(   s.  Begins a TPC transaction with the given transaction ID xid.

        This method should be called outside of a transaction (i.e. nothing may
        have executed since the last .commit() or .rollback()).

        Furthermore, it is an error to call .commit() or .rollback() within the
        TPC transaction. A ProgrammingError is raised, if the application calls
        .commit() or .rollback() during an active TPC transaction.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        s   begin transactionN(   R|  R   R   R  Rh   (   RC   RL  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt	   tpc_begin  s    		c         C   s.   d |  j  d f } |  j |  j | d  d S(   s  Performs the first phase of a transaction started with .tpc_begin().
        A ProgrammingError is be raised if this method is called outside of a
        TPC transaction.

        After calling .tpc_prepare(), no statements can be executed until
        .tpc_commit() or .tpc_rollback() have been called.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        s   PREPARE TRANSACTION '%s';i   N(   R|  R   R  Rh   (   RC   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   tpc_prepare  s    c         C   s   | d k r |  j } n  | d k r3 t d   n  zV |  j } t |  _ | |  j   k r~ |  j |  j d | d f d  n
 |  j   Wd | |  _ Xd |  _ d S(   s%  When called with no arguments, .tpc_commit() commits a TPC
        transaction previously prepared with .tpc_prepare().

        If .tpc_commit() is called prior to .tpc_prepare(), a single phase
        commit is performed. A transaction manager may choose to do this if
        only a single resource is participating in the global transaction.

        When called with a transaction ID xid, the database commits the given
        transaction. If an invalid transaction ID is provided, a
        ProgrammingError will be raised. This form should be called outside of
        a transaction, and is intended for use in recovery.

        On return, the TPC transaction is ended.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        s.   Cannot tpc_commit() without a TPC transaction!s   COMMIT PREPARED '%s';i   N(	   Rh   R|  R
   R   Rl   t   tpc_recoverR   R  R  (   RC   RL  t   previous_autocommit_mode(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt
   tpc_commit  s    		

c         C   s   | d k r |  j } n  | d k r3 t d   n  zV |  j } t |  _ | |  j   k r~ |  j |  j d | d f d  n
 |  j   Wd | |  _ Xd |  _ d S(   sD  When called with no arguments, .tpc_rollback() rolls back a TPC
        transaction. It may be called before or after .tpc_prepare().

        When called with a transaction ID xid, it rolls back the given
        transaction. If an invalid transaction ID is provided, a
        ProgrammingError is raised. This form should be called outside of a
        transaction, and is intended for use in recovery.

        On return, the TPC transaction is ended.

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        s9   Cannot tpc_rollback() without a TPC prepared transaction!s   ROLLBACK PREPARED '%s';i   N(	   Rh   R|  R
   R   Rl   RO  R   R  R  (   RC   RL  RP  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   tpc_rollback  s    		

c         C   sj   zY |  j  } t |  _  |  j   } | j d  g  | D] } |  j d | d d  ^ q5 SWd | |  _  Xd S(   s   Returns a list of pending transaction IDs suitable for use with
        .tpc_commit(xid) or .tpc_rollback(xid).

        This function is part of the `DBAPI 2.0 specification
        <http://www.python.org/dev/peps/pep-0249/>`_.
        s!   select gid FROM pg_prepared_xactsi    RY   N(   R   Rl   R  R   RL  (   RC   RP  t   cursR(  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRO    s    		.(:   RH   RI   R   R   R   R   R   R   R   R   R   R
   R	   t   _row_cache_sizeR   R  R!  R   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R   R  R  R  R  R  R  R   R  R   R  R  R  R   R   R  R  R  RL  RM  RN  Rh   RQ  RR  RO  (    (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR   *  sn   <		 											#								:								
							-	a			'$i  i   i  i   i  i  i  i  t   mule_internalt   euc_twt   gb2312t   euc_cnt   is8859_5t
   iso_8859_5t   is8859_6t
   iso_8859_6t   is8859_7t
   iso_8859_7t   is8859_8t
   iso_8859_8t   koi8_rt   koi8s	   iso8859-1t   latin1t	   iso8859_2t   latin2t	   iso8859_3t   latin3t	   iso8859_4t   latin4t	   iso8859_9t   latin5t
   iso8859_10t   latin6t
   iso8859_13t   latin7t
   iso8859_14t   latin8t
   iso8859_15t   latin9R  t	   sql_asciit   cp886t   win866t   cp874t   win874t   cp1250t   win1250t   cp1251t   win1251t   cp1252t   win1252t   cp1253t   win1253t   cp1254t   win1254t   cp1255t   win1255t   cp1256t   win1256t   cp1257t   win1257t   cp1258t   win1258s   utf-8RV  c         c   so   xh t  |   D]Z \ } } t | t  rY x< t |  D] \ } } } | | | f Vq5 Wq |  | | f Vq Wd  S(   N(   Ri   Rz  RI  R6  (   RB  R~   R   R;  t   i2t   v2(    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR6  O  s
    c         C   s+   x$ t  |   D] } | d  k	 r | Sq Wd  S(   N(   R:  Rh   (   RB  R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyRA  X  s    c         c   sH   xA |  D]9 } t  | t  r; x! t |  D] } | Vq) Wq | Vq Wd  S(   N(   Rz  RI  R:  (   RB  R   R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR:  _  s
    c         C   s   |  d } t  | t  r t |  } t |  } xG |  D]? } t |  } t |  | k sh | | k r8 t d   q8 q8 W| g } | j |  | Sx, |  D]$ } t  | t  r t d   q q Wg  Sd  S(   Ni    s   array dimensions not consistent(   Rz  RI  Rj   R7  R   R?  (   RB  t   v0t   req_lent   req_inner_lengthsR   t   inner_lengthsR  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR7  h  s"    
	c         C   s+   x$ t  |   D] } | d  k r t Sq Wt S(   N(   R:  Rh   Rl   Rg   (   RB  R   (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR8  ~  s    c         C   sO   |  d } t  | t  r> t |  g } | j t |   n t |   g S| S(   Ni    (   Rz  RI  Rj   R?  R9  (   RB  R  R  (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyR9    s    
(   t
   __author__R   R    RY   R   R   R   R   R   R   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   R"   R#   R$   R%   R&   R'   R(   R)   R*   t   warningsR+   R  Rt  t   structR,   t   hashlibR-   t   decimalR.   t   collectionsR/   R0   t	   itertoolsR1   R2   t	   six.movesR3   t   sixR4   R5   R6   R7   R8   R9   R:   t   sysR;   t   uuidR<   t   copyR=   t   calendarR>   Rv  t   distutils.versionR?   t   jsonR@   R  RB   R   RA   R   RI  R  Rf  R  R"  R#  R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R   R   R   R   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R   t   FLUSHt   SYNCR  R  t	   TERMINATER*  R  R   R  R  R  R+  R  R  R  t   RESPONSE_DETAILt   RESPONSE_HINTt   RESPONSE_POSITIONt   RESPONSE__POSITIONt   RESPONSE__QUERYt   RESPONSE_WHEREt   RESPONSE_FILEt   RESPONSE_LINEt   RESPONSE_ROUTINER  t   IDLE_IN_TRANSACTIONt   IDLE_IN_FAILED_TRANSACTIONR  R  RJ  R  Rh   R?  t   objectR  R   RC  R1  R6  RA  R:  R7  R8  R9  (    (    (    sC   /var/www/c4bv.valis/web2py-ge-R-2.10.3/gluon/contrib/pg8000/core.pyt   <module>   s`   
4																													 	;    

							