jenkins-bot has submitted this change and it was merged.
Change subject: database: Avoid use of PDO transaction system for SQLite
......................................................................
database: Avoid use of PDO transaction system for SQLite
This is in preparation for changing doBegin() to use BEGIN IMMEDIATE.
PDO::beginTransaction() doesn't support any parameters for mode.
Use direct queries instead so that modes (such as IMMEDIATE) can
be used.
Since PDO's transaction system maintains state internally (similarly
to what MediaWiki Database classes do) we have to abandon use of
PDO commit() and rollback() as well (in favour of direct queries
already provided by DatabaseBase).
Bug: T89180
Change-Id: I2ad2a3c2a6d4737f5ef8822fba7cbcf5e36021f4
---
M includes/db/DatabaseSqlite.php
1 file changed, 1 insertion(+), 33 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php
index 9257ffe..95c44df 100644
--- a/includes/db/DatabaseSqlite.php
+++ b/includes/db/DatabaseSqlite.php
@@ -144,8 +144,8 @@
}
$this->mOpened = !!$this->mConn;
- # set error codes only, don't raise exceptions
if ( $this->mOpened ) {
+ # Set error codes only, don't raise exceptions
$this->mConn->setAttribute( PDO::ATTR_ERRMODE,
PDO::ERRMODE_SILENT );
# Enforce LIKE to be case sensitive, just like MySQL
$this->query( 'PRAGMA case_sensitive_like = 1' );
@@ -709,38 +709,6 @@
}
return false;
- }
-
- protected function doBegin( $fname = '' ) {
- if ( $this->mTrxLevel == 1 ) {
- $this->commit( __METHOD__ );
- }
- try {
- $this->mConn->beginTransaction();
- } catch ( PDOException $e ) {
- throw new DBUnexpectedError( $this, 'Error in BEGIN
query: ' . $e->getMessage() );
- }
- $this->mTrxLevel = 1;
- }
-
- protected function doCommit( $fname = '' ) {
- if ( $this->mTrxLevel == 0 ) {
- return;
- }
- try {
- $this->mConn->commit();
- } catch ( PDOException $e ) {
- throw new DBUnexpectedError( $this, 'Error in COMMIT
query: ' . $e->getMessage() );
- }
- $this->mTrxLevel = 0;
- }
-
- protected function doRollback( $fname = '' ) {
- if ( $this->mTrxLevel == 0 ) {
- return;
- }
- $this->mConn->rollBack();
- $this->mTrxLevel = 0;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/191516
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2ad2a3c2a6d4737f5ef8822fba7cbcf5e36021f4
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits