2010-04-01 7 views
1

Je trouve cette solutionZend_Db Enum Valeurs

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

Salut, Je veux obtenir des valeurs enum Zend_Db. Mon code:

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

Sortie:

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] => 
           ) 

Je vois des valeurs ENUM dans data_type mais je ne suis pas ces valeurs. Comment peut-on obtenir data_type?

+0

Vous devez ajouter votre solution comme une réponse, et d'accepter cette réponse. –

Répondre

1

Je trouve cette solution

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