* Some callers get the DB and flip DBO_TRX off, which does not
help much if simply connecting to the DB starts a transaction.
Change-Id: I2bc90a1cdeade13ccb546db1183ab08f25156da1
// Set SQL mode, default is turning them all off, can be overridden or skipped with null
if ( is_string( $wgSQLMode ) ) {
$mode = $this->addQuotes( $wgSQLMode );
- $this->query( "SET sql_mode = $mode", __METHOD__ );
+ // Use doQuery() to avoid opening implicit transactions (DBO_TRX)
+ $success = $this->doQuery( "SET sql_mode = $mode", __METHOD__ );
+ if ( !$success ) {
+ wfLogDBError( "Error setting sql_mode to $mode on server {$this->mServer}" );
+ return $this->reportConnectionError( "Error setting sql_mode to $mode" );
+ }
}
$this->mOpened = true;