cvs: pear /MDB2_Schema/MDB2/Schema Parser.php Validate.php
| From: | Igor Feghali | Date: | Mon, 21 Aug 2006 15:39:30 +0000 |
| Subject: | cvs: pear /MDB2_Schema/MDB2/Schema Parser.php Validate.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-41790@lists.php.net to get a copy of this message | ||
ifeghali Mon Aug 21 15:39:30 2006 UTC
Modified files:
/pear/MDB2_Schema/MDB2/Schema Parser.php Validate.php
Log:
- reduced the scope of Validate
http://cvs.php.net/viewvc.cgi/pear/MDB2_Schema/MDB2/Schema/Parser.php?r1=1.47&r2=1.48&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema/Parser.php
diff -u pear/MDB2_Schema/MDB2/Schema/Parser.php:1.47 pear/MDB2_Schema/MDB2/Schema/Parser.php:1.48
--- pear/MDB2_Schema/MDB2/Schema/Parser.php:1.47 Sun Aug 20 20:47:32 2006
+++ pear/MDB2_Schema/MDB2/Schema/Parser.php Mon Aug 21 15:39:30 2006
@@ -42,7 +42,7 @@
// | Author: Christian Dickmann <dickmann@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Parser.php,v 1.47 2006/08/20 20:47:32 lsmith Exp $
+// $Id: Parser.php,v 1.48 2006/08/21 15:39:30 ifeghali Exp $
//
require_once 'XML/Parser.php';
@@ -241,10 +241,7 @@
case 'database-table-initialization-insert':
case 'database-table-initialization-delete':
case 'database-table-initialization-update':
- $result = $this->val->validateDML($this->table, $this->init);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getMessage(), 0, $xp, $result->getCode());
- }
+ $this->table['initialization'][] = $this->init;
break;
/* One level simulation of expression-function recursion */
@@ -268,6 +265,8 @@
$result =
$this->val->validateTable($this->database_definition['tables'], $this->table,
$this->table_name);
if (PEAR::isError($result)) {
$this->raiseError($result->getMessage(), 0, $xp, $result->getCode());
+ } else {
+ $this->database_definition['tables'][$this->table_name] =
$this->table;
}
break;
case 'database-table-name':
@@ -281,6 +280,8 @@
$result = $this->val->validateField($this->table['fields'],
$this->field, $this->field_name);
if (PEAR::isError($result)) {
$this->raiseError($result->getMessage(), 0, $xp, $result->getCode());
+ } else {
+ $this->table['fields'][$this->field_name] = $this->field;
}
break;
@@ -289,6 +290,8 @@
$result = $this->val->validateIndex($this->table['indexes'],
$this->index, $this->index_name);
if (PEAR::isError($result)) {
$this->raiseError($result->getMessage(), 0, $xp, $result->getCode());
+ } else {
+ $this->table['indexes'][$this->index_name] = $this->index;
}
break;
case 'database-table-declaration-index-field':
@@ -305,6 +308,8 @@
$result =
$this->val->validateSequence($this->database_definition['sequences'],
$this->sequence, $this->sequence_name);
if (PEAR::isError($result)) {
$this->raiseError($result->getMessage(), 0, $xp, $result->getCode());
+ } else {
+ $this->database_definition['sequences'][$this->sequence_name] =
$this->sequence;
}
break;
http://cvs.php.net/viewvc.cgi/pear/MDB2_Schema/MDB2/Schema/Validate.php?r1=1.16&r2=1.17&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema/Validate.php
diff -u pear/MDB2_Schema/MDB2/Schema/Validate.php:1.16
pear/MDB2_Schema/MDB2/Schema/Validate.php:1.17
--- pear/MDB2_Schema/MDB2/Schema/Validate.php:1.16 Sun Aug 20 20:47:32 2006
+++ pear/MDB2_Schema/MDB2/Schema/Validate.php Mon Aug 21 15:39:30 2006
@@ -43,7 +43,7 @@
// | Author: Igor Feghali <ifeghali@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Validate.php,v 1.16 2006/08/20 20:47:32 lsmith Exp $
+// $Id: Validate.php,v 1.17 2006/08/21 15:39:30 ifeghali Exp $
//
/**
@@ -142,7 +142,7 @@
/* Definition */
/**
* Checks whether the definition of a parsed table is valid. Modify table
- * definition when necessary. If table is Ok push it onto array of tables.
+ * definition when necessary.
*
* @param array multi dimensional array that contains the
* tables of current database.
@@ -242,7 +242,6 @@
}
}
}
- $tables[$table_name] = $table;
return true;
}
@@ -251,7 +250,7 @@
/**
* Checks whether the definition of a parsed field is valid. Modify field
- * definition when necessary. If field is Ok push it onto array of fields.
+ * definition when necessary.
*
* @param array multi dimensional array that contains the
* fields of current table.
@@ -332,8 +331,6 @@
}
}
- $fields[$field_name] = $field;
-
if (isset($field['default'])
&& !$this->validateDataFieldValue($fields, $field_name,
$fields[$field_name]['default'])
) {
@@ -348,7 +345,7 @@
/**
* Checks whether a parsed index is valid. Modify index definition when
- * necessary. If index is Ok push it onto array of indexes.
+ * necessary.
*
* @param array multi dimensional array that contains the
* indexes of current table.
@@ -382,7 +379,6 @@
if (empty($index['was'])) {
$index['was'] = $index_name;
}
- $table_indexes[$index_name] = $index;
return true;
}
@@ -391,8 +387,7 @@
/**
* Checks whether a parsed index-field is valid. Modify its definition when
- * necessary. If index-field is Ok push it onto array of fields of the
- * current index.
+ * necessary.
*
* @param array multi dimensional array that contains the
* fields of current index.
@@ -430,8 +425,7 @@
/**
* Checks whether the definition of a parsed sequence is valid. Modify
- * sequence definition when necessary. If sequence is Ok push it onto array
- * of sequences of current database.
+ * sequence definition when necessary.
*
* @param array multi dimensional array that contains the
* sequences of current database.
@@ -473,7 +467,6 @@
'sequence "'.$sequence_name.'" was not properly
defined');
}
}
- $sequences[$sequence_name] = $sequence;
return true;
}
@@ -538,8 +531,7 @@
/* Data Manipulation */
/**
* Checks whether a parsed DML-field is valid. Modify its structure when
- * necessary. If DML-field is Ok push it onto fields array of the
- * current DML instruction. This is called when validating INSERT and
+ * necessary. This is called when validating INSERT and
* UPDATE.
*
* @param array multi dimensional array that contains the
@@ -573,29 +565,6 @@
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE_DML_INVALID_FIELD_VALUE,
'field "'.$field_name.'" has wrong value');
}
- $instruction_fields[$field_name] = $value;
- return true;
- }
-
- // }}}
- // {{{ validateDML()
-
- /**
- * Pushes the parsed DML instruction to the initialization array of current
- * table.
- *
- * @param array multi dimensional array that contains the
- * structure and optional data of table.
- * @param array multi dimensional array that contains the
- * data of the current DML instruction.
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateDML(&$table, &$instruction)
- {
- $table['initialization'][] = $instruction;
return true;
}