示例#1
0
 private function readIndexes(Table $table)
 {
     $res = $this->database->query("PRAGMA INDEX_LIST (?)", $table->schemaName)->fetchAll();
     $res = array_reverse($res);
     foreach ($res as $indexRow) {
         $cols = $this->database->query("PRAGMA INDEX_INFO (?)", $indexRow['name']);
         $columns = array();
         foreach ($cols as $colRow) {
             $columns[] = $table->getColumn($colRow['name']);
         }
         $index = new Index($columns);
         $index->setType($indexRow['unique'] ? Index::TYPE_UNIQUE : Index::TYPE_KEY);
         $table->addIndex($index);
     }
 }