コード例 #1
0
ファイル: AdapterTest.php プロジェクト: azema/phigrate
 /**
  */
 public function testIdentifier()
 {
     $tableName = 'test';
     $expected = '`' . $tableName . '`';
     $actual = $this->object->identifier($tableName);
     $this->assertEquals($expected, $actual);
 }
コード例 #2
0
ファイル: TableDefinition.php プロジェクト: azema/phigrate
 /**
  * init sql
  *
  * @param string $name    The table name
  * @param array  $options The options definition of the table
  *
  * @return void
  */
 protected function _initSql($name, $options = array())
 {
     if (!is_array($options)) {
         $options = array();
     }
     //are we forcing table creation? If so, drop it first
     if (array_key_exists('force', $options) && $options['force'] == true) {
         $this->_adapter->dropTable($name);
     }
     $temp = '';
     if (array_key_exists('temporary', $options)) {
         $temp = ' TEMPORARY';
     }
     $create_sql = sprintf('CREATE%s TABLE ', $temp);
     $create_sql .= sprintf("%s (\n", $this->_adapter->identifier($name));
     $this->_sql .= $create_sql;
     $this->_initialized = true;
 }