Re: Getting possible ENUM values through DB_DataObject

From: Date: Mon, 28 Nov 2005 19:06:17 +0000
Subject: Re: Getting possible ENUM values through DB_DataObject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22095@lists.php.net to get a copy of this message
On 11/27/05, Phil Gyford <gyford@gmail.com> wrote: > Searching the archive, I came across this exchange from last year: > > Alan Knowles wrote: > > Mike Zornek wrote: > > > Also, if a column is of type enum, is there any way to get an array of > the > > > possible allowed values? > > AFAIK there is no reliable way to get enum data from the database > > backend. - I normally just create a method in the extended class and let > > that sort it out. > > I've been trying to do this without any luck: > > function getEnum ($colname) > { > $this->query("SHOW COLUMNS FROM " . $this->__table . " LIKE > '" . > $this->escape($colname) . "'"); > // ... > } > > I'm planning to parse the result to extract the valid ENUM values. But I > can't see how to access the result of the query to begin with! How do I > access the results of a DB_DataObject::query() when it's not a SELECT that > puts data into the object's variables? > There's a DB_DO_FormBuilder function which does this. http://cvs.php.net/co.php/pear/DB_DataObject_FormBuilder/FormBuilder.php?r=1.213#981 -- Justin Patrin

« previous php.pear.general (#22095) next »