ó
è¾bc           @   s   d  „  Z  d S(   c         c   sx  |  j  ƒ  } d Vd } | j | ƒ } x| j ƒ  D]ú \ } } } | d k rV d Vn2 | d k rj d Vn | j d ƒ r q3 n	 d | V| j d	 d
 ƒ } | j d j | ƒ ƒ } g  | j ƒ  D] }	 t |	 d ƒ ^ q¿ }
 d j | d j d „  |
 Dƒ ƒ ƒ } | j | ƒ } x | D] } d | d VqWq3 Wd } | j | ƒ } x& | j ƒ  D] \ } } } d | VqS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'
            ORDER BY "name"
        t   sqlite_sequences   DELETE FROM "sqlite_sequence";t   sqlite_stat1s   ANALYZE "sqlite_master";t   sqlite_s   %s;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>6   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   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>
   t    