本文整理汇总了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;
}
示例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;
}
}
示例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;
}
示例4: __destruct
public function __destruct()
{
if (is_object($this->handle)) {
$this->handle->free();
}
}
示例5: free
/**
* 释放结果集所占资源
* @return void
*/
protected function free()
{
@$this->rs->free();
}