cvs: pear /MDB2/MDB2/Driver/Datatype Common.php
| From: | Lukas Smith | Date: | Wed, 08 Jun 2005 12:49:58 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Datatype Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32424@lists.php.net to get a copy of this message | ||
lsmith Wed Jun 8 08:49:58 2005 EDT
Modified files:
/pear/MDB2/MDB2/Driver/Datatype Common.php
Log:
- cosmetic fixes
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.30&r2=1.31&ty=u
Index: pear/MDB2/MDB2/Driver/Datatype/Common.php
diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.30
pear/MDB2/MDB2/Driver/Datatype/Common.php:1.31
--- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.30 Sat May 21 19:01:00 2005
+++ pear/MDB2/MDB2/Driver/Datatype/Common.php Wed Jun 8 08:49:57 2005
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.30 2005/05/21 23:01:00 lsmith Exp $
+// $Id: Common.php,v 1.31 2005/06/08 12:49:57 lsmith Exp $
require_once 'MDB2/LOB.php';
@@ -124,11 +124,7 @@
{
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
- if (!is_array($types)) {
- $types = array($types);
- } else {
- $types = array_values($types);
- }
+ $types = is_array($types) ? array_values($types) : array($types);
foreach ($types as $key => $type) {
if (!isset($this->valid_types[$type])) {
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
@@ -228,9 +224,7 @@
$current_column = -1;
foreach ($row as $key => $column) {
++$current_column;
- if (!isset($column)
- || !isset($types[$current_column])
- ) {
+ if (!isset($column) || !isset($types[$current_column])) {
continue;
}
$value = $this->convertResult($row[$key], $types[$current_column]);
@@ -838,7 +832,9 @@
return null;
}
return 'NULL';
- } elseif (is_null($type)) {
+ }
+
+ if (is_null($type)) {
switch (gettype($value)) {
case 'integer':
$type = 'integer';
@@ -873,9 +869,12 @@
return $db->raiseError('type not defined: '.$type);
}
$value = $this->{"_quote{$type}"}($value);
+
+ // ugly hack to remove single quotes
if (!$quote && isset($value[0]) && $value[0] === "'") {
$value = substr($value, 1, -1);
}
+
return $value;
}