cvs: pear /MDB2_Schema/MDB2/Schema Writer.php
| From: | Igor Feghali | Date: | Fri, 13 Oct 2006 20:56:58 +0000 |
| Subject: | cvs: pear /MDB2_Schema/MDB2/Schema Writer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42530@lists.php.net to get a copy of this message | ||
ifeghali Fri Oct 13 20:56:58 2006 UTC
Modified files:
/pear/MDB2_Schema/MDB2/Schema Writer.php
Log:
- returning an error when fopen() fails
- fixed error codes
http://cvs.php.net/viewvc.cgi/pear/MDB2_Schema/MDB2/Schema/Writer.php?r1=1.32&r2=1.33&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema/Writer.php
diff -u pear/MDB2_Schema/MDB2/Schema/Writer.php:1.32 pear/MDB2_Schema/MDB2/Schema/Writer.php:1.33
--- pear/MDB2_Schema/MDB2/Schema/Writer.php:1.32 Mon Aug 21 02:05:15 2006
+++ pear/MDB2_Schema/MDB2/Schema/Writer.php Fri Oct 13 20:56:58 2006
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Writer.php,v 1.32 2006/08/21 02:05:15 ifeghali Exp $
+// $Id: Writer.php,v 1.33 2006/10/13 20:56:58 ifeghali Exp $
//
/**
@@ -236,15 +236,20 @@
if (!empty($arguments['output'])) {
if (!empty($arguments['output_mode']) &&
$arguments['output_mode'] == 'file') {
$fp = fopen($arguments['output'], 'w');
+ if ($fp === false) {
+ return $this->raiseError(MDB2_SCHEMA_ERROR_WRITER, null, null,
+ 'it was not possible to open output file');
+ }
+
$output = false;
} elseif (is_callable($arguments['output'])) {
$output = $arguments['output'];
} else {
- return $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
+ return $this->raiseError(MDB2_SCHEMA_ERROR_WRITER, null, null,
'no valid output function specified');
}
} else {
- return $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
+ return $this->raiseError(MDB2_SCHEMA_ERROR_WRITER, null, null,
'no output method specified');
}
@@ -279,7 +284,7 @@
if (!empty($table['fields']) &&
is_array($table['fields'])) {
foreach ($table['fields'] as $field_name => $field) {
if (empty($field['type'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
+ return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE, null, null,
'it was not specified the type of the field "'.
$field_name.'" of the table
"'.$table_name);
}