cvs: pear /Config/Config/Container db.php

From: Date: Wed, 24 Jul 2002 10:33:39 +0000
Subject: cvs: pear /Config/Config/Container db.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5318@lists.php.net to get a copy of this message
mansion Wed Jul 24 06:33:39 2002 EDT Modified files: /pear/Config/Config/Container db.php Log: Using prepare/execute for the insert. Not tested yet. Index: pear/Config/Config/Container/db.php diff -u pear/Config/Config/Container/db.php:1.4 pear/Config/Config/Container/db.php:1.5 --- pear/Config/Config/Container/db.php:1.4 Tue Jul 23 12:05:59 2002 +++ pear/Config/Config/Container/db.php Wed Jul 24 06:33:39 2002 @@ -15,7 +15,7 @@ // | Authors: Christian Stocker <chregu@phant.ch> | // +----------------------------------------------------------------------+ // -// $Id: db.php,v 1.4 2002/07/23 16:05:59 mansion Exp $ +// $Id: db.php,v 1.5 2002/07/24 10:33:39 mansion Exp $ require_once('Config/Container.php'); require_once('DB.php'); @@ -36,7 +36,7 @@ * * @author Christian Stocker <chregu@phant.ch> * @access public -* @version $Id: db.php,v 1.4 2002/07/23 16:05:59 mansion Exp $ +* @version $Id: db.php,v 1.5 2002/07/24 10:33:39 mansion Exp $ * @package Config */ class Config_Container_db extends Config_Container { @@ -183,25 +183,20 @@ if (DB::isError($res)) { return new DB_Error($res->code, PEAR_ERROR_DIE); } + $query = 'INSERT INTO '.$this->feature['table'].' (' + .$this->feature['datasrccol'].','.$this->feature['blockcol'].',' + .$this->feature['namecol'].','.$this->feature['valuecol'] + .') VALUES (?,?,?,?)'; + $sthÊ=Ê$this->db->prepare($query); foreach ($this->data as $block => $blockarray) { - foreach ($blockarray as $name => $value) { - $query = sprintf("INSERT INTO %s (%s, %s, %s, %s) VALUES ('%s', '%s', '%s', '%s')", - $this->feature['table'], - $this->feature['datasrccol'], - $this->feature['blockcol'], - $this->feature['namecol'], - $this->feature['valuecol'], - $datasrc, - $block, - $name, - $value - ); - $res = $this->query($query); - if (DB::isError($res)) { - return new DB_Error($res->code, PEAR_ERROR_DIE); - } - } - } + foreach ($blockarray as $name => $value) { + $alldata[] = array($datasrc, $block, $name, $value); + } + } + $res = $this->db->executeMultiple($sth,Ê$alldata); + if (DB::isError($res)) { + return new DB_Error($res->code, PEAR_ERROR_DIE); + } } // end func writeInput } // end class Config_Container_db ?>

« previous php.pear.cvs (#5318) next »