本文整理汇总了PHP中Relationship::BuildQueryStatement方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::BuildQueryStatement方法的具体用法?PHP Relationship::BuildQueryStatement怎么用?PHP Relationship::BuildQueryStatement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::BuildQueryStatement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: QueryCount
/**
* Static Qcodo Query method to query for a count of Relationship objects.
* Uses BuildQueryStatment to perform most of the work.
* @param QQCondition $objConditions any conditions on the query, itself
* @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
* @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
* @return integer the count of queried objects as an integer
*/
public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the Query Statement
try {
$strQuery = Relationship::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
// Perform the Query and return the row_count
$objDbResult = $objQueryBuilder->Database->Query($strQuery);
// Figure out if the query is using GroupBy
$blnGrouped = false;
if ($objOptionalClauses) {
foreach ($objOptionalClauses as $objClause) {
if ($objClause instanceof QQGroupBy) {
$blnGrouped = true;
break;
}
}
}
if ($blnGrouped) {
// Groups in this query - return the count of Groups (which is the count of all rows)
return $objDbResult->CountRows();
} else {
// No Groups - return the sql-calculated count(*) value
$strDbRow = $objDbResult->FetchRow();
return QType::Cast($strDbRow[0], QType::Integer);
}
}