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


PHP SelectQuery::prepare方法代碼示例

本文整理匯總了PHP中eZ\Publish\Core\Persistence\Database\SelectQuery::prepare方法的典型用法代碼示例。如果您正苦於以下問題:PHP SelectQuery::prepare方法的具體用法?PHP SelectQuery::prepare怎麽用?PHP SelectQuery::prepare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZ\Publish\Core\Persistence\Database\SelectQuery的用法示例。


在下文中一共展示了SelectQuery::prepare方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: listVersionsHelper

 /**
  * Helper for {@see listVersions()} and {@see listVersionsForUser()} that filters duplicates
  * that are the result of the cartesian product performed by createVersionInfoFindQuery().
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  *
  * @return string[][]
  */
 private function listVersionsHelper(SelectQuery $query)
 {
     $query->orderBy($this->dbHandler->quoteColumn('id', 'ezcontentobject_version'));
     $statement = $query->prepare();
     $statement->execute();
     $results = array();
     $previousId = null;
     foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
         if ($row['ezcontentobject_version_id'] == $previousId) {
             continue;
         }
         $previousId = $row['ezcontentobject_version_id'];
         $results[] = $row;
     }
     return $results;
 }
開發者ID:emodric,項目名稱:ezpublish-kernel,代碼行數:24,代碼來源:DoctrineDatabase.php

示例2: assertQueryResult

 /**
  * Assert query result as correct.
  *
  * Builds text representations of the asserted and fetched query result,
  * based on a eZ\Publish\Core\Persistence\Database\SelectQuery object. Compares them using classic diff for
  * maximum readability of the differences between expectations and real
  * results.
  *
  * The expectation MUST be passed as a two dimensional array containing
  * rows of columns.
  *
  * @param array $expectation
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param string $message
  */
 public static function assertQueryResult(array $expectation, SelectQuery $query, $message = null)
 {
     $statement = $query->prepare();
     $statement->execute();
     $result = array();
     while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
         $result[] = $row;
     }
     return self::assertEquals(self::getResultTextRepresentation($expectation), self::getResultTextRepresentation($result), $message);
 }
開發者ID:ezsystems,項目名稱:ezpublish-kernel,代碼行數:25,代碼來源:TestCase.php

示例3: loadData

 /**
  * Loads field data for given $pass.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param int $bulkCount
  * @param int $pass
  *
  * @return array
  */
 protected function loadData(SelectQuery $query, $bulkCount, $pass)
 {
     $query->limit($bulkCount, $pass * $bulkCount);
     $stmt = $query->prepare();
     $stmt->execute();
     return $stmt->fetchAll(PDO::FETCH_ASSOC);
 }
開發者ID:nlescure,項目名稱:ezpublish-kernel,代碼行數:16,代碼來源:UpdateSortKeysCommand.php


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