private function logQuery($strQuery, $dblQueryTime)
    {
        if ($this->blnEnableProfiling) {
            // Dereference-ize Backtrace Information
            $objDebugBacktrace = debug_backtrace();

            // get rid of unnecessary backtrace info in case of:
            // query
            if ((count($objDebugBacktrace) > 3) &&
                (array_key_exists('function', $objDebugBacktrace[2])) &&
                (($objDebugBacktrace[2]['function'] == 'QueryArray') ||
                    ($objDebugBacktrace[2]['function'] == 'QuerySingle') ||
                    ($objDebugBacktrace[2]['function'] == 'QueryCount'))
            ) {
                $objBacktrace = $objDebugBacktrace[3];
            } else {
                if (isset($objDebugBacktrace[2])) // non query
                {
                    $objBacktrace = $objDebugBacktrace[2];
                } else // ad hoc query
                {
                    $objBacktrace = $objDebugBacktrace[1];
                }
            }

            // get rid of reference to current object in backtrace array
            if (isset($objBacktrace['object'])) {
                $objBacktrace['object'] = null;
            }

            for ($intIndex = 0, $intMax = count($objBacktrace['args']); $intIndex < $intMax; $intIndex++) {
                $obj = $objBacktrace['args'][$intIndex];

                if (is_null($obj)) {
                    $obj = 'null';
                } else {
                    if (gettype($obj) == 'integer') {
                    } else {
                        if (gettype($obj) == 'object') {
                            $obj = 'Object: ' . get_class($obj);
                            if (method_exists($obj, '__toString')) {
                                $obj .= '- ' . $obj;
                            }
                        } else {
                            if (is_array($obj)) {
                                $obj = 'Array';
                            } else {
                                $obj = sprintf("'%s'", $obj);
                            }
                        }
                    }
                }
                $objBacktrace['args'][$intIndex] = $obj;
            }

            // Push it onto the profiling information array
            $arrProfile = array(
                'objBacktrace' => $objBacktrace,
                'strQuery' => $strQuery,
                'dblTimeInfo' => $dblQueryTime
            );

            array_push($this->strProfileArray, $arrProfile);
        }
    }