RE: [PEAR] Re: DataObjects: how to manage SET type ?
| From: | ThE PhP_KiD | Date: | Sat, 22 Mar 2003 19:23:02 +0000 |
| Subject: | RE: [PEAR] Re: DataObjects: how to manage SET type ? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-4377@lists.php.net to get a copy of this message | ||
OK!
thanks Alan.
I understand how to manage it with 'whereAdd()' DataObjects
method.
But, in order to make it more easy, I think that I will use
Boolean field to active/desactive data by each member of SET,
on MySQL instead use SET type.
Example:
PERMISSIONS are a SET field with ("add,delete,edit,make_report")
now, I can replace it with put an BOOLEAN field by each
member of set.
permisions_add : boolean
permisions_delete : boolean
permisions_edit : boolean
permisions_make_report : boolean
This solucion is more annoying that use SET type, but
allow make things more easy on DataObjects. (I think...)
Regards,
Andres
-> -----Mensaje original-----
-> De: Alan Knowles [mailto:alan@akbkhome.com]
-> Enviado el: Jueves, 20 de Marzo de 2003 21:53
-> Para: pear-general@lists.php.net; The Php_kid
-> CC: 'PEAR'
-> Asunto: [PEAR] Re: DataObjects: how to manage SET type ?
->
->
-> The Php_kid wrote:
-> > Hi friends,
-> >
-> > I've read DataObjects package and really it's
-> > very useful...!
-> >
-> > Now, I've a question ...
-> >
-> > How DataObjects manage a SET column type?
-> > how to access or set it ?
-> from the mysql manual it works pretty much like a string as far as
-> setting/fetching goes.
->
-> and how to ask to
-> > DataObject class if something value is on SET
-> > or not ?
->
-> ATM no, the long term aim is to use a richer data definition file
-> (although even MDB's schema doesnt support this by the looks of it.)
->
-> For the time being, the best way to do it is just create an additional
-> method in the extended dataobject - eg.
->
-> getSetsMyCol() { return array( 'a','b','c','d' ); }
->
->
-> >
-> > Of course, I would use FIND_IN_SET mysql funcion with
-> > query() method, but I don't want put SQL sentences
-> > on Class code.
-> >
-> > There is a DataObjects method to do it ?
->
-> just use whereAdd - If you use it alot - create a method in the extended
-> dataobject to build the whereAdd..
->
->
-> Regards
-> Alan
->
->
-> >
-> >
-> > Regards
-> >
-> > Mac
-> > ...The PHP_Kid.
-> >
-> > "Hey Einstein!... There is a easier way to do it."
-> > (Rasmus Ledorf)
->
->
-> --
-> PEAR General Mailing List (http://pear.php.net/)
-> To unsubscribe, visit: http://www.php.net/unsub.php
->