本文整理汇总了PHP中BasePeer::createSelectSqlPart方法的典型用法代码示例。如果您正苦于以下问题:PHP BasePeer::createSelectSqlPart方法的具体用法?PHP BasePeer::createSelectSqlPart怎么用?PHP BasePeer::createSelectSqlPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasePeer
的用法示例。
在下文中一共展示了BasePeer::createSelectSqlPart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyLimit
/**
* @see DBAdapter::applyLimit()
*/
public function applyLimit(&$sql, $offset, $limit, $criteria = null)
{
if (BasePeer::needsSelectAliases($criteria)) {
$selectSql = BasePeer::createSelectSqlPart($criteria, $params, true);
$sql = $selectSql . substr($sql, strpos('FROM', $sql));
}
$sql = 'SELECT B.* FROM (' . 'SELECT A.*, rownum AS PROPEL_ROWNUM FROM (' . $sql . ') A ' . ') B WHERE ';
if ($offset > 0) {
$sql .= ' B.PROPEL_ROWNUM > ' . $offset;
if ($limit > 0) {
$sql .= ' AND B.PROPEL_ROWNUM <= ' . ($offset + $limit);
}
} else {
$sql .= ' B.PROPEL_ROWNUM <= ' . $limit;
}
}
示例2: testCreateSelectSqlPartAliasAll
public function testCreateSelectSqlPartAliasAll()
{
$c = new Criteria();
$c->addSelectColumn(BookPeer::ID);
$c->addAsColumn('book_ID', BookPeer::ID);
$fromClause = array();
$selectSql = BasePeer::createSelectSqlPart($c, $fromClause, true);
$this->assertEquals('SELECT book.ID AS book_ID_1, book.ID AS book_ID', $selectSql, 'createSelectSqlPart() aliases all columns if passed true as last parameter');
$this->assertEquals(array(), $fromClause, 'createSelectSqlPart() does not add the tables from an all-aliased list of select columns');
}