本文整理匯總了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;
}