當前位置: 首頁>>代碼示例>>PHP>>正文


PHP QueryBuilder::insert方法代碼示例

本文整理匯總了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');
 }
開發者ID:dachcom-digital,項目名稱:TYPO3.CMS,代碼行數:9,代碼來源:QueryBuilderTest.php

示例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();
 }
開發者ID:anthonypelletier,項目名稱:RPI-CallFilter-Web,代碼行數:6,代碼來源:UserModel.php

示例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();
 }
開發者ID:anthonypelletier,項目名稱:RPI-CallFilter-Web,代碼行數:6,代碼來源:NumberModel.php

示例4: testEmptyInsert

 public function testEmptyInsert()
 {
     $qb = new QueryBuilder($this->conn);
     $qb2 = $qb->insert();
     $this->assertEquals(QueryBuilder::INSERT, $qb->getType());
     $this->assertSame($qb2, $qb);
 }
開發者ID:TheTypoMaster,項目名稱:SPHERE-Framework,代碼行數:7,代碼來源:QueryBuilderTest.php

示例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;
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:25,代碼來源:QueryBuilder.php

示例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();
 }
開發者ID:anthonypelletier,項目名稱:RPI-CallFilter-Web,代碼行數:6,代碼來源:CommandesModel.php

示例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;
 }
開發者ID:henkRW,項目名稱:core,代碼行數:24,代碼來源:querybuilder.php


注:本文中的Doctrine\DBAL\Query\QueryBuilder::insert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。