/** * Clear data from the query or a specific clause of the query. * * @param string $clause Optionally, the name of the clause to clear, or nothing to clear the whole query. * * @return PgsqlQuery Returns this object to allow chaining. * * @since __DEPLOY_VERSION__ */ public function clear($clause = null) { switch ($clause) { case null: $this->bounded = array(); break; } return parent::clear($clause); }
/** * Test for INSERT INTO clause with subquery. * * @return void * * @since 1.0 */ public function test__toStringInsert_subquery() { $q = new PostgresqlQuery($this->dbo); $subq = new PostgresqlQuery($this->dbo); $subq->select('col2')->where('a=1'); $q->insert('table')->columns('col')->values($subq); $this->assertThat((string) $q, $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col)" . PHP_EOL . "(" . PHP_EOL . "SELECT col2" . PHP_EOL . "WHERE a=1)")); $q->clear(); $q->insert('table')->columns('col')->values('3'); $this->assertThat((string) $q, $this->equalTo(PHP_EOL . "INSERT INTO table" . PHP_EOL . "(col) VALUES " . PHP_EOL . "(3)")); }