cvs: php4 /pear/DB storage.php

From: Date: Thu, 02 Aug 2001 06:59:18 +0000
Subject: cvs: php4 /pear/DB storage.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-401@lists.php.net to get a copy of this message
ssb Thu Aug 2 02:59:18 2001 EDT Modified files: /php4/pear/DB storage.php Log: * some more quoting fixes and an E_ALL fix Index: php4/pear/DB/storage.php diff -u php4/pear/DB/storage.php:1.21 php4/pear/DB/storage.php:1.22 --- php4/pear/DB/storage.php:1.21 Tue Jul 31 03:57:10 2001 +++ php4/pear/DB/storage.php Thu Aug 2 02:59:18 2001 @@ -111,17 +111,18 @@ if ($i > 0) { $whereclause .= ' AND '; } - $whereclause .= $this->_keycolumn[$i] . ' = '; - if (is_string($keyval[$i])) { - $whereclause .= "'" . - $this->_dbh->quoteString($keyval[$i]) . "'"; + $whereclause .= $this->_keycolumn[$i]; + if (is_null($keyval)) { + // there's not much point in having a NULL key, + // but we support it anyway + $whereclause .= ' IS NULL'; } else { - $whereclause .= $keyval[$i]; + $whereclause .= ' = ' . $this->_dbh->quote($keyval); } } } else { if ($keyval === null) { - $keyval = $this->{$this->_keycolumn}; + $keyval = @$this->{$this->_keycolumn}; } $whereclause = $this->_keycolumn; if (is_null($keyval)) { @@ -145,11 +146,7 @@ */ function setup($keyval) { - if (is_int($keyval)) { - $qval = "$keyval"; - } else { - $qval = "'" . $this->_dbh->quoteString($keyval) . "'"; - } + $qval = $this->_dbh->quote($keyval); $whereclause = $this->_makeWhere($keyval); $query = 'SELECT * FROM ' . $this->_table . ' WHERE ' . $whereclause; $sth = $this->_dbh->query($query); @@ -184,11 +181,7 @@ } settype($newpk, "array"); for ($i = 0; $i < sizeof($primarykey); $i++) { - if (is_int($newpk[$i])) { - $pkvals[] = $newpk[$i]; - } else { - $pkvals[] = "'".$this->_dbh->quoteString($newpk[$i])."'"; - } + $pkvals[] = $this->_dbh->quote($newpk[$i]); } $sth = $this->_dbh->query("INSERT INTO $this->_table (" .

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