本文整理汇总了PHP中mysqli_result::free方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_result::free方法的具体用法?PHP mysqli_result::free怎么用?PHP mysqli_result::free使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqli_result
的用法示例。
在下文中一共展示了mysqli_result::free方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __destruct
public function __destruct()
{
if (is_object($this->handle)) {
$this->handle->free();
}
// Don't close statement as these may be re-used across the life of this request
// if (is_object($this->statement)) $this->statement->close();
}
示例2: unset
public function &free()
{
if ($this->m_error instanceof ZDatabaseQueryError) {
unset($this->m_error);
}
$this->m_error = null;
if ($this->m_result instanceof mysqli_result) {
$this->m_result->free();
}
return $this;
}
示例3: fetch
/**
* @param mysqli_result $mysqli_result
* @param bool $single
* @return array|bool|null
*/
public function fetch($mysqli_result, $single)
{
$this->_('fields', array());
foreach ($mysqli_result->fetch_fields() as $field) {
$this->_('fields')[$field->name] = $this->rules[$this->types[$field->type]];
}
switch (true) {
case !$mysqli_result:
return null;
case $single && $mysqli_result->num_rows == 0:
$result = false;
break;
case $single:
$result = $this->cast($mysqli_result->fetch_assoc());
break;
case $mysqli_result->num_rows == 0:
$result = array();
break;
default:
$result = array();
while ($row = $mysqli_result->fetch_assoc()) {
$result[] = $this->cast($row);
}
}
$mysqli_result->free();
return $result;
}
示例4: bind
/**
* Binds this statement to the variables
*/
protected function bind()
{
$variables = array();
// Bind each field
while ($field = $this->metadata->fetch_field()) {
$this->columns[] = $field->name;
// Note that while boundValues isn't initialised at this point,
// later calls to $this->statement->fetch() Will populate
// $this->boundValues later with the next result.
$variables[] =& $this->boundValues[$field->name];
}
call_user_func_array(array($this->statement, 'bind_result'), $variables);
$this->bound = true;
$this->metadata->free();
// Buffer all results
$this->statement->store_result();
}
示例5: current
/**
* @see \Iterator::current()
*
* @return mixed
* @throws \OutOfRangeException
*/
public function current()
{
// Seems overkill to define our own OutOfRangeException. Use default in this case
if ($this->_pointer > $this->_numberOfRows - 1) {
throw new \OutOfRangeException('Attempting to access a row that is outside of the number of rows in this result.');
}
$pointer = $this->_pointer;
if (!array_key_exists($this->_pointer, $this->_mysqlResult)) {
$this->_mysqlResult[$this->_pointer] = $this->_result->fetch_array(\MYSQLI_ASSOC);
$this->_pointer++;
$this->_moveToNextRow = true;
$this->_processedRows++;
// Free up results when there is no more row to process
if ($this->_processedRows === $this->_numberOfRows) {
$this->_result->free();
}
}
return $this->_mysqlResult[$pointer];
}
示例6: close
/**
*
* 关闭 stmt result mysqli的函数,传入这三个东西就行
* @param mysqli,stmt,result
*/
static function close(mysqli $mysqli = null, mysqli_stmt $stmt = null, mysqli_result $result = null)
{
if ($result != null) {
$result->free();
}
if ($stmt != null) {
$stmt->close();
}
if ($mysqli != null) {
$mysqli->close();
}
}
示例7: free
/**
* 释放资源
*/
public function free()
{
if ($this->result) {
$this->result->free();
$mysql = $this->mysql->connect();
while ($mysql->more_results() && $mysql->next_result()) {
$result = $mysql->store_result();
if ($result) {
$result->free();
}
}
}
}
示例8: fetchResource
/**
* @param \mysqli_result $resource
* @param string $column
*
* @return mixed[]
*/
protected function fetchResource($resource, $column)
{
$fields = $resource->fetch_fields();
if (count($fields) == 0) {
return [];
}
$result = $resource->fetch_all(MYSQLI_ASSOC);
if (!is_array($result)) {
return [];
}
$resource->free();
$this->fixTypes($result, $fields, $column);
return $result;
}
示例9: free
/**
* free mysql resource
*
* @param \mysqli_result $res
*
* @throws DatabaseException|\Exception
* @return bool
*/
public function free($res)
{
$res->free();
return true;
}
示例10: __destruct
public function __destruct()
{
$this->result->free();
}
示例11: free
/**
* 释放所有与上次查询结果所关联的内存
* @return bool
*/
public function free()
{
return $this->result->free();
}
示例12: __destruct
/**
* @inheritdoc
*/
public function __destruct()
{
if (is_object($this->result)) {
$this->result->free();
}
}
示例13: _free
/**
* 释放sql查询结果
*
* @param \mysqli_result $res 要释放的结果
* @return bool 成功返回true,失败返回false
*/
protected function _free($res)
{
return $res->free();
}
示例14: getRowsArray
/**
* Get all rows from the DB result.
*
* @param \mysqli_result|bool $result The return of query method.
*
* @return array The array of SQL rows
*/
public function getRowsArray($result)
{
$rows = [];
if (!$result) {
return $rows;
}
while ($row = $result->fetch_assoc()) {
$rows[] = $row;
}
$result->free();
return $rows;
}
示例15: free
/**
* Free the result
*/
public function free()
{
if (is_object($this->resResult)) {
$this->resResult->free();
}
}