Getting possible ENUM values through DB_DataObject
| From: | Phil Gyford | Date: | Sun, 27 Nov 2005 13:38:47 +0000 |
| Subject: | Getting possible ENUM values through DB_DataObject | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-22087@lists.php.net to get a copy of this message | ||
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?
Thanks,
Phil