Exemple #1
0
 public function testHstore()
 {
     $this->conn->setConverter(new Hstore(new \pq\Types($this->conn)));
     $row = $this->table->find(["id=" => 3])->current();
     $this->assertEquals(null, $row->prop->get());
     $data = array("foo" => "bar", "a" => 1, "b" => 2);
     $row->prop = $data;
     $row->update();
     $this->assertEquals($data, $row->prop->get());
     $row->prop["a"] = null;
     $row->update();
     $data["a"] = null;
     $this->assertEquals($data, $row->prop->get());
     unset($data["a"], $row->prop["a"]);
     $row->update();
     $this->assertEquals($data, $row->prop->get());
 }
Exemple #2
0
 /**
  * Delete rows from the table
  * @param array $where
  * @param string $returning
  * @return mixed
  */
 function delete(array $where, $returning = null)
 {
     $query = $this->getQueryWriter()->reset();
     $query->write("DELETE FROM", $this->conn->quoteName($this->name));
     $query->write("WHERE")->criteria($where);
     if (strlen($returning)) {
         $query->write("RETURNING", $returning);
     }
     return $this->execute($query);
 }
Exemple #3
0
 protected function tearDown()
 {
     $this->conn->exec(PQ_TEST_TEARDOWN_SQL);
 }