cvs: pear /MDB/MDB Common.php mysql.php
| From: | Lukas Smith | Date: | Fri, 20 Dec 2002 17:54:25 +0000 |
| Subject: | cvs: pear /MDB/MDB Common.php mysql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7934@lists.php.net to get a copy of this message | ||
lsmith Fri Dec 20 12:54:25 2002 EDT
Modified files:
/pear/MDB/MDB mysql.php Common.php
Log:
allow replace to be used without passing datatypes information
this will require some modifications to the metabase wrapper because this means that replace does
not default to text anymore
Index: pear/MDB/MDB/mysql.php
diff -u pear/MDB/MDB/mysql.php:1.60 pear/MDB/MDB/mysql.php:1.61
--- pear/MDB/MDB/mysql.php:1.60 Sat Nov 23 18:51:26 2002
+++ pear/MDB/MDB/mysql.php Fri Dec 20 12:54:25 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
//
-// $Id: mysql.php,v 1.60 2002/11/23 23:51:26 lsmith Exp $
+// $Id: mysql.php,v 1.61 2002/12/20 17:54:25 lsmith Exp $
//
require_once 'MDB/Common.php';
@@ -585,34 +585,36 @@
return $this->raiseError(MDB_ERROR_CANNOT_REPLACE, '',
'',
'no value for field "'.$name.'" specified');
}
- switch(isset($fields[$name]['Type']) ? $fields[$name]['Type'] :
'text') {
- case 'text':
- $value = $this->getTextValue($fields[$name]['Value']);
- break;
- case 'boolean':
- $value = $this->getBooleanValue($fields[$name]['Value']);
- break;
- case 'integer':
- $value = strval($fields[$name]['Value']);
- break;
- case 'decimal':
- $value = $this->getDecimalValue($fields[$name]['Value']);
- break;
- case 'float':
- $value = $this->getFloatValue($fields[$name]['Value']);
- break;
- case 'date':
- $value = $this->getDateValue($fields[$name]['Value']);
- break;
- case 'time':
- $value = $this->getTimeValue($fields[$name]['Value']);
- break;
- case 'timestamp':
- $value = $this->getTimestampValue($fields[$name]['Value']);
- break;
- default:
- return $this->raiseError(MDB_ERROR_CANNOT_REPLACE, '',
'',
- 'no supported type for field "'.$name.'"
specified');
+ if(isset($fields[$name]['Type'])) {
+ switch ($fields[$name]['Type']) {
+ case 'text':
+ $value = $this->getTextValue($fields[$name]['Value']);
+ break;
+ case 'boolean':
+ $value = $this->getBooleanValue($fields[$name]['Value']);
+ break;
+ case 'integer':
+ $value = strval($fields[$name]['Value']);
+ break;
+ case 'decimal':
+ $value = $this->getDecimalValue($fields[$name]['Value']);
+ break;
+ case 'float':
+ $value = $this->getFloatValue($fields[$name]['Value']);
+ break;
+ case 'date':
+ $value = $this->getDateValue($fields[$name]['Value']);
+ break;
+ case 'time':
+ $value = $this->getTimeValue($fields[$name]['Value']);
+ break;
+ case 'timestamp':
+ $value =
$this->getTimestampValue($fields[$name]['Value']);
+ break;
+ default:
+ return $this->raiseError(MDB_ERROR_CANNOT_REPLACE, '',
'',
+ 'no supported type for field "' . $name .
'" specified');
+ }
}
}
$values .= $value;
Index: pear/MDB/MDB/Common.php
diff -u pear/MDB/MDB/Common.php:1.80 pear/MDB/MDB/Common.php:1.81
--- pear/MDB/MDB/Common.php:1.80 Fri Dec 20 07:11:59 2002
+++ pear/MDB/MDB/Common.php Fri Dec 20 12:54:25 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.80 2002/12/20 12:11:59 lsmith Exp $
+// $Id: Common.php,v 1.81 2002/12/20 17:54:25 lsmith Exp $
/**
* @package MDB
@@ -1534,34 +1534,36 @@
return $this->raiseError(MDB_ERROR_CANNOT_REPLACE, '',
'',
'no value for field "' . $name . '"
specified');
}
- switch (isset($fields[$name]['Type']) ? $fields[$name]['Type']
: 'text') {
- case 'text':
- $value = $this->getTextValue($fields[$name]['Value']);
- break;
- case 'boolean':
- $value = $this->getBooleanValue($fields[$name]['Value']);
- break;
- case 'integer':
- $value = strval($fields[$name]['Value']);
- break;
- case 'decimal':
- $value = $this->getDecimalValue($fields[$name]['Value']);
- break;
- case 'float':
- $value = $this->getFloatValue($fields[$name]['Value']);
- break;
- case 'date':
- $value = $this->getDateValue($fields[$name]['Value']);
- break;
- case 'time':
- $value = $this->getTimeValue($fields[$name]['Value']);
- break;
- case 'timestamp':
- $value = $this->getTimestampValue($fields[$name]['Value']);
- break;
- default:
- return $this->raiseError(MDB_ERROR_CANNOT_REPLACE, '',
'',
- 'no supported type for field "' . $name . '"
specified');
+ if(isset($fields[$name]['Type'])) {
+ switch ($fields[$name]['Type']) {
+ case 'text':
+ $value = $this->getTextValue($fields[$name]['Value']);
+ break;
+ case 'boolean':
+ $value = $this->getBooleanValue($fields[$name]['Value']);
+ break;
+ case 'integer':
+ $value = strval($fields[$name]['Value']);
+ break;
+ case 'decimal':
+ $value = $this->getDecimalValue($fields[$name]['Value']);
+ break;
+ case 'float':
+ $value = $this->getFloatValue($fields[$name]['Value']);
+ break;
+ case 'date':
+ $value = $this->getDateValue($fields[$name]['Value']);
+ break;
+ case 'time':
+ $value = $this->getTimeValue($fields[$name]['Value']);
+ break;
+ case 'timestamp':
+ $value =
$this->getTimestampValue($fields[$name]['Value']);
+ break;
+ default:
+ return $this->raiseError(MDB_ERROR_CANNOT_REPLACE, '',
'',
+ 'no supported type for field "' . $name .
'" specified');
+ }
}
}
$update .= '=' . $value;