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


PHP fCore::getDebug方法代碼示例

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


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

示例1: run

 /**
  * Runs a single statement and times it, removes any old unbuffered queries before starting
  * 
  * @param  string|fStatement $statement    The SQL statement or prepared statement to execute
  * @param  string            $result_type  The type of result object to return, fResult or fUnbufferedResult
  * @return fResult|fUnbufferedResult  The result for the query
  */
 private function run($statement, $result_type = NULL, $params = array())
 {
     if ($this->unbuffered_result) {
         $this->unbuffered_result->__destruct();
         $this->unbuffered_result = NULL;
     }
     $start_time = microtime(TRUE);
     if (is_object($statement)) {
         $sql = $statement->getSQL();
     } else {
         $sql = $statement;
     }
     if (!($result = $this->handleTransactionQueries($sql, $result_type))) {
         if ($result_type) {
             $result = new $result_type($this, $this->type == 'mssql' ? $this->schema_info['character_set'] : NULL);
             $result->setSQL($sql);
             if ($result_type == 'fResult') {
                 $this->performQuery($statement, $result, $params);
             } else {
                 $this->performUnbufferedQuery($statement, $result, $params);
             }
         } else {
             $this->perform($statement, $params);
         }
     }
     // Write some debugging info
     $query_time = microtime(TRUE) - $start_time;
     $this->query_time += $query_time;
     if (fCore::getDebug($this->debug)) {
         fCore::debug(self::compose('Query time was %1$s seconds for:%2$s', $query_time, "\n" . $sql), $this->debug);
     }
     if ($this->hook_callbacks['run']) {
         foreach ($this->hook_callbacks['run'] as $callback) {
             $callback_params = array($this, is_object($statement) ? array($statement, $params) : $sql, $query_time, $result);
             call_user_func_array($callback, $callback_params);
         }
     }
     if ($result_type) {
         return $result;
     }
 }
開發者ID:JhunCabas,項目名稱:material-management,代碼行數:48,代碼來源:fDatabase.php

示例2: run

 /**
  * Runs a single statement and times it, removes any old unbuffered queries before starting
  * 
  * @param  string|fStatement $statement    The SQL statement or prepared statement to execute
  * @param  string            $result_type  The type of result object to return, fResult or fUnbufferedResult
  * @return fResult|fUnbufferedResult  The result for the query
  */
 private function run($statement, $result_type = NULL, $params = array())
 {
     if ($this->unbuffered_result) {
         $this->unbuffered_result->__destruct();
         $this->unbuffered_result = NULL;
     }
     $start_time = microtime(TRUE);
     if (is_object($statement)) {
         $sql = $statement->getSQL();
     } else {
         $sql = $statement;
     }
     if (!($result = $this->handleTransactionQueries($sql, $result_type))) {
         if ($result_type) {
             $result = new $result_type($this, $this->type == 'mssql' ? $this->schema_info['character_set'] : NULL);
             $result->setSQL($sql);
             if ($result_type == 'fResult') {
                 $this->performQuery($statement, $result, $params);
             } else {
                 $this->performUnbufferedQuery($statement, $result, $params);
             }
         } else {
             $this->perform($statement, $params);
         }
     }
     // Write some debugging info
     $query_time = microtime(TRUE) - $start_time;
     $this->query_time += $query_time;
     if (fCore::getDebug($this->debug)) {
         fCore::debug(self::compose('Query time was %1$s seconds for:%2$s', $query_time, "\n" . $sql), $this->debug);
     }
     if ($this->slow_query_threshold && $query_time > $this->slow_query_threshold) {
         trigger_error(self::compose('The following query took %1$s milliseconds, which is above the slow query threshold of %2$s:%3$s', $query_time, $this->slow_query_threshold, "\n" . $sql), E_USER_WARNING);
     }
     if ($result_type) {
         return $result;
     }
 }
開發者ID:philip,項目名稱:flourish,代碼行數:45,代碼來源:fDatabase.php

示例3: write

 /**
  * Sends commands to the IMAP or POP3 server
  * 
  * @param  string  $command   The command to send
  * @param  integer $expected  The number of lines or regex expected for a POP3 command
  * @return array  The response from the server
  */
 private function write($command, $expected = NULL)
 {
     if (!$this->connection) {
         throw new fProgrammerException('Unable to send data since the connection has already been closed');
     }
     if ($this->type == 'imap') {
         $identifier = 'a' . str_pad($this->command_num++, 4, '0', STR_PAD_LEFT);
         $command = $identifier . ' ' . $command;
     }
     if (substr($command, -2) != "\r\n") {
         $command .= "\r\n";
     }
     if (fCore::getDebug($this->debug)) {
         fCore::debug("Sending:\n" . trim($command), $this->debug);
     }
     $res = fwrite($this->connection, $command);
     if ($res === FALSE) {
         throw new fConnectivityException('Unable to write data to %1$s server %2$s on port %3$s', strtoupper($this->type), $this->host, $this->port);
     }
     if ($this->type == 'imap') {
         return $this->read('#^' . $identifier . '#');
     } elseif ($this->type == 'pop3') {
         return $this->read($expected);
     }
 }
開發者ID:philip,項目名稱:flourish,代碼行數:32,代碼來源:fMailbox.php

示例4: write

 /**
  * Sends raw text/commands to the SMTP server
  * 
  * @param  string         $data    The data or commands to send
  * @param  integer|string $expect  The expected number of lines of response or a regex of the last line
  * @return array  The response from the server
  */
 private function write($data, $expect)
 {
     if (!$this->connection) {
         throw new fProgrammerException('Unable to send data since the connection has already been closed');
     }
     if (substr($data, -2) != "\r\n") {
         $data .= "\r\n";
     }
     if (fCore::getDebug($this->debug)) {
         fCore::debug("Sending:\n" . trim($data), $this->debug);
     }
     $res = fwrite($this->connection, $data);
     if ($res === FALSE || $res === 0) {
         throw new fConnectivityException('Unable to write data to SMTP server %1$s on port %2$s', $this->host, $this->port);
     }
     $response = $this->read($expect);
     return $response;
 }
開發者ID:mrjwc,項目名稱:printmaster,代碼行數:25,代碼來源:fSMTP.php


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