| Server IP : 118.27.122.248 / Your IP : 216.73.216.124 Web Server : Apache System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64 User : c9415830 ( 11735) PHP Version : 8.4.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python36/lib64/python3.6/sqlite3/test/__pycache__/ |
Upload File : |
3
x2_� � @ sx d dl Z d dlZd dlZdd� ZG dd� dej�ZG dd� dej�ZG dd � d ej�Zd
d� Z dd
� Z
edkrte
� dS )� Nc C s dS )NZ
sqlite_testdb� r r r �>/opt/alt/python36/lib64/python3.6/sqlite3/test/transactions.py�get_db_path s r c @ s� e Zd Zdd� Zdd� Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
eje
jdk d�dd� �Zeje
jdk d�dd� �Zdd� ZdS )�TransactionTestsc C sf yt jt� � W n tk
r$ Y nX tjt� dd�| _| jj� | _tjt� dd�| _ | j j� | _
d S )Ng�������?)Ztimeout)�os�remover �OSError�sqlite�connect�con1�cursor�cur1�con2�cur2)�selfr r r �setUp s zTransactionTests.setUpc C sR | j j� | jj� | jj� | jj� ytjt� � W n tk
rL Y nX d S )N) r
�closer r r r �unlinkr r )r r r r �tearDown+ s
zTransactionTests.tearDownc C sN | j jd� | j jd� | j jd� | jjd� | jj� }| jt|�d� d S )Nzcreate table test(i)zinsert into test(i) values (5)zcreate table test2(j)zselect i from testr )r
�executer �fetchall�assertEqual�len)r �resr r r �CheckDMLDoesNotAutoCommitBefore7 s
z0TransactionTests.CheckDMLDoesNotAutoCommitBeforec C sB | j jd� | j jd� | jjd� | jj� }| jt|�d� d S )Nzcreate table test(i)zinsert into test(i) values (5)zselect i from testr )r
r r r r r )r r r r r �CheckInsertStartsTransaction? s
z-TransactionTests.CheckInsertStartsTransactionc C sX | j jd� | j jd� | jj� | j jd� | jjd� | jj� d }| j|d� d S )Nzcreate table test(i)zinsert into test(i) values (5)zupdate test set i=6zselect i from testr � )r
r r �commitr Zfetchoner )r r r r r �CheckUpdateStartsTransactionF s
z-TransactionTests.CheckUpdateStartsTransactionc C sX | j jd� | j jd� | jj� | j jd� | jjd� | jj� }| jt|�d� d S )Nzcreate table test(i)zinsert into test(i) values (5)zdelete from testzselect i from test� )r
r r r r r r r )r r r r r �CheckDeleteStartsTransactionO s
z-TransactionTests.CheckDeleteStartsTransactionc C sl | j jd� | j jd� | jj� | j jd� | jjd� | jj� }| jt|�d� | j|d d d� d S )Nzcreate table test(i)zinsert into test(i) values (5)zreplace into test(i) values (6)zselect i from testr r r )r
r r r r r r r )r r r r r �CheckReplaceStartsTransactionX s
z.TransactionTests.CheckReplaceStartsTransactionc C s� | j jd� | j jd� d | j_| j| jjd � | jjd� | jj� }| jt|�d� d| j_| j| jjd� | j jd� | jjd� | jj� }| jt|�d� d S )Nzcreate table test(i)zinsert into test(i) values (5)zselect i from testr ZDEFERRED)r
r r Zisolation_levelr r r r )r r r r r �CheckToggleAutoCommitb s
z&TransactionTests.CheckToggleAutoCommit� � z.test hangs on sqlite versions older than 3.2.2c C s@ | j jd� | j jd� | jtj�� | jjd� W d Q R X d S )Nzcreate table test(i)zinsert into test(i) values (5))r
r �assertRaisesr �OperationalErrorr )r r r r �CheckRaiseTimeoutr s z"TransactionTests.CheckRaiseTimeoutc C sJ | j jd� | j jd� | jtj�� | jjd� W dQ R X | jj� 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
r r% r r&