cvs: pear /MDB2_Schema/MDB2 Schema.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Tue, 18 Oct 2005 22:36:18 +0000 |
| Subject: | cvs: pear /MDB2_Schema/MDB2 Schema.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35689@lists.php.net to get a copy of this message | ||
dufuz Tue Oct 18 18:36:18 2005 EDT
Modified files:
/pear/MDB2_Schema/MDB2 Schema.php
Log:
Forgot to unset the index when it's suppose to be skipped, now it doesn't show up in the
final database defintion.
http://cvs.php.net/diff.php/pear/MDB2_Schema/MDB2/Schema.php?r1=1.40&r2=1.41&ty=u
Index: pear/MDB2_Schema/MDB2/Schema.php
diff -u pear/MDB2_Schema/MDB2/Schema.php:1.40 pear/MDB2_Schema/MDB2/Schema.php:1.41
--- pear/MDB2_Schema/MDB2/Schema.php:1.40 Fri Oct 14 19:09:03 2005
+++ pear/MDB2_Schema/MDB2/Schema.php Tue Oct 18 18:36:13 2005
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Schema.php,v 1.40 2005/10/14 23:09:03 lsmith Exp $
+// $Id: Schema.php,v 1.41 2005/10/18 22:36:13 dufuz Exp $
//
require_once 'MDB2.php';
@@ -90,7 +90,7 @@
var $database_definition = array(
'name' => '',
- 'create' => 0,
+ 'create' => false,
'tables' => array()
);
@@ -251,6 +251,7 @@
if (PEAR::isError($db)) {
return $db;
}
+
$this->db =& $db;
$this->db->loadModule('Manager');
$this->db->loadModule('Reverse');
@@ -307,6 +308,7 @@
if (PEAR::isError($result)) {
return $result;
}
+
$result = $parser->parse();
if (PEAR::isError($result)) {
return $result;
@@ -338,7 +340,7 @@
$this->database_definition = array(
'name' => $database,
- 'create' => 1,
+ 'create' => true,
'tables' => array(),
'sequences' => array(),
);
@@ -353,6 +355,7 @@
if (PEAR::isError($fields)) {
return $fields;
}
+
$this->database_definition['tables'][$table_name] =
array('fields' => array());
$table_definition =&
$this->database_definition['tables'][$table_name];
foreach ($fields as $field_name) {
@@ -360,6 +363,7 @@
if (PEAR::isError($definition)) {
return $definition;
}
+
$table_definition['fields'][$field_name] = $definition[0];
$field_choices = count($definition);
if ($field_choices > 1) {
@@ -379,6 +383,7 @@
if (PEAR::isError($indexes)) {
return $indexes;
}
+
if (is_array($indexes) && !empty($indexes)
&& !array_key_exists('indexes', $table_definition)
) {
@@ -416,6 +421,7 @@
if (PEAR::isError($sequences)) {
return $sequences;
}
+
if (is_array($sequences) && !empty($sequences)) {
foreach ($sequences as $sequence_name) {
$definition = $this->db->reverse->getSequenceDefinition($sequence_name);
@@ -601,6 +607,7 @@
if (PEAR::isError($stmt)) {
return $stmt;
}
+
foreach ($table['initialization'] as $instruction) {
switch ($instruction['type']) {
case 'insert':
@@ -609,6 +616,7 @@
if (PEAR::isError($result)) {
return $result;
}
+
$result = $stmt->execute();
if (PEAR::isError($result)) {
return $result;
@@ -1840,6 +1848,7 @@
}
}
}
+
if (array_key_exists('sequences', $structure) &&
is_array($structure['sequences'])) {
foreach ($structure['sequences'] as $sequence_name => $sequence) {
if (isset($data['sequences'][$sequence_name])
@@ -2077,9 +2086,6 @@
*/
class MDB2_Schema_Error extends PEAR_Error
{
- // }}}
- // {{{ constructor
-
/**
* MDB2_Schema_Error constructor.
*