当前位置: 首页>>代码示例>>PHP>>正文


PHP SQLQuery::getLimit方法代码示例

本文整理汇总了PHP中SQLQuery::getLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQuery::getLimit方法的具体用法?PHP SQLQuery::getLimit怎么用?PHP SQLQuery::getLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLQuery的用法示例。


在下文中一共展示了SQLQuery::getLimit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLimitSetFromClauseString

 /**
  * Test passing in a LIMIT with OFFSET clause string.
  */
 public function testLimitSetFromClauseString()
 {
     $query = new SQLQuery();
     $query->setSelect('*');
     $query->setFrom('"SQLQueryTest_DO"');
     $query->setLimit('20 OFFSET 10');
     $limit = $query->getLimit();
     $this->assertEquals(20, $limit['limit']);
     $this->assertEquals(10, $limit['start']);
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:13,代码来源:SQLQueryTest.php

示例2: sqlQueryToString

 /**
  * Convert a SQLQuery object into a SQL statement
  * @param $query SQLQuery
  */
 public function sqlQueryToString(SQLQuery $query)
 {
     if ($query->getDelete()) {
         $text = 'DELETE ';
     } else {
         $text = $this->sqlSelectToString($query->getSelect(), $query->getDistinct());
     }
     if ($query->getFrom()) {
         $text .= $this->sqlFromToString($query->getFrom());
     }
     if ($query->getWhere()) {
         $text .= $this->sqlWhereToString($query->getWhere(), $query->getConnective());
     }
     // these clauses only make sense in SELECT queries, not DELETE
     if (!$query->getDelete()) {
         if ($query->getGroupBy()) {
             $text .= $this->sqlGroupByToString($query->getGroupBy());
         }
         if ($query->getHaving()) {
             $text .= $this->sqlHavingToString($query->getHaving());
         }
         if ($query->getOrderBy()) {
             $text .= $this->sqlOrderByToString($query->getOrderBy());
         }
         if ($query->getLimit()) {
             $text .= $this->sqlLimitToString($query->getLimit());
         }
     }
     return $text;
 }
开发者ID:nzjoel,项目名称:sapphire,代码行数:34,代码来源:Database.php

示例3: setPaginationFromQuery

 /**
  * Sets the page length, page start and total items from a query object's
  * limit, offset and unlimited count. The query MUST have a limit clause.
  *
  * @param SQLQuery $query
  */
 public function setPaginationFromQuery(SQLQuery $query)
 {
     if ($limit = $query->getLimit()) {
         $this->setPageLength($limit['limit']);
         $this->setPageStart($limit['start']);
         $this->setTotalItems($query->unlimitedRowCount());
     }
     return $this;
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:15,代码来源:PaginatedList.php

示例4: sqlQueryToString

 /**
  * Convert a SQLQuery object into a SQL statement
  * Caution: Expects correctly quoted and escaped SQL fragments.
  * 
  * @param $query SQLQuery
  */
 public function sqlQueryToString(SQLQuery $query)
 {
     if ($query->getDelete()) {
         //Appended space at the end of string causing an issue but this might not be the best solution
         //@see sqlSelectToString() sqlFromToString
         $text = 'DELETE';
     } else {
         if ($traverse = $query->getTraverse()) {
             //Build the traverse string here
             $text = $this->sqlTraverseToString($traverse);
         } else {
             $text = $this->sqlSelectToString($query->getSelect(), $query->getDistinct());
         }
     }
     if ($query->getFrom()) {
         $text .= $this->sqlFromToString($query->getFrom());
     }
     if ($query->getWhere()) {
         $text .= $this->sqlWhereToString($query->getWhere(), $query->getConnective());
     }
     // these clauses only make sense in SELECT queries, not DELETE
     if (!$query->getDelete()) {
         if ($query->getGroupBy()) {
             $text .= $this->sqlGroupByToString($query->getGroupBy());
         }
         if ($query->getHaving()) {
             $text .= $this->sqlHavingToString($query->getHaving());
         }
         if ($query->getOrderBy()) {
             $text .= $this->sqlOrderByToString($query->getOrderBy());
         }
         if ($query->getLimit()) {
             $text .= $this->sqlLimitToString($query->getLimit());
         }
     }
     // SS_Log::log(new Exception(print_r($text, true)), SS_Log::NOTICE);
     return $text;
 }
开发者ID:Cumquat,项目名称:silverstripe-orientdb-poc,代码行数:44,代码来源:OrientDatabase.php


注:本文中的SQLQuery::getLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。