From dfe674ffa12a77468ef2663d75d67768ee219039 Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 5 May 2007 04:53:43 +0000 Subject: - changed the way we do forum accounting in phpBB, far less intensive and much faster. sync() recalculates the number of topics and posts using just the topics table instead of having to join topics and posts together. However, even this can be avoided if we know what operation is happening and an auto sync is not in action. Since MCP operations are "known", we can provide very fast MCP operations. - changed the way we decide if a DB gets multi value support. Old method uses switch/case, new method assumes a DB can't unless the DB says it can via a property I hope nothing is broken :P git-svn-id: file:///svn/phpbb/trunk@7466 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/dbal.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'phpBB/includes/db/dbal.php') diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index dbc0859733..cfd13fd118 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -38,6 +38,9 @@ class dbal // Holding the last sql query on sql error var $sql_error_sql = ''; + // Supports multi inserts? + var $multi_insert = false; + /** * Current sql layer */ @@ -364,25 +367,21 @@ class dbal return false; } - switch ($this->sql_layer) + if ($this->multi_insert) { - case 'mysql': - case 'mysql4': - case 'mysqli': - $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('MULTI_INSERT', $sql_ary)); - break; - - default: - foreach ($sql_ary as $ary) + $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('MULTI_INSERT', $sql_ary)); + } + else + { + foreach ($sql_ary as $ary) + { + if (!is_array($ary)) { - if (!is_array($ary)) - { - return false; - } - - $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); + return false; } - break; + + $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); + } } return true; -- cgit v1.2.1