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


PHP resource::free方法代碼示例

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


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

示例1: log

 /**
  * Inserts $message to the currently open database.  Calls open(),
  * if necessary.  Also passes the message along to any Log_observer
  * instances that are observing this Log.
  *
  * @param mixed  $message  String or object containing the message to log.
  * @param string $priority The priority of the message.  Valid
  *                  values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
  *                  PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
  *                  PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
  * @return boolean  True on success or false on failure.
  * @access public
  */
 function log($message, $priority = null)
 {
     /* If a priority hasn't been specified, use the default value. */
     if ($priority === null) {
         $priority = $this->_priority;
     }
     /* Abort early if the priority is above the maximum logging level. */
     if (!$this->_isMasked($priority)) {
         return false;
     }
     /* If the connection isn't open and can't be opened, return failure. */
     if (!$this->_opened && !$this->open()) {
         return false;
     }
     /* If we don't already have a statement object, create one. */
     if (!is_object($this->_statement) && !$this->_prepareStatement()) {
         return false;
     }
     /* Extract the string representation of the message. */
     $message = $this->_extractMessage($message);
     /* Build our set of values for this log entry. */
     $values = array('id' => $this->_db->nextId($this->_sequence), 'logtime' => MDB2_Date::mdbNow(), 'ident' => $this->_ident, 'priority' => $priority, 'message' => $message);
     /* Execute the SQL query for this log entry insertion. */
     $this->_db->expectError(MDB2_ERROR_NOSUCHTABLE);
     $result =& $this->_statement->execute($values);
     $this->_db->popExpect();
     /* Attempt to handle any errors. */
     if (PEAR::isError($result)) {
         /* We can only handle MDB2_ERROR_NOSUCHTABLE errors. */
         if ($result->getCode() != MDB2_ERROR_NOSUCHTABLE) {
             return false;
         }
         /* Attempt to create the target table. */
         if (!$this->_createTable()) {
             return false;
         }
         /* Recreate our prepared statement resource. */
         $this->_statement->free();
         if (!$this->_prepareStatement()) {
             return false;
         }
         /* Attempt to re-execute the insertion query. */
         $result = $this->_statement->execute($values);
         if (PEAR::isError($result)) {
             return false;
         }
     }
     $this->_announce(array('priority' => $priority, 'message' => $message));
     return true;
 }
開發者ID:sergiobelli,項目名稱:jecon,代碼行數:63,代碼來源:mdb2.php

示例2: free

 /**
  * Free the memory used by the result resource
  *
  * @return void
  */
 public function free()
 {
     switch ($this->mode) {
         case "mysql":
             $this->result->free();
             break;
         case "postgres":
         case "redshift":
             pg_free_result($this->result);
             break;
         case "odbc":
             odbc_free_result($this->result);
             break;
         case "sqlite":
             $this->result->finalize();
             break;
         case "mssql":
             mssql_free_result($this->result);
             break;
     }
 }
開發者ID:ian-Tr,項目名稱:le-huard,代碼行數:26,代碼來源:Result.php

示例3: free

 /**
  * Limpiamos la consulta
  * @author Ignacio Daniel Rostagno <ignaciorostagno@vijona.com.ar>
  * @return boolean
  */
 private function free()
 {
     return is_resource($this->data) ? $this->data->free() : true;
 }
開發者ID:areslepra,項目名稱:Framework,代碼行數:9,代碼來源:class.littledb.php

示例4: __destruct

 public function __destruct()
 {
     if (is_object($this->handle)) {
         $this->handle->free();
     }
 }
開發者ID:normann,項目名稱:sapphire,代碼行數:6,代碼來源:MySQLDatabase.php

示例5: free

 /**
  * 釋放結果集所占資源
  * @return void 
  */
 protected function free()
 {
     @$this->rs->free();
 }
開發者ID:stonepeng,項目名稱:b2c,代碼行數:8,代碼來源:class.db.php


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