Esempio n. 1
0
 public function testFulltext()
 {
     $index = new Index(['title', 'alias'], 'title_alias', Index::TYPE_FULLTEXT, 'hash');
     $this->assertEquals('title_alias', $index->getName());
     $this->assertCount(2, $index->getColumns());
     $this->assertEquals('FULLTEXT INDEX', $index->getType());
     $this->assertEquals('USING HASH', $index->getMethod());
     $index = new Index(['title'], 'title', 'FULLTEXT');
     $this->assertEquals('title', $index->getName());
     $this->assertCount(1, $index->getColumns());
     $this->assertEquals('FULLTEXT INDEX', $index->getType());
     $index = new Index(['alias', 'title'], 'alias_title', 'fulltext');
     $this->assertEquals('alias_title', $index->getName());
     $this->assertCount(2, $index->getColumns());
     $this->assertEquals('FULLTEXT INDEX', $index->getType());
 }
Esempio n. 2
0
 private function createIndex(Index $index, Table $table)
 {
     $columns = [];
     foreach ($index->getColumns() as $column) {
         $columns[] = $this->escapeString($table->getColumn($column)->getName());
     }
     $query = 'CREATE ' . $index->getType() . ' ' . $this->escapeString($index->getName()) . ' ON ' . $this->escapeString($table->getName()) . ' (' . implode(',', $columns) . ');';
     return $query;
 }
Esempio n. 3
0
 private function createIndex(Index $index)
 {
     $columns = $this->escapeArray($index->getColumns());
     return $index->getType() . ' ' . $this->escapeString($index->getName()) . ' (' . implode(',', $columns) . ')' . (!$index->getMethod() ? '' : ' ' . $index->getMethod());
 }
Esempio n. 4
0
 private function createIndex(Index $index, Table $table)
 {
     $columns = [];
     foreach ($index->getColumns() as $column) {
         $columns[] = $this->escapeString($column);
     }
     return 'CREATE ' . $index->getType() . ' ' . $this->escapeString($index->getName()) . ' ON ' . $this->escapeString($table->getName()) . (!$index->getMethod() ? '' : ' ' . $index->getMethod()) . ' (' . implode(',', $columns) . ');';
 }