ó
VèZc           @   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    