Re: DB_DataObject Generator creates PHP syntax breaking code
| From: | Simon Brüchner | Date: | Mon, 15 Jan 2007 12:30:00 +0000 |
| Subject: | Re: DB_DataObject Generator creates PHP syntax breaking code | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-26344@lists.php.net to get a copy of this message | ||
I opend a bug for this problem at http://pear.php.net/bugs/bug.php?id=9839
--
http://www.kolchose.org/simon/ajaximagemapcreator/
----- Original Message -----
From: "Justin Patrin" <@gmail.com>
To: "Alan Knowles" <@akbkhome.com>
Cc: <@lists.php.net>; "David Sanders" <@baselinesolutions.com.au>
Sent: Monday, January 15, 2007 4:30 AM
Subject: Re: [PEAR] DB_DataObject Generator creates PHP syntax breaking code
> On 1/14/07, Alan Knowles <@akbkhome.com> wrote:
> > Yes, this needs to be filed as a bug - it should raise an error on the
> > generator.
> >
> > Re-writing column names at runtime, strikes me as a bit of a performance
> > hit, so I dont think implementing support for this is a good idea.
>
> True, but not allowing them seems bad too. DB_DO_FB already done some
> column/table rewriting itself to support this kind of thing.
>
> >
> > (I'm on digest for pear.general - so It may be a day or two before I
> > reply on some stuff)
> >
> > Regards
> > Alan
> >
> > David Sanders wrote:
> > > Yeah I avoid anything that is invalid for a php variable in my column
> > > names. The regular expression for a variable name is:
> > >
> > > ^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$
> > >
> > >
> > > The generator could perhaps flag an error if it fails this regular
> > > expression or even just replace bad characters with an underscore
(which
> > > could possibly lead to duplicated column names if people were silly
> > > enough to have "E-Mail" and "E_Mail" in the same table)
> > >
> > > Does Alan read this list?
> > >
> > > Justin Patrin wrote:
> > >> On 1/10/07, Simon <@tattoomachines.de> wrote:
> > >>> I'm using a MSSql (I have to) server witch has colum names like
> > >>> "E-Mail" oder "EG Number".
> > >>>
> > >>> The Generator creates my DataObject-files with contents like this:
> > >>> ...
> > >>> public $Telefax; // varchar(25)
> > >>> public $E-Mail; // varchar(60)
> > >>> public $Internet; // varchar(60)
> > >>> public $EG Number; // varchar(30)
> > >>> ...
> > >>>
> > >>> This breaks the PHP syntax of variable names. Because it uses "-"
and
> > >>> " "!
> > >>> How can I prevent this or working arround, there are only a few
> > >>> "wrong" variables.
> > >>
> > >> Well, I suggest not using those kind of column name sint he first
> > >> place. but DB_DO should be able to handle this. Are you using the
> > >> newest version fo DB_DataObject?
> > >>
> > >
> > >
> >
> > --
> > PEAR General Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Justin Patrin
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>