cvs: pear /MDB2_Schema/MDB2/Schema Parser.php Validate.php
| From: | Lukas Smith | Date: | Wed, 30 Aug 2006 16:52:40 +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-41923@lists.php.net to get a copy of this message | ||
lsmith Wed Aug 30 16:52:40 2006 UTC
Modified files:
/pear/MDB2_Schema/MDB2/Schema Parser.php Validate.php
Log:
- removed unnecessary pass by ref
http://cvs.php.net/viewvc.cgi/pear/MDB2_Schema/MDB2/Schema/Parser.php?r1=1.50&r2=1.51&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema/Parser.php
diff -u pear/MDB2_Schema/MDB2/Schema/Parser.php:1.50 pear/MDB2_Schema/MDB2/Schema/Parser.php:1.51
--- pear/MDB2_Schema/MDB2/Schema/Parser.php:1.50 Tue Aug 22 07:32:15 2006
+++ pear/MDB2_Schema/MDB2/Schema/Parser.php Wed Aug 30 16:52:40 2006
@@ -42,7 +42,7 @@
// | Author: Christian Dickmann <dickmann@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Parser.php,v 1.50 2006/08/22 07:32:15 lsmith Exp $
+// $Id: Parser.php,v 1.51 2006/08/30 16:52:40 lsmith Exp $
//
require_once 'XML/Parser.php';
@@ -62,7 +62,7 @@
*/
class MDB2_Schema_Parser extends XML_Parser
{
- var $database_definition = array();
+ var $database_definition = array('tables' => array(), 'sequences' =>
array());
var $elements = array();
var $element = '';
var $count = 0;
http://cvs.php.net/viewvc.cgi/pear/MDB2_Schema/MDB2/Schema/Validate.php?r1=1.24&r2=1.25&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema/Validate.php
diff -u pear/MDB2_Schema/MDB2/Schema/Validate.php:1.24
pear/MDB2_Schema/MDB2/Schema/Validate.php:1.25
--- pear/MDB2_Schema/MDB2/Schema/Validate.php:1.24 Tue Aug 29 17:15:21 2006
+++ pear/MDB2_Schema/MDB2/Schema/Validate.php Wed Aug 30 16:52:40 2006
@@ -43,7 +43,7 @@
// | Author: Igor Feghali <ifeghali@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Validate.php,v 1.24 2006/08/29 17:15:21 lsmith Exp $
+// $Id: Validate.php,v 1.25 2006/08/30 16:52:40 lsmith Exp $
//
/**
@@ -159,7 +159,7 @@
*
* @access public
*/
- function validateTable(&$tables, &$table, $table_name)
+ function validateTable($tables, &$table, $table_name)
{
/* Have we got a name? */
if (!$table_name) {
@@ -168,7 +168,7 @@
}
/* Table name duplicated? */
- if (isset($tables[$table_name])) {
+ if (is_array($tables) && isset($tables[$table_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'table "'.$table_name.'" already exists');
}
@@ -270,7 +270,7 @@
*
* @access public
*/
- function validateField(&$fields, &$field, $field_name)
+ function validateField($fields, &$field, $field_name)
{
/* Have we got a name? */
if (!$field_name) {
@@ -279,7 +279,7 @@
}
/* Field name duplicated? */
- if (isset($fields[$field_name])) {
+ if (is_array($fields) && isset($fields[$field_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'field "'.$field_name.'" already exists');
}
@@ -394,13 +394,13 @@
*
* @access public
*/
- function validateIndex(&$table_indexes, &$index, $index_name)
+ function validateIndex($table_indexes, &$index, $index_name)
{
if (!$index_name) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'an index has to have a name');
}
- if (isset($table_indexes[$index_name])) {
+ if (is_array($table_indexes) && isset($table_indexes[$index_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'index "'.$index_name.'" already exists');
}
@@ -436,9 +436,9 @@
*
* @access public
*/
- function validateIndexField(&$index_fields, &$field, $field_name)
+ function validateIndexField($index_fields, &$field, $field_name)
{
- if (isset($index_fields[$field_name])) {
+ if (is_array($index_fields) && isset($index_fields[$field_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'index field "'.$field_name.'" already exists');
}
@@ -472,14 +472,14 @@
*
* @access public
*/
- function validateSequence(&$sequences, &$sequence, $sequence_name)
+ function validateSequence($sequences, &$sequence, $sequence_name)
{
if (!$sequence_name) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'a sequence has to have a name');
}
- if (isset($sequences[$sequence_name])) {
+ if (is_array($sequences) && isset($sequences[$sequence_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'sequence "'.$sequence_name.'" already exists');
}
@@ -524,7 +524,7 @@
function validateDatabase(&$database)
{
/* Have we got a name? */
- if (!isset($database['name']) || !$database['name']) {
+ if (!is_array($database) || !isset($database['name']) ||
!$database['name']) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'a database has to have a name');
}
@@ -593,17 +593,17 @@
*
* @access public
*/
- function validateDataField(&$table_fields, &$instruction_fields, $field_name, $value)
+ function validateDataField($table_fields, $instruction_fields, $field_name, $value)
{
if (!$field_name) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'field-name has to be specified');
}
- if (isset($instruction_fields[$field_name])) {
+ if (is_array($instruction_fields) && isset($instruction_fields[$field_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'field "'.$field_name.'" already filled');
}
- if (!isset($table_fields[$field_name])) {
+ if (is_array($table_fields) && !isset($table_fields[$field_name])) {
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
'"'.$field_name.'" is not defined');
}