当前位置: 首页>>代码示例>>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;未经允许,请勿转载。