示例#1
0
 public function test_expand()
 {
     $arr1 = array(1, 2, 3, 'color' => 'red', 'shape' => 'circle');
     $arr2 = array(4, 5, 'color' => 'blue', 'height' => '100');
     Core_Arrays::expand($arr1, $arr2);
     $this->assertEquals($arr1, array(1, 2, 3, 'color' => 'red', 'shape' => 'circle', 'height' => '100'));
 }
示例#2
0
文件: Schema.php 项目: techart/tao
 public function create_table($table, $defs)
 {
     Core_Arrays::expand($table, array('mysql_engine' => 'InnoDB', 'mysql_character_set' => 'utf8'));
     $sql = sprintf("CREATE TABLE `%s` (%s)", $table['name'], implode(', ', $defs));
     $sql .= 'ENGINE = ' . $table['mysql_engine'] . ' DEFAULT CHARACTER SET ' . $table['mysql_character_set'];
     if (!empty($table['collation'])) {
         $sql .= ' COLLATE ' . $table['collation'];
     }
     return $sql;
 }