cvs: pear /DB_DataObject/DataObject Generator.php

From: Date: Tue, 16 Jan 2007 02:57:47 +0000
Subject: cvs: pear /DB_DataObject/DataObject Generator.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44241@lists.php.net to get a copy of this message
alan_k Tue Jan 16 02:57:47 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.125&r2=1.126&diff_format=u Index: pear/DB_DataObject/DataObject/Generator.php diff -u pear/DB_DataObject/DataObject/Generator.php:1.125 pear/DB_DataObject/DataObject/Generator.php:1.126 --- pear/DB_DataObject/DataObject/Generator.php:1.125 Tue Jan 16 02:56:15 2007 +++ pear/DB_DataObject/DataObject/Generator.php Tue Jan 16 02:57:47 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.125 2007/01/16 02:56:15 alan_k Exp $ + * @version CVS: $Id: Generator.php,v 1.126 2007/01/16 02:57:47 alan_k Exp $ * @link http://pear.php.net/package/DB_DataObject */ @@ -849,6 +849,18 @@ if (!strlen(trim($t->name))) { continue; } + 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; + } + + $padding = (30 - strlen($t->name)); if ($padding < 2) $padding =2; $p = str_repeat(' ',$padding) ;

« previous php.pear.cvs (#44241) next »