$qb = $conn->createQueryBuilder()
->delete('users', 'u')
->where('u.id = :user_id');
->setParameter(':user_id', 1);
public function deleteNumber($id) { $queryBuilder = new QueryBuilder($this->db); $queryBuilder->delete('numbers')->where('id = :id')->andWhere('user_id = :id_user')->setParameter(':id', $id)->setParameter(':id_user', $this->id_user); return $queryBuilder->execute(); }
/** * @test * @todo: Test with alias */ public function deleteQuotesIdentifierAndDelegatesToConcreteQueryBuilder() { $this->connection->quoteIdentifier('aTable')->shouldBeCalled()->willReturnArgument(0); $this->concreteQueryBuilder->delete(Argument::exact('aTable'), Argument::cetera())->shouldBeCalled()->willReturn($this->subject); $this->subject->delete('aTable'); }
public function testEmptyDelete() { $qb = new QueryBuilder($this->conn); $qb2 = $qb->delete(); $this->assertEquals(QueryBuilder::DELETE, $qb->getType()); $this->assertSame($qb2, $qb); }
/** * Turns the query being built into a bulk delete query that ranges over * a certain table. * * <code> * $qb = $conn->getQueryBuilder() * ->delete('users', 'u') * ->where('u.id = :user_id'); * ->setParameter(':user_id', 1); * </code> * * @param string $delete The table whose rows are subject to the deletion. * @param string $alias The table alias used in the constructed query. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. */ public function delete($delete = null, $alias = null) { $this->queryBuilder->delete($this->getTableName($delete), $alias); return $this; }
/** * Turns the query being built into a bulk delete query that ranges over * a certain table. * * @param string $delete The table whose rows are subject to the deletion. * Will be quoted according to database platform automatically. * @param string $alias The table alias used in the constructed query. * Will be quoted according to database platform automatically. * * @return QueryBuilder This QueryBuilder instance. */ public function delete(string $delete, string $alias = null) : QueryBuilder { $this->concreteQueryBuilder->delete($this->quoteIdentifier($delete), empty($alias) ? $alias : $this->quoteIdentifier($alias)); return $this; }
public function delete() { return parent::delete($this->model->tableName())->execute(); }
/** * Turns the query being built into a bulk delete query that ranges over * a certain table. * * @param string $delete The table whose rows are subject to the deletion. * @param string $alias The table alias used in the constructed query. * * @return self */ public function delete($delete = null, $alias = null) { $this->qb->delete($delete, $alias); return $this; }
/** * Turns the query being built into a bulk delete query that ranges over * a certain table. * * <code> * $qb = $conn->getQueryBuilder() * ->delete('users', 'u') * ->where('u.id = :user_id'); * ->setParameter(':user_id', 1); * </code> * * @param string $delete The table whose rows are subject to the deletion. * @param string $alias The table alias used in the constructed query. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. */ public function delete($delete = null, $alias = null) { $this->queryBuilder->delete($this->helper->quoteColumnName($delete), $alias); return $this; }