��Qc@s�ddlZddlZddlZddlZd�Zdejfd��YZdejfd��YZd�Z d�Z
ed kr�e
�ndS(
i�NcCsdS(Nt
sqlite_testdb((((s//sys/lib/python2.7/sqlite3/test/transactions.pytget_db_pathstTransactionTestscBskeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�ZRS(cCs�ytjt��Wntk
r'nXtjt�dd�|_|jj�|_tjt�dd�|_ |j j�|_
dS(Nttimeoutg����(tostremoveRtOSErrortsqlitetconnecttcon1tcursortcur1tcon2tcur2(tself((s//sys/lib/python2.7/sqlite3/test/transactions.pytsetUp s
cCs`|jj�|jj�|jj�|jj�ytjt��Wntk
r[nXdS(N( RtcloseR R
RRtunlinkRR(R((s//sys/lib/python2.7/sqlite3/test/transactions.pyttearDown,s
cCsi|jjd�|jjd�|jjd�|jjd�|jj�}|jt|�d�dS(Nscreate table test(i)sinsert into test(i) values (5)screate table test2(j)sselect i from testi(RtexecuteR
tfetchalltassertEqualtlen(Rtres((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckDMLdoesAutoCommitBefore8scCsY|jjd�|jjd�|jjd�|jj�}|jt|�d�dS(Nscreate table test(i)sinsert into test(i) values (5)sselect i from testi(RRR
RRR(RR((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckInsertStartsTransaction@s
cCst|jjd�|jjd�|jj�|jjd�|jjd�|jj�d}|j|d�dS(Nscreate table test(i)sinsert into test(i) values (5)supdate test set i=6sselect i from testii(RRR tcommitR
tfetchoneR(RR((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckUpdateStartsTransactionGs
cCsv|jjd�|jjd�|jj�|jjd�|jjd�|jj�}|jt|�d�dS(Nscreate table test(i)sinsert into test(i) values (5)sdelete from testsselect i from testi(RRR RR
RRR(RR((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckDeleteStartsTransactionPs
cCs�|jjd�|jjd�|jj�|jjd�|jjd�|jj�}|jt|�d�|j|ddd�dS(Nscreate table test(i)sinsert into test(i) values (5)sreplace into test(i) values (6)sselect i from testiii(RRR RR
RRR(RR((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckReplaceStartsTransactionYs
cCs�|jjd�|jjd�d|j_|j|jjd�|jjd�|jj�}|jt|�d�d|j_|j|jjd�|jjd�|jjd�|jj�}|jt|�d�dS(Nscreate table test(i)sinsert into test(i) values (5)sselect i from testitDEFERRED( RRtNoneR tisolation_levelRR
RR(RR((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckToggleAutoCommitcscCs�tjdkrdS|jjd�|jjd�y!|jjd�|jd�Wn'tjk
rjn|jd�nXdS(Niiscreate table test(i)sinsert into test(i) values (5)s&should have raised an OperationalError(iii(Rtsqlite_version_infoRRR
tfailtOperationalError(R((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckRaiseTimeoutsscCs�tjdkrdS|jjd�|jjd�y!|jjd�|jd�Wn'tjk
rjn|jd�nX|jj�dS(s�
This tests the improved concurrency with pysqlite 2.3.4. You needed
to roll back con2 before you could commit con1.
iiNscreate table test(i)sinsert into test(i) values (5)s&should have raised an OperationalError(iii( RR#RRR
R$R%R R(R((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckLocking�scCs�tjd�}|j�}|jd�|jd�|jd�|j�y|j�|jd�Wn)tjk
r}n|jd�nXdS(s�
Checks if cursors on the connection are set into a "reset" state
when a rollback is done on the connection.
s:memory:screate table test(x)sinsert into test(x) values (5)s&select 1 union select 2 union select 3s&InterfaceError should have been raisedN(RRR
RtrollbackRR$tInterfaceError(Rtcontcurte((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckRollbackCursorConsistency�s
(
t__name__t
__module__RRRRRRRR"R&R'R-(((s//sys/lib/python2.7/sqlite3/test/transactions.pyRs
tSpecialCommandTestscBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs(tjd�|_|jj�|_dS(Ns:memory:(RRR*R
R+(R((s//sys/lib/python2.7/sqlite3/test/transactions.pyR�scCs4|jjd�|jjd�|jjd�dS(Nscreate table test(i)sinsert into test(i) values (5)tvacuum(R+R(R((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckVacuum�scCs4|jjd�|jjd�|jjd�dS(Nscreate table test(i)sinsert into test(i) values (5)sdrop table test(R+R(R((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckDropTable�scCs4|jjd�|jjd�|jjd�dS(Nscreate table test(i)sinsert into test(i) values (5)spragma count_changes=1(R+R(R((s//sys/lib/python2.7/sqlite3/test/transactions.pytCheckPragma�scCs|jj�|jj�dS(N(R+RR*(R((s//sys/lib/python2.7/sqlite3/test/transactions.pyR�s
(R.R/RR2R3R4R(((s//sys/lib/python2.7/sqlite3/test/transactions.pyR0�s
cCs7tjtd�}tjtd�}tj||f�S(NtCheck(tunittestt makeSuiteRR0t TestSuite(t
default_suitetspecial_command_suite((s//sys/lib/python2.7/sqlite3/test/transactions.pytsuite�scCs tj�}|jt��dS(N(R6tTextTestRunnertrunR;(trunner((s//sys/lib/python2.7/sqlite3/test/transactions.pyttest�st__main__(tsysRR6tsqlite3RRtTestCaseRR0R;R?R.(((s//sys/lib/python2.7/sqlite3/test/transactions.pyt<module>s �
|