本文整理匯總了PHP中BasePeer::populateStmtValues方法的典型用法代碼示例。如果您正苦於以下問題:PHP BasePeer::populateStmtValues方法的具體用法?PHP BasePeer::populateStmtValues怎麽用?PHP BasePeer::populateStmtValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BasePeer
的用法示例。
在下文中一共展示了BasePeer::populateStmtValues方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCountStatement
protected function getCountStatement($con = null)
{
$dbMap = Propel::getDatabaseMap($this->getDbName());
$db = Propel::getDB($this->getDbName());
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
// check that the columns of the main class are already added (if this is the primary ModelCriteria)
if (!$this->hasSelectClause() && !$this->getPrimaryCriteria()) {
$this->addSelfSelectColumns();
}
$needsComplexCount = $this->getGroupByColumns() || $this->getOffset() || $this->getLimit() || $this->getHaving() || in_array(Criteria::DISTINCT, $this->getSelectModifiers());
$con->beginTransaction();
try {
$this->basePreSelect($con);
$params = array();
if ($needsComplexCount) {
if (BasePeer::needsSelectAliases($this)) {
if ($this->getHaving()) {
throw new PropelException('Propel cannot create a COUNT query when using HAVING and duplicate column names in the SELECT part');
}
BasePeer::turnSelectColumnsToAliases($this);
}
$selectSql = BasePeer::createSelectSql($this, $params);
$sql = 'SELECT COUNT(*) FROM (' . $selectSql . ') propelmatch4cnt';
} else {
// Replace SELECT columns with COUNT(*)
$this->clearSelectColumns()->addSelectColumn('COUNT(*)');
$sql = BasePeer::createSelectSql($this, $params);
}
$stmt = $con->prepare($sql);
BasePeer::populateStmtValues($stmt, $params, $dbMap, $db);
$stmt->execute();
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
return $stmt;
}