當前位置: 首頁>>代碼示例>>PHP>>正文


PHP YDDebugUtil::getStackTrace方法代碼示例

本文整理匯總了PHP中YDDebugUtil::getStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:PHP YDDebugUtil::getStackTrace方法的具體用法?PHP YDDebugUtil::getStackTrace怎麽用?PHP YDDebugUtil::getStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在YDDebugUtil的用法示例。


在下文中一共展示了YDDebugUtil::getStackTrace方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: str_replace

 /**
  *	This function will connect to the database, execute a query and will return the result handle.
  *
  *	@param $sql	The SQL statement to execute.
  *
  *  @returns    Handle to the result of the query. In case of an error, this function triggers an error.
  *
  *	@internal
  */
 function &_connectAndExec($sql)
 {
     // Add the table prefix
     $sql = str_replace(' #_', ' ' . YDConfig::get('YD_DB_TABLEPREFIX', ''), $sql);
     // Update the language placeholders
     $languageIndex = YDConfig::get('YD_DB_LANGUAGE_INDEX', null);
     if (!is_null($languageIndex)) {
         $sql = str_replace('_@', '_' . $languageIndex, $sql);
     }
     // Connect
     $result = $this->connect();
     // Handle errors
     if (!$result && $this->_failOnError === true) {
         $error = ocierror();
         trigger_error($error['message'], YD_ERROR);
     }
     // Record the start time
     $timer = new YDTimer();
     // Create statement
     $stmt = OCIParse($this->_conn, $sql);
     // Handle errors
     if (!$stmt && $this->_failOnError === true) {
         $error = ocierror($stmt);
         trigger_error($error['message'], YD_ERROR);
     }
     // Execute
     $result = @OCIExecute($stmt);
     // Handle errors
     if ($result === false && $this->_failOnError === true) {
         $error = ocierror($stmt);
         if (!empty($error['sqltext'])) {
             $error['message'] .= ' (SQL: ' . $error['sqltext'] . ')';
         }
         echo '<b>Stacktrace:</b> <pre>' . YDDebugUtil::getStackTrace() . '</pre>';
         echo '<b>SQL Statement:</b> <pre>' . $this->formatSql($sql) . '</pre>';
         trigger_error($error['message'], YD_ERROR);
     }
     // Log the statement
     $this->_logSql($sql, $timer->getElapsed());
     // Return the result
     return $stmt;
 }
開發者ID:BackupTheBerlios,項目名稱:ydframework-svn,代碼行數:51,代碼來源:YDDatabaseDriver_oracle.php

示例2: stackTrace

 /**
  *	This function will print a stack trace.
  *
  *	@static
  */
 function stackTrace()
 {
     if (YDConfig::get('YD_DEBUG') == 1 || YDConfig::get('YD_DEBUG') == 2) {
         $err = 'URI: ' . YD_SELF_URI . YD_CRLF . YDDebugUtil::getStackTrace();
         if (ini_get('display_errors') == 1) {
             echo '<pre>' . YD_CRLF . htmlentities($err) . '</pre>';
         }
         error_log($err, 0);
     }
 }
開發者ID:BackupTheBerlios,項目名稱:ydframework-svn,代碼行數:15,代碼來源:YDUtil.php

示例3: _logSql

 /**
  *  This function will log the SQL statement to the debug log and keep track of the number of queries that were
  *  executed. This will only happen if YD_DEBUG equals 1 or 2
  *
  *  @param $sql         The SQL statement to log.
  *  @param $elapsed     (optional) The time the query needed to be executed.
  *
  *  @internal
  */
 function _logSql($sql, $elapsed = null)
 {
     // Show debugging info if needed
     if (YDConfig::get('YD_DEBUG') == 1 || YDConfig::get('YD_DEBUG') == 2) {
         // Construct the array with the data for the SQL statement
         $data = array('trace' => YDDebugUtil::getStackTrace(), 'sql' => $sql = $this->formatSql($sql), 'time' => $elapsed);
         // Add it to the query log
         array_push($GLOBALS['YD_SQL_QUERY'], $data);
     }
 }
開發者ID:BackupTheBerlios,項目名稱:ydframework-svn,代碼行數:19,代碼來源:YDDatabase.php

