From d7f225d41909943e8a718699783eb92c8062dd42 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Sun, 13 Jan 2008 13:34:45 +0000 Subject: [PATCH] don't open transactions for SHOW and SET statements - reduces some redundancy of transaction startup --- includes/Database.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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() ) { -- 2.20.1