Allow individual queries for cacheV::build() so we don't hit MySQL max packet
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 23 Jan 2006 05:45:52 +0000 (05:45 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 23 Jan 2006 05:45:52 +0000 (05:45 +0000)
includes/cachev.php
rebuild.sh.php

index 4d7dd1052091749d68de632b16120acea6df210b..195132ba68ca64d9d414686ac0b8360befb42d30 100644 (file)
@@ -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));
        }
index db4427a989ba8ca4b84947fbfd718320b4ec4c59..c106801ea429d9087d4086d03caa2709dc4879ac 100644 (file)
@@ -64,7 +64,7 @@ foreach ($viewsvn->repos->fetch_list() AS $repos)
        }
        
        $controller = new Controller($repos);
-       $controller->cachev->build(null);
+       $controller->cachev->build(null, true);
 }
 
 /*=====================================================================*\