B
    ^ Çc	  ã               @   s   d d„ Z dS )c             c   s  |   ¡ }dV  d}| |¡}xÂ| ¡ D ]¶\}}}|dkr@dV  n*|dkrPdV  n| d¡r^q&nd |¡V  | d	d
¡}| d |¡¡}dd„ | ¡ D ƒ}	d |d dd„ |	D ƒ¡¡}| |¡}
x|
D ]}d |d ¡V  qÄW q&W d}| |¡}x"| ¡ D ]\}}}d |¡V  qøW dV  dS )a/  
    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().
    zBEGIN TRANSACTION;zª
        SELECT "name", "type", "sql"
        FROM "sqlite_master"
            WHERE "sql" NOT NULL AND
            "type" == 'table'
            ORDER BY "name"
        Zsqlite_sequencezDELETE FROM "sqlite_sequence";Zsqlite_stat1zANALYZE "sqlite_master";Zsqlite_z{0};ú"z""zPRAGMA table_info("{0}")c             S   s   g | ]}t |d  ƒ‘qS )é   )Ústr)Ú.0Z
table_info© r   úlib/python3.7/sqlite3/dump.pyú
<listcomp>3   s    z_iterdump.<locals>.<listcomp>z2SELECT 'INSERT INTO "{0}" VALUES({1})' FROM "{0}";ú,c             s   s    | ]}d   | dd¡¡V  qdS )z'||quote("{0}")||'r   z""N)ÚformatÚreplace)r   Úcolr   r   r   ú	<genexpr>6   s    z_iterdump.<locals>.<genexpr>é    z£
        SELECT "name", "type", "sql"
        FROM "sqlite_master"
            WHERE "sql" NOT NULL AND
            "type" IN ('index', 'trigger', 'view')
        zCOMMIT;N)ZcursorZexecuteZfetchallÚ
startswithr	   r
   Újoin)Z
connectionZcuÚqZ
schema_resZ
table_nameÚtypeZsqlZtable_name_identZresZcolumn_namesZ	query_resÚrowÚnamer   r   r   Ú	_iterdump
   s4    		

	


r   N)r   r   r   r   r   Ú<module>
   ó    