AlkantarClanX12
Current Path : /opt/alt/python37/lib64/python3.7/sqlite3/__pycache__/ |
Current File : //opt/alt/python37/lib64/python3.7/sqlite3/__pycache__/dump.cpython-37.pyc |
B � f � @ s d d� Z dS )c c s | � � }dV d}|�|�}x�|�� D ]�\}}}|dkr@dV n*|dkrPdV n|�d�r^q&nd�|�V |�d d �}|�d�|��}dd � |�� D �} d�|d�dd� | D ���}|�|�} x| D ]}d�|d �V q�W q&W d}|�|�}x"|�� D ]\}}}d�|�V q�W dV dS )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(). zBEGIN TRANSACTION;z� SELECT "name", "type", "sql" FROM "sqlite_master" WHERE "sql" NOT NULL AND "type" == 'table' ORDER BY "name" Zsqlite_sequencezDELETE FROM "sqlite_sequence";Zsqlite_stat1zANALYZE "sqlite_master";Zsqlite_z{0};�"z""zPRAGMA table_info("{0}")c S s g | ]}t |d ��qS )� )�str)�.0Z table_info� r �1/opt/alt/python37/lib64/python3.7/sqlite3/dump.py� <listcomp>3 s z_iterdump.<locals>.<listcomp>z2SELECT 'INSERT INTO "{0}" VALUES({1})' FROM "{0}";�,c s s | ]}d � |�dd��V qdS )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') zCOMMIT;N)ZcursorZexecuteZfetchall� startswithr r �join) Z connectionZcu�qZ schema_resZ table_name�typeZsqlZtable_name_identZresZcolumn_namesZ query_res�row�namer r r � _iterdump s4 r N)r r r r r �<module> �