Zend_Db枚举值

时间:2010-04-01 19:45:24

标签: zend-framework enums zend-db

我找到了这个解决方案

$metadata = $result->getTable()->info('metadata');
echo $metadata['Continent']['DATA_TYPE'];

您好, 我想在Zend_Db中获取枚举值。 我的代码:

$select = $this->select();
$result = $select->fetchAll();
print_r($result->getTable());

输出:

Example Object
(
    [_name] => country
    [query] => Zend_Db_Table_Select Object
        (
            [_info:protected] => Array
                (
                    [schema] => 
                    [name] => country
                    [cols] => Array
                        (
                            [0] => Code
                            [1] => Continent

                        )

                    [primary] => Array
                        (
                            [1] => Code
                        )

                    [metadata] => Array
                        (
                            [Continent] => Array
                                (
                                    [SCHEMA_NAME] => 
                                    [TABLE_NAME] => country
                                    [COLUMN_NAME] => Continent
                                    [COLUMN_POSITION] => 3
                                    [DATA_TYPE] => enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America')
                                    [DEFAULT] => Asia
                                    [NULLABLE] => 
                                    [LENGTH] => 
                                    [SCALE] => 
                                    [PRECISION] => 
                                    [UNSIGNED] => 
                                    [PRIMARY] => 
                                    [PRIMARY_POSITION] => 
                                    [IDENTITY] => 
                                )

我在data_type中看到枚举值,但我没有得到这个值。如何获取data_type?

1 个答案:

答案 0 :(得分:1)

我找到了这个解决方案

   $metadata = $result->getTable()->info('metadata');
    echo $metadata['Continent']['DATA_TYPE'];