本文整理汇总了PHP中Doctrine\DBAL\Query\QueryBuilder::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::insert方法的具体用法?PHP QueryBuilder::insert怎么用?PHP QueryBuilder::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Query\QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::insert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertQuotesIdentifierAndDelegatesToConcreteQueryBuilder
/**
* @test
*/
public function insertQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
{
$this->connection->quoteIdentifier('aTable')->shouldBeCalled()->willReturnArgument(0);
$this->concreteQueryBuilder->insert(Argument::exact('aTable'))->shouldBeCalled()->willReturn($this->subject);
$this->subject->insert('aTable');
}
示例2: addUser
public function addUser($data)
{
$queryBuilder = new QueryBuilder($this->db);
$queryBuilder->insert('users')->values(['email' => '?', 'password' => '?', 'key_activation' => '?'])->setParameter(0, $data['email'])->setParameter(1, $this->_hashPassword($data['password']))->setParameter(2, bin2hex(openssl_random_pseudo_bytes(10)));
return $queryBuilder->execute();
}
示例3: addNumber
public function addNumber($data)
{
$queryBuilder = new QueryBuilder($this->db);
$queryBuilder->insert('numbers')->values(['user_id' => '?', 'number' => '?'])->setParameter(0, $this->id_user)->setParameter(1, $data['number']);
return $queryBuilder->execute();
}
示例4: testEmptyInsert
public function testEmptyInsert()
{
$qb = new QueryBuilder($this->conn);
$qb2 = $qb->insert();
$this->assertEquals(QueryBuilder::INSERT, $qb->getType());
$this->assertSame($qb2, $qb);
}
示例5: insert
/**
* Turns the query being built into an insert query that inserts into
* a certain table
*
* <code>
* $qb = $conn->getQueryBuilder()
* ->insert('users')
* ->values(
* array(
* 'name' => '?',
* 'password' => '?'
* )
* );
* </code>
*
* @param string $insert The table into which the rows should be inserted.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
public function insert($insert = null)
{
$this->queryBuilder->insert($this->getTableName($insert));
$this->lastInsertedTable = $insert;
return $this;
}
示例6: addCommande
public function addCommande($data)
{
$queryBuilder = new QueryBuilder($this->db);
$queryBuilder->insert('commandes')->values(['id_etat' => '?', 'user_id' => '?', 'prix' => '?', 'date_achat' => '?'])->setParameter(0, 0)->setParameter(1, $data['id'])->setParameter(2, 23.99)->setParameter(3, date('Y-m-d'));
return $queryBuilder->execute();
}
示例7: insert
/**
* Turns the query being built into an insert query that inserts into
* a certain table
*
* <code>
* $qb = $conn->getQueryBuilder()
* ->insert('users')
* ->values(
* array(
* 'name' => '?',
* 'password' => '?'
* )
* );
* </code>
*
* @param string $insert The table into which the rows should be inserted.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
public function insert($insert = null)
{
$this->queryBuilder->insert($this->helper->quoteColumnName($insert));
return $this;
}