/** * @param mixed[] $bindings Column names and values of the entry. * @return mixed[] Promise results with affected row count. * See Database->query(). */ public function create($bindings = array()) { $lists = ConvertArray::toQueryLists($bindings); return $this->db->query("INSERT INTO {$this->table} ({$lists['columns']})\n VALUES ({$lists['bindings']})", ConvertArray::addPrefixToKeys($bindings)); }
public function testToQueryLists() { $lists = ConvertArray::toQueryLists($this->assocArray); $this->assertEquals($lists['columns'], 'a, b, c'); $this->assertEquals($lists['bindings'], ':a, :b, :c'); }