ó
    F\hu  ã                   óš   • S r SSKrSSKrSSKJr  SSKJr  SSKJr  SS jr	 " S S\5      r
S	 r\S
:X  a  \" \R                  SS 5        gg)zÞA simple SQLite CLI for the sqlite3 module.

Apart from using 'argparse' for the command-line interface,
this module implements the REPL as a thin wrapper around
the InteractiveConsole class from the 'code' stdlib module.
é    N)ÚArgumentParser)ÚInteractiveConsole)Údedentc                 ó®  •  U R                  U5       H  n[        U5        M     g! [        R                   aš  n[	        U5      R
                  n [        U SUR                   SU 3[        R                  S9  O-! [         a     [        U SU 3[        R                  S9   Of = fU(       d  [        R                  " S5         SnAg SnAgSnAff = f)z¸Helper that wraps execution of SQL code.

This is used both by the REPL and by direct execution from the CLI.

'c' may be a cursor or a connection.
'sql' is the SQL string to execute.
z (z): )Úfilez: é   N)ÚexecuteÚprintÚsqlite3ÚErrorÚtypeÚ__name__Úsqlite_errornameÚsysÚstderrÚAttributeErrorÚexit)ÚcÚsqlÚsuppress_errorsÚrowÚeÚtps         Ú'/usr/lib/python3.13/sqlite3/__main__.pyr	   r	      sª   € ð
Ø—9‘9˜S–>ˆCÜ�#ŽJò "øä�=‰=ó Ü�!‹W×Ñˆð	1Ü�R�D˜˜1×-Ñ-Ð.¨c°!°Ð5¼C¿J¹JÓGøÜó 	1Ü�R�D˜˜1˜#�,¤S§Z¡ZÔ0ð	1úæÜ�HŠH�Q�K‰Kô ûðús8   ‚#& ¦CºCÁ*A;Á:CÁ;'B%Â"CÂ$B%Â% CÃCc                   ó6   ^ • \ rS rSrSrU 4S jrSS jrSrU =r$ )ÚSqliteInteractiveConsoleé%   zA simple SQLite REPL.c                 óX   >• [         TU ]  5         Xl        UR                  5       U l        g )N)ÚsuperÚ__init__Ú_conÚcursorÚ_cur)ÚselfÚ
connectionÚ	__class__s     €r   r    Ú!SqliteInteractiveConsole.__init__(   s#   ø€ Ü‰ÑÔØŒ	Ø×%Ñ%Ó'ˆ�	ó    c                 ó  • U=S:X  a    [        [        R                   5        g=S:X  a    [        S5        gS:X  a  [        R                  " S5        g [        R
                  " U5      (       d  g[        U R                  U5        g)zÇOverride runsource, the core of the InteractiveConsole REPL.

Return True if more input is needed; buffering is done automatically.
Return False is input is a complete statement ready for execution.
z.versionz.helpzEnter SQL code and press enter.z.quitr   TF)r
   r   Úsqlite_versionr   r   Úcomplete_statementr	   r#   )r$   ÚsourceÚfilenameÚsymbols       r   Ú	runsourceÚ"SqliteInteractiveConsole.runsource-   sr   € ð ÞÜœ×/Ñ/Ð0Ô2ð ö ÜÐ7Ô8ð ô Ü—’˜”ð
 ð	 Ü×1Ò1°&×9Ñ9ØÜ˜Ÿ	™	 6Ô*Ør(   )r!   r#   )z<input>Úsingle)	r   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r    r/   Ú__static_attributes__Ú__classcell__)r&   s   @r   r   r   %   s   ø† Ùõ(÷
ò r(   r   c            	      ór  • [        SSS9nUR                  S[        SSSS9  UR                  S	[        SS
S9  UR                  SSSS[        R                   3SS9  UR
                  " U 6 n U R                  S:X  a  SnO[        U R                  5      n[        R                  S:X  a  S[        R                  ;  a  SnOSn[        S[        R                   SU SU S35      R                  5       nS[        l        S[        l        [        R                  " U R                  S S9n U R                   (       a  [#        XPR                   SS9  O [%        U5      n S S KnUR+                  US!S"9  UR-                  5         [        R.                  " S 5        g ! [(         a     NCf = f! UR-                  5         f = f)#NzPython sqlite3 CLIzpython -m sqlite3)ÚdescriptionÚprogr-   z:memory:Ú?zrSQLite database to open (defaults to ':memory:'). A new database is created if the file does not previously exist.)r   ÚdefaultÚnargsÚhelpr   zAAn SQL query to execute. Any returned rows are printed to stdout.)r   r=   r>   z-vz	--versionÚversionzSQLite version z'Print underlying SQLite library version)Úactionr?   r>   za transient in-memory databaseÚwin32zidlelib.runzCTRL-ZzCTRL-Dz2
        sqlite3 shell, running on SQLite version z
        Connected to z}

        Each command will be run using execute() on the cursor.
        Type ".help" for more information; type ".quit" or z to quit.
    zsqlite> z    ... )Úisolation_levelF)r   r   Ú )Úexitmsg)r   Úadd_argumentÚstrr   r*   Ú
parse_argsr-   Úreprr   ÚplatformÚmodulesr   ÚstripÚps1Úps2Úconnectr   r	   r   ÚreadlineÚImportErrorÚinteractÚcloser   )ÚargsÚparserÚdb_nameÚeofkeyÚbannerÚconÚconsolerO   s           r   ÚmainrZ   A   sÀ  € ÜØ(Ø ñ€Fð ×ÑØœ j¸ðOð ñ ð ×ÑØ”C˜sð7ð ñ ð ×ÑØˆk )Ø!¤'×"8Ñ"8Ð!9Ð:Ø6ð ñ ð
 ×Ò˜dÐ#€Dà‡}�}˜
Ó"Ø2‰ä�t—}‘}Ó%ˆô ‡|�|�wÓ =¼¿¹Ó#CØ‰àˆÜð 2Ü29×2HÑ2HÐ1Ið JØ�Yð <ð =C¸8ð Dðó 	÷ 
‰‹ð ð „C„GØ„C„Gä
�/Š/˜$Ÿ-™-¸Ñ
>€CðØ�8�8ä�CŸ™°5Ó9ô /¨sÓ3ˆGðÛð ×Ñ˜V¨RÐÑ0à�	‰	Œä‡H‚HˆQ…Køô ó Ùðûð 	�	‰	�ús0   Ä'1F$ ÅF ÅF$ Æ
F!ÆF$ Æ F!Æ!F$ Æ$F6Ú__main__r   )T)r5   r   r   Úargparser   Úcoder   Útextwrapr   r	   r   rZ   r   Úargv© r(   r   Ú<module>ra      sT   ðñó Û 
å #Ý #Ý ôô,Ð1ô ò8>ðB ˆzÓÙˆ�‰�!�"ˆÕð r(   