From: Domas Mituzas Date: Sun, 13 Jan 2008 13:34:45 +0000 (+0000) Subject: don't open transactions for SHOW and SET statements - reduces some redundancy of... X-Git-Tag: 1.31.0-rc.0~50029 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=d7f225d41909943e8a718699783eb92c8062dd42;p=lhc%2Fweb%2Fwiklou.git don't open transactions for SHOW and SET statements - reduces some redundancy of transaction startup --- diff --git a/includes/Database.php b/includes/Database.php index f611f8e73c..0548b7cec3 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -759,9 +759,13 @@ class Database { # If DBO_TRX is set, start a transaction if ( ( $this->mFlags & DBO_TRX ) && !$this->trxLevel() && - $sql != 'BEGIN' && $sql != 'COMMIT' && $sql != 'ROLLBACK' - ) { - $this->begin(); + $sql != 'BEGIN' && $sql != 'COMMIT' && $sql != 'ROLLBACK') { + // avoid establishing transactions for SHOW and SET statements too - + // that would delay transaction initializations to once connection + // is really used by application + $sqlstart = substr($sql,0,10); // very much worth it, benchmark certified(tm) + if (strpos($sqlstart,"SHOW ")!==0 and strpos($sqlstart,"SET ")!==0) + $this->begin(); } if ( $this->debug() ) {