cvs: pear /MDB2_Schema/MDB2/Schema Writer.php
| From: | Lukas Smith | Date: | Sun, 26 Mar 2006 09:54:58 +0000 |
| Subject: | cvs: pear /MDB2_Schema/MDB2/Schema Writer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39326@lists.php.net to get a copy of this message | ||
lsmith Sun Mar 26 09:54:58 2006 UTC
Modified files:
/pear/MDB2_Schema/MDB2/Schema Writer.php
Log:
- various typo fixes
http://cvs.php.net/viewcvs.cgi/pear/MDB2_Schema/MDB2/Schema/Writer.php?r1=1.24&r2=1.25&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema/Writer.php
diff -u pear/MDB2_Schema/MDB2/Schema/Writer.php:1.24 pear/MDB2_Schema/MDB2/Schema/Writer.php:1.25
--- pear/MDB2_Schema/MDB2/Schema/Writer.php:1.24 Sun Mar 26 09:03:00 2006
+++ pear/MDB2_Schema/MDB2/Schema/Writer.php Sun Mar 26 09:54:58 2006
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Writer.php,v 1.24 2006/03/26 09:03:00 lsmith Exp $
+// $Id: Writer.php,v 1.25 2006/03/26 09:54:58 lsmith Exp $
//
/**
@@ -187,9 +187,9 @@
if (array_key_exists('on', $sequence_definition)) {
$buffer.= " <on>$eol";
- $buffer.= "
<table>".$sequence_definition['on']['table'].
- "</table>$eol
<field>".$sequence_definition['on']['field'].
- "</field>$eol </on>$eol";
+ $buffer.= "
<table>".$sequence_definition['on']['table'];
+ $buffer.= "</table>$eol
<field>".$sequence_definition['on']['field'];
+ $buffer.= "</field>$eol </on>$eol";
}
$buffer.= " </sequence>$eol";
@@ -255,10 +255,10 @@
}
}
- $buffer.= '<?xml version="1.0" encoding="ISO-8859-1"
?>'.$eol;
+ $buffer = '<?xml version="1.0" encoding="ISO-8859-1"
?>'.$eol;
$buffer.= "<database>$eol$eol
<name>".$database_definition['name']."</name>";
- $buffer.= "$eol
<create>".$this->_dumpBoolean($field['create'])."</create>";
- $buffer.= "$eol
<overwrite>".$this->_dumpBoolean($field['overwrite'])."</overwrite>$eol";
+ $buffer.= "$eol
<create>".$this->_dumpBoolean($database_definition['create'])."</create>";
+ $buffer.= "$eol
<overwrite>".$this->_dumpBoolean($database_definition['overwrite'])."</overwrite>$eol";
if ($output) {
$output($buffer);
@@ -266,10 +266,9 @@
fwrite($fp, $buffer);
}
- $buffer = '';
if (array_key_exists('tables', $database_definition) &&
is_array($database_definition['tables'])) {
foreach ($database_definition['tables'] as $table_name => $table) {
- $buffer.= "$eol <table>$eol$eol
<name>$table_name</name>$eol";
+ $buffer = "$eol <table>$eol$eol
<name>$table_name</name>$eol";
if ($dump == MDB2_SCHEMA_DUMP_ALL || $dump == MDB2_SCHEMA_DUMP_STRUCTURE) {
$buffer.= "$eol <declaration>$eol";
if (array_key_exists('fields', $table) &&
is_array($table['fields'])) {
@@ -279,7 +278,7 @@
'it was not specified the type of the field "'.
$field_name.'" of the table
"'.$table_name);
}
- if (!isset($this->valid_types[$field['type']])) {
+ if (!empty($this->valid_types) &&
!array_key_exists($field['type'], $this->valid_types)) {
return $this->raiseError('type
"'.$field['type'].
'" is not yet supported');
}
@@ -296,7 +295,9 @@
} else {
$buffer.= " <notnull>false</notnull>$eol";
}
- $buffer.= '
<default>'.$this->_escapeSpecialChars($field['default'])."</default>$eol";
+ if (array_key_exists('default', $field)) {
+ $buffer.= '
<default>'.$this->_escapeSpecialChars($field['default'])."</default>$eol";
+ }
if (array_key_exists('autoincrement', $field)) {
$buffer.= " <autoincrement>" .
$field['autoincrement'] ."</autoincrement>$eol";
}
@@ -308,11 +309,11 @@
foreach ($table['indexes'] as $index_name => $index) {
$buffer.= "$eol <index>$eol
<name>$index_name</name>$eol";
if (array_key_exists('unique', $index)) {
- $buffer.= "
<unique>".$this->_dumpBoolean($field['unique'])."</unique>$eol";
+ $buffer.= "
<unique>".$this->_dumpBoolean($index['unique'])."</unique>$eol";
}
if (array_key_exists('primary', $index)) {
- $buffer.= "
<primary>".$this->_dumpBoolean($field['primary'])."</primary>$eol";
+ $buffer.= "
<primary>".$this->_dumpBoolean($index['primary'])."</primary>$eol";
}
foreach ($index['fields'] as $field_name => $field) {
@@ -340,7 +341,7 @@
&& !empty($table['initialization'])
&& is_array($table['initialization'])
) {
- $buffer.= "$eol <initialization>$eol";
+ $buffer = "$eol <initialization>$eol";
foreach ($table['initialization'] as $instruction) {
switch ($instruction['type']) {
case 'insert':
@@ -401,7 +402,7 @@
}
}
- $buffer.= "$eol</database>$eol";
+ $buffer = "$eol</database>$eol";
if ($output) {
$output($buffer);
} else {