示例4: str_replace

 /**
  *	This function will connect to the database, execute a query and will return the result handle.
  *
  *	@param $sql	The SQL statement to execute.
  *
  *	@returns	Handle to the result of the query.
  *
  *	@internal
  */
 function &_connectAndExec($sql)
 {
     // Add the table prefix
     $sql = str_replace(' #_', ' ' . YDConfig::get('YD_DB_TABLEPREFIX', ''), $sql);
     // Update the language placeholders
     $languageIndex = YDConfig::get('YD_DB_LANGUAGE_INDEX', null);
     if (!is_null($languageIndex)) {
         $sql = str_replace('_@', '_' . $languageIndex, $sql);
     }
     // Connect
     $result = $this->connect();
     // Record the start time
     $timer = new YDTimer();
     // Perform the query
     $result = $this->_conn->queryExec($sql);
     // Handle errors
     if ($result === false && $this->_failOnError === true) {
         echo '<b>Stacktrace:</b> <pre>' . YDDebugUtil::getStackTrace() . '</pre>';
         echo '<b>SQL Statement:</b> <pre>' . $this->formatSql($sql) . '</pre>';
         $msg = $this->_conn->errorInfo();
         trigger_error('<b>SQLite error message: </b>' . $msg[2], YD_ERROR);
     }
     // Log the statement
     $this->_logSql($sql, $timer->getElapsed());
     // Return the result
     return $result;
 }
開發者ID:BackupTheBerlios,項目名稱:ydframework-svn,代碼行數:36,代碼來源:YDDatabaseQueryDriver_pdo.php

示例5: str_replace

 /**
  *	This function will connect to the database, execute a query and will return the result handle.
  *
  *	@param $sql	The SQL statement to execute.
  *
  *	@returns	Handle to the result of the query.
  *
  *	@internal
  */
 function &_connectAndExec($sql)
 {
     // Add the table prefix
     $sql = str_replace(' #_', ' ' . YDConfig::get('YD_DB_TABLEPREFIX', ''), $sql);
     // Update the language placeholders
     $languageIndex = YDConfig::get('YD_DB_LANGUAGE_INDEX', null);
     if (!is_null($languageIndex)) {
         $sql = str_replace('_@', '_' . $languageIndex, $sql);
     }
     // Connect to database
     $result = $this->connect();
     // Handle errors
     if (!$result && $this->_failOnError === true) {
         trigger_error($GLOBALS['YD_SQLITE_error'], YD_ERROR);
     }
     // Record the start time
     $timer = new YDTimer();
     // Execute the query
     $result = @sqlite_query($sql, $this->_conn);
     // Handle errors
     if ($result === false && $this->_failOnError === true) {
         echo '<b>Stacktrace:</b> <pre>' . YDDebugUtil::getStackTrace() . '</pre>';
         echo '<b>SQL Statement:</b> <pre>' . $this->formatSql($sql) . '</pre>';
         trigger_error(sqlite_error_string(sqlite_last_error($this->_conn)), YD_ERROR);
     }
     // Log the statement
     $this->_logSql($sql, $timer->getElapsed());
     // Return the result
     return $result;
 }
開發者ID:BackupTheBerlios,項目名稱:ydframework-svn,代碼行數:39,代碼來源:YDDatabaseDriver_sqlite.php

示例6: str_replace

 /**
  *	This function will connect to the database, execute a query and will return the result handle.
  *
  *	@param $sql	The SQL statement to execute.
  *
  *	@returns	Handle to the result of the query.
  *
  *	@internal
  */
 function &_connectAndExec($sql)
 {
     // Add the table prefix
     $sql = str_replace(' #_', ' ' . YDConfig::get('YD_DB_TABLEPREFIX', ''), $sql);
     // Connect
     $result = $this->connect();
     // Handle errors
     if (!$result && $this->_failOnError === true) {
         trigger_error(pg_last_error(), YD_ERROR);
     }
     // Record the start time
     $timer = new YDTimer();
     // Perform the query
     $result = @pg_query($this->_conn, $sql);
     // Handle errors
     if ($result === false && $this->_failOnError === true) {
         echo '<b>Stacktrace:</b> <pre>' . YDDebugUtil::getStackTrace() . '</pre>';
         echo '<b>SQL Statement:</b> <pre>' . $this->formatSql($sql) . '</pre>';
         trigger_error(pg_last_error($this->conn), YD_ERROR);
     }
     // Log the statement
     $this->_logSql($sql, $timer->getElapsed());
     // Return the result
     return $result;
 }
開發者ID:BackupTheBerlios,項目名稱:ydframework-svn,代碼行數:34,代碼來源:YDDatabaseDriver_postgres.php


注:本文中的YDDebugUtil::getStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。