Beispiel #1
0
 public function getSchema(Connection $connection, $db, $table)
 {
     if (isset($schemaCache["{$connection->getId()}:{$db}:{$table}"])) {
         return $schemaCache["{$connection->getId()}:{$db}:{$table}"];
     }
     $rows = $this->rawQuery($connection, $db, 'SHOW FULL COLUMNS FROM ' . $this->quoteSchema($table));
     $columns = array();
     foreach ($rows as $row) {
         $row = (array) $row;
         $description = (object) array('name' => $row['Field'], 'type' => $row['Type'], 'nullable' => $row['Null'] == 'YES', 'default' => $row['Default'], 'encoding' => $row['Collation'], 'comment' => $row['Comment'], 'isPrimary' => $row['Key'] == 'PRI', 'isIndexed' => $row['Key'] ? true : false, 'auto' => strpos($row['Extra'], 'auto_increment'));
         $columns[] = $description;
     }
     return $schemaCache["{$connection->getId()}:{$db}:{$table}"] = $columns;
 }