ó
!Xc           @   s   d    Z  d S(   c         c   s  |  j    } d Vd } | j |  } xt | j    D]\ } } } | d k r\ d Vn7 | d k rp d Vn# | j d  r q9 n d j |  V| j d	 d
  } | j d j |   } g  | j   D] }	 t |	 d  ^ qĘ }
 d j | d j d   |
 D   } | j |  } x  | D] } d j | d  Vq!Wq9 Wd } | j |  } x+ | j   D] \ } } } d j |  VqcWd Vd S(   s/  
    Returns an iterator to the dump of the database in an SQL text format.

    Used to produce an SQL dump of the database.  Useful to save an in-memory
    database for later restoration.  This function should not be called
    directly but instead called from the Connection method, iterdump().
    s   BEGIN TRANSACTION;s   
        SELECT "name", "type", "sql"
        FROM "sqlite_master"
            WHERE "sql" NOT NULL AND
            "type" == 'table'
        t   sqlite_sequences   DELETE FROM "sqlite_sequence";t   sqlite_stat1s   ANALYZE "sqlite_master";t   sqlite_s   {0};t   "s   ""s   PRAGMA table_info("{0}")i   s2   SELECT 'INSERT INTO "{0}" VALUES({1})' FROM "{0}";t   ,c         s   s*   |  ]  } d  j  | j d d   Vq d S(   s   '||quote("{0}")||'R   s   ""N(   t   formatt   replace(   t   .0t   col(    (    s"   /usr/lib/python2.7/sqlite3/dump.pys	   <genexpr>5   s    i    sŁ   
        SELECT "name", "type", "sql"
        FROM "sqlite_master"
            WHERE "sql" NOT NULL AND
            "type" IN ('index', 'trigger', 'view')
        s   COMMIT;N(	   t   cursort   executet   sortedt   fetchallt
   startswithR   R   t   strt   join(   t
   connectiont   cut   qt
   schema_rest
   table_namet   typet   sqlt   table_name_identt   rest
   table_infot   column_namest	   query_rest   rowt   name(    (    s"   /usr/lib/python2.7/sqlite3/dump.pyt	   _iterdump
   s4    	"	)N(   R   (    (    (    s"   /usr/lib/python2.7/sqlite3/dump.pyt   <module>
   s    