cvs: pear /DB_DataObject/DataObject Generator.php
| From: | Alan Knowles | Date: | Tue, 16 Jan 2007 02:56:16 +0000 |
| Subject: | cvs: pear /DB_DataObject/DataObject Generator.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44240@lists.php.net to get a copy of this message | ||
alan_k Tue Jan 16 02:56:16 2007 UTC
Modified files:
/pear/DB_DataObject/DataObject Generator.php
Log:
Fix Bug #9839 - Invalid column names can not be supported, so warning is generated
http://cvs.php.net/viewvc.cgi/pear/DB_DataObject/DataObject/Generator.php?r1=1.124&r2=1.125&diff_format=u
Index: pear/DB_DataObject/DataObject/Generator.php
diff -u pear/DB_DataObject/DataObject/Generator.php:1.124
pear/DB_DataObject/DataObject/Generator.php:1.125
--- pear/DB_DataObject/DataObject/Generator.php:1.124 Mon Jan 15 07:39:24 2007
+++ pear/DB_DataObject/DataObject/Generator.php Tue Jan 16 02:56:15 2007
@@ -15,7 +15,7 @@
* @author Alan Knowles <alan@akbkhome.com>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Generator.php,v 1.124 2007/01/15 07:39:24 alan_k Exp $
+ * @version CVS: $Id: Generator.php,v 1.125 2007/01/16 02:56:15 alan_k Exp $
* @link http://pear.php.net/package/DB_DataObject
*/
@@ -587,9 +587,19 @@
break;
}
+ if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $t->name))
{
+ echo
"*****************************************************************\n".
+ "** WARNING COLUMN NAME UNUSABLE
**\n".
+ "** Found column '{$t->name}', of type
'{$t->type}' **\n".
+ "** Since this column name can't be converted to a php variable
**\n".
+ "** name, and the whole idea of mapping would result in a mess
**\n".
+ "** This column has been ignored...
**\n".
+
"*****************************************************************\n";
+ continue;
+ }
if (!strlen(trim($t->name))) {
- continue;
+ continue; // is this a bug?
}
if (preg_match('/not[ _]null/i',$t->flags)) {