HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/sqlite3/test/__pycache__/transactions.cpython-37.pyc
B

��g��@sxddlZddlZddlZdd�ZGdd�dej�ZGdd�dej�ZGdd	�d	ej�Zd
d�Z	dd
�Z
edkrte
�dS)�NcCsdS)NZ
sqlite_testdb�rrr�5/usr/local/lib/python3.7/sqlite3/test/transactions.py�get_db_pathsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
e�e
jdkd�dd��Ze�e
jdkd�dd��Zdd�ZdS)�TransactionTestscCsfyt�t��Wntk
r$YnXtjt�dd�|_|j��|_tjt�dd�|_	|j	��|_
dS)Ng�������?)Ztimeout)�os�remover�OSError�sqlite�connect�con1�cursor�cur1�con2�cur2)�selfrrr�setUpszTransactionTests.setUpcCsR|j��|j��|j��|j��yt�t��Wntk
rLYnXdS)N)	r
�closerrrr�unlinkrr)rrrr�tearDown+s



zTransactionTests.tearDowncCsN|j�d�|j�d�|j�d�|j�d�|j��}|�t|�d�dS)Nzcreate table test(i)zinsert into test(i) values (5)zcreate table test2(j)zselect i from testr)r
�executer�fetchall�assertEqual�len)r�resrrr�CheckDMLDoesNotAutoCommitBefore7s
z0TransactionTests.CheckDMLDoesNotAutoCommitBeforecCsB|j�d�|j�d�|j�d�|j��}|�t|�d�dS)Nzcreate table test(i)zinsert into test(i) values (5)zselect i from testr)r
rrrrr)rrrrr�CheckInsertStartsTransaction?s

z-TransactionTests.CheckInsertStartsTransactioncCsX|j�d�|j�d�|j��|j�d�|j�d�|j��d}|�|d�dS)Nzcreate table test(i)zinsert into test(i) values (5)zupdate test set i=6zselect i from testr�)r
rr�commitrZfetchoner)rrrrr�CheckUpdateStartsTransactionFs
z-TransactionTests.CheckUpdateStartsTransactioncCsX|j�d�|j�d�|j��|j�d�|j�d�|j��}|�t|�d�dS)Nzcreate table test(i)zinsert into test(i) values (5)zdelete from testzselect i from test�)r
rrrrrrr)rrrrr�CheckDeleteStartsTransactionOs

z-TransactionTests.CheckDeleteStartsTransactioncCsl|j�d�|j�d�|j��|j�d�|j�d�|j��}|�t|�d�|�|ddd�dS)Nzcreate table test(i)zinsert into test(i) values (5)zreplace into test(i) values (6)zselect i from testrrr)r
rrrrrrr)rrrrr�CheckReplaceStartsTransactionXs

z.TransactionTests.CheckReplaceStartsTransactioncCs�|j�d�|j�d�d|j_|�|jjd�|j�d�|j��}|�t|�d�d|j_|�|jjd�|j�d�|j�d�|j��}|�t|�d�dS)Nzcreate table test(i)zinsert into test(i) values (5)zselect i from testrZDEFERRED)r
rrZisolation_levelrrrr)rrrrr�CheckToggleAutoCommitbs

z&TransactionTests.CheckToggleAutoCommit)��r$z.test hangs on sqlite versions older than 3.2.2c	Cs@|j�d�|j�d�|�tj��|j�d�WdQRXdS)Nzcreate table test(i)zinsert into test(i) values (5))r
r�assertRaisesr	�OperationalErrorr)rrrr�CheckRaiseTimeoutrsz"TransactionTests.CheckRaiseTimeoutc	CsJ|j�d�|j�d�|�tj��|j�d�WdQRX|j��dS)z�
        This tests the improved concurrency with pysqlite 2.3.4. You needed
        to roll back con2 before you could commit con1.
        zcreate table test(i)zinsert into test(i) values (5)N)r
rr%r	r&rrr)rrrr�CheckLockingzs
zTransactionTests.CheckLockingc	Cs\t�d�}|��}|�d�|�d�|�d�|��|�tj��|��WdQRXdS)z�
        Checks if cursors on the connection are set into a "reset" state
        when a rollback is done on the connection.
        z:memory:zcreate table test(x)zinsert into test(x) values (5)z&select 1 union select 2 union select 3N)r	r
rr�rollbackr%ZInterfaceErrorr)r�con�currrr�CheckRollbackCursorConsistency�s



z/TransactionTests.CheckRollbackCursorConsistencyN)�__name__�
__module__�__qualname__rrrrrr r!r"�unittestZskipIfr	Zsqlite_version_infor'r(r,rrrrrs		

rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�SpecialCommandTestscCst�d�|_|j��|_dS)Nz:memory:)r	r
r*rr+)rrrrr�szSpecialCommandTests.setUpcCs(|j�d�|j�d�|j�d�dS)Nzcreate table test(i)zinsert into test(i) values (5)zdrop table test)r+r)rrrr�CheckDropTable�sz"SpecialCommandTests.CheckDropTablecCs(|j�d�|j�d�|j�d�dS)Nzcreate table test(i)zinsert into test(i) values (5)zpragma count_changes=1)r+r)rrrr�CheckPragma�szSpecialCommandTests.CheckPragmacCs|j��|j��dS)N)r+rr*)rrrrr�s
zSpecialCommandTests.tearDownN)r-r.r/rr2r3rrrrrr1�sr1c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TransactionalDDLcCst�d�|_dS)Nz:memory:)r	r
r*)rrrrr�szTransactionalDDL.setUpcCs6|j�d�|j��|j�d���}|�|g�dS)Nzcreate table test(i)zselect * from test)r*rr)rr)r�resultrrr�#CheckDdlDoesNotAutostartTransaction�s
z4TransactionalDDL.CheckDdlDoesNotAutostartTransactionc	CsJ|j�d�|j�d�|j��|�tj��|j�d�WdQRXdS)Nzbegin immediatezcreate table test(i)zselect * from test)r*rr)r%r	r&)rrrr�CheckImmediateTransactionalDDL�s

z/TransactionalDDL.CheckImmediateTransactionalDDLc	CsJ|j�d�|j�d�|j��|�tj��|j�d�WdQRXdS)NZbeginzcreate table test(i)zselect * from test)r*rr)r%r	r&)rrrr�CheckTransactionalDDL�s

z&TransactionalDDL.CheckTransactionalDDLcCs|j��dS)N)r*r)rrrrr�szTransactionalDDL.tearDownN)r-r.r/rr6r7r8rrrrrr4�s
		r4cCs4t�td�}t�td�}t�td�}t�|||f�S)NZCheck)r0Z	makeSuiterr1r4Z	TestSuite)Z
default_suiteZspecial_command_suiteZ	ddl_suiterrr�suite�sr9cCst��}|�t��dS)N)r0ZTextTestRunner�runr9)Zrunnerrrr�test�sr;�__main__)rr0Zsqlite3r	rZTestCaserr1r4r9r;r-rrrr�<module>sy!