cvs: pear /MDB2_Schema/MDB2/Schema Validate.php
| From: | Lukas Smith | Date: | Tue, 29 Aug 2006 12:48:16 +0000 |
| Subject: | cvs: pear /MDB2_Schema/MDB2/Schema Validate.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-41910@lists.php.net to get a copy of this message | ||
lsmith Tue Aug 29 12:48:16 2006 UTC
Modified files:
/pear/MDB2_Schema/MDB2/Schema Validate.php
Log:
- minor cleanups
http://cvs.php.net/viewvc.cgi/pear/MDB2_Schema/MDB2/Schema/Validate.php?r1=1.22&r2=1.23&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema/Validate.php
diff -u pear/MDB2_Schema/MDB2/Schema/Validate.php:1.22
pear/MDB2_Schema/MDB2/Schema/Validate.php:1.23
--- pear/MDB2_Schema/MDB2/Schema/Validate.php:1.22 Tue Aug 29 12:23:17 2006
+++ pear/MDB2_Schema/MDB2/Schema/Validate.php Tue Aug 29 12:48:16 2006
@@ -43,7 +43,7 @@
// | Author: Igor Feghali <ifeghali@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Validate.php,v 1.22 2006/08/29 12:23:17 lsmith Exp $
+// $Id: Validate.php,v 1.23 2006/08/29 12:48:16 lsmith Exp $
//
/**
@@ -354,7 +354,7 @@
}
}
if (isset($field['default'])
- && PEAR::isError($result = $this->validateDataFieldValue($field,
$field_name, $field['default']))
+ && PEAR::isError($result = $this->validateDataFieldValue($field,
$field['default'], $field_name))
) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'default value of "'.$field_name.'" is incorrect:
'.$result->getUserinfo());
@@ -606,14 +606,10 @@
}
if (!isset($table_fields[$field_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'unknown field "'.$field_name.'"');
- }
- if (!isset($table_fields[$field_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'"'.$field_name.'" is not defined');
}
if ($value !== ''
- && PEAR::isError($result =
$this->validateDataFieldValue($table_fields[$field_name], $field_name, $value))
+ && PEAR::isError($result =
$this->validateDataFieldValue($table_fields[$field_name], $value, $field_name))
) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'value of "'.$field_name.'" is incorrect:
'.$result->getUserinfo());
@@ -630,15 +626,15 @@
*
* @param array multi dimensional array that contains the
* definition for current table's fields.
- * @param string name of the parsed field
* @param string value to fill the parsed field
+ * @param string name of the parsed field
*
* @return bool|error object
*
* @access public
* @see MDB2_Schema_Validate::validateInsertField()
*/
- function validateDataFieldValue($field_def, $field_name, &$field_value)
+ function validateDataFieldValue($field_def, &$field_value, $field_name)
{
switch ($field_def['type']) {
case 'text':
@@ -649,12 +645,6 @@
}
break;
case 'blob':
- /*
- if (!preg_match('/^([0-9a-f]{2})*$/i', $field_value)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is not of type
"'.$field_def['type'].'"');
- }
- */
$field_value = pack('H*', $field_value);
if (!empty($field_def['length']) && strlen($field_value) >
$field_def['length']) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,