/** * test select one */ public function test_select_one() { $table = $this->adapter->create_table('users'); $table->column('name', 'string', array('limit' => 20)); $table->column('age', 'integer'); $table->finish(); $id1 = $this->adapter->query(sprintf("INSERT INTO users (name, age) VALUES ('%s', %d) RETURNING \"id\"", 'Taco', 32)); $this->assertEquals(1, $id1); $result = $this->adapter->select_one(sprintf("SELECT * FROM users WHERE name = '%s'", 'Taco')); $this->assertEquals(true, is_array($result)); $this->assertEquals('Taco', $result['name']); $this->assertEquals(32, $result['age']); $this->drop_table('users'); }
/** * Create a table * @param string $table_name the name of the table * @param array|string $options * @return bool|Ruckusing_Adapter_MySQL_TableDefinition|Ruckusing_Adapter_PgSQL_TableDefinition|Ruckusing_Adapter_Sqlite3_TableDefinition */ public function create_table($table_name, $options = array()) { return $this->_adapter->create_table($table_name, $options); }