From 84b0c0bbd9b2b12711eaad8e6fd50879b8d04d00 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 23 Jan 2006 05:45:52 +0000 Subject: [PATCH] Allow individual queries for cacheV::build() so we don't hit MySQL max packet --- includes/cachev.php | 60 +++++++++++++++++++++++++++++++++------------ rebuild.sh.php | 2 +- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/includes/cachev.php b/includes/cachev.php index 4d7dd10..195132b 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -324,8 +324,9 @@ class cacheV * @access public * * @param integer Lower (current) revision + * @param bool Use separate and individual queries for inserting? */ - function build($revision) + function build($revision, $seps = false) { $start = microtime(); @@ -420,21 +421,48 @@ class cacheV $inserts['nodes'][] = "('$path', '" . $node['kind'] . "', " . $node['commit']['revision'] . ", '" . $this->controller->registry->escape(serialize($loglist)) . "', '" . $this->controller->registry->escape(serialize($proplist["$path"])) . "')"; } - // insert _revs - $this->controller->registry->db->query(" - REPLACE INTO c{$this->hash}_revs - (revision, author, dateline, message, files) - VALUES - " . implode(",\n", $inserts['revs']) - ); - - // insert _nodes - $this->controller->registry->db->query(" - REPLACE INTO c{$this->hash}_nodes - (name, node, revision, history, properties) - VALUES - " . implode(",\n", $inserts['nodes']) - ); + if ($seps == false) + { + // insert _revs + $this->controller->registry->db->query(" + REPLACE INTO c{$this->hash}_revs + (revision, author, dateline, message, files) + VALUES + " . implode(",\n", $inserts['revs']) + ); + + // insert _nodes + $this->controller->registry->db->query(" + REPLACE INTO c{$this->hash}_nodes + (name, node, revision, history, properties) + VALUES + " . implode(",\n", $inserts['nodes']) + ); + } + else + { + // _revs + foreach ($inserts['revs'] AS $insert) + { + $this->controller->registry->db->query(" + REPLACE INTO c{$this->hash}_revs + (revision, author, dateline, message, files) + VALUES + $insert" + ); + } + + // _nodes + foreach ($inserts['nodes'] AS $insert) + { + $this->controller->registry->db->query(" + REPLACE INTO c{$this->hash}_nodes + (name, node, revision, history, properties) + VALUES + $insert" + ); + } + } $this->controller->registry->debug("TIME TO (RE)BUILD: " . $this->controller->registry->funct->fetch_microtime_diff($start)); } diff --git a/rebuild.sh.php b/rebuild.sh.php index db4427a..c106801 100644 --- a/rebuild.sh.php +++ b/rebuild.sh.php @@ -64,7 +64,7 @@ foreach ($viewsvn->repos->fetch_list() AS $repos) } $controller = new Controller($repos); - $controller->cachev->build(null); + $controller->cachev->build(null, true); } /*=====================================================================*\ -- 2.43.5