src/Query/ModelTrait.php
public static function queryCount(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
    {
        // Get the Query Statement
        try {
            $strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
                $mixParameterArray, true);
        } catch (Caller $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) {
            if ($objOptionalClauses instanceof iClause) {
                if ($objOptionalClauses instanceof Clause\GroupBy) {
                    $blnGrouped = true;
                }
            } else {
                if (is_array($objOptionalClauses)) {
                    foreach ($objOptionalClauses as $objClause) {
                        if ($objClause instanceof Clause\GroupBy) {
                            $blnGrouped = true;
                            break;
                        }
                    }
                } else {
                    throw new Caller('Optional Clauses must be a iClause object or an array of iClause objects');
                }
            }
        }

        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 (integer)$strDbRow[0];
        }
    }
public static function queryCount(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
    {
        // Get the Query Statement
        try {
            $strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
                $mixParameterArray, true);
        } catch (Caller $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) {
            if ($objOptionalClauses instanceof iClause) {
                if ($objOptionalClauses instanceof Clause\GroupBy) {
                    $blnGrouped = true;
                }
            } else {
                if (is_array($objOptionalClauses)) {
                    foreach ($objOptionalClauses as $objClause) {
                        if ($objClause instanceof Clause\GroupBy) {
                            $blnGrouped = true;
                            break;
                        }
                    }
                } else {
                    throw new Caller('Optional Clauses must be a iClause object or an array of iClause objects');
                }
            }
        }

        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 (integer)$strDbRow[0];
        }
    }
public static function queryCount ( iCondition $ objConditions , $ objOptionalClauses = null , $ mixParameterArray = null ) { // Get the Query Statement try { $ strQuery = static :: buildQueryStatement ( $ objQueryBuilder , $ objConditions , $ objOptionalClauses , $ mixParameterArray , true ) ; } catch ( Caller $ 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 ) { if ( $ objOptionalClauses instanceof iClause ) { if ( $ objOptionalClauses instanceof Clause \ GroupBy ) { $ blnGrouped = true ; } } else { if ( is_array ( $ objOptionalClauses ) ) { foreach ( $ objOptionalClauses as $ objClause ) { if ( $ objClause instanceof Clause \ GroupBy ) { $ blnGrouped = true ; break ; } } } else { throw new Caller ( 'Optional Clauses must be a iClause object or an array of iClause objects' ) ; } } } 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 ( integer ) $ strDbRow [ 0 ] ; } }
Static Qcubed Query method to query for a count of objects.
Uses BuildQueryStatment to perform most of the work.

@param iCondition $objConditions any conditions on the query, itself
@param iClause[] $objOptionalClauses additional optional iClause 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
@throws Caller
Static Qcubed Query method to query for a count of objects . Uses BuildQueryStatment to perform most of the work .