首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

mysqli::store_result

(PHP 5, PHP 7)

mysqli :: store_result - mysqli_store_result - 传输最后一个查询的结果集

描述

面向对象的风格

代码语言:javascript
复制
mysqli_result mysqli::store_result ([ int $option ] )

程序风格

代码语言:javascript
复制
mysqli_result mysqli_store_result ( mysqli $link [, int $option ] )

link用于 mysqli_data_seek()函数的参数表示的数据库连接上的最后一个查询的结果集传输。

参数

代码语言:txt
复制
`link`   

仅过程样式:由 mysqli_connect()或 mysqli_init()返回的链接标识符

option

您要设置的选项。它可以是以下值之一:

Name

Description

MYSQLI_STORE_RESULT_COPY_DATA

Copy results from the internal mysqlnd buffer into the PHP variables fetched. By default, mysqlnd will use a reference logic to avoid copying and duplicating results held in memory. For certain result sets, for example, result sets with many small rows, the copy approach can reduce the overall memory usage because PHP variables holding results may be released earlier (available with mysqlnd only, since PHP 5.6.0)

返回值

返回缓冲结果对象或FALSE发生错误。

mysqli_store_result()返回FALSE的情况下,查询没有返回结果集(如果查询,例如一个 INSERT 语句)。FALSE如果结果集的读数失败,该函数也会返回。您可以通过检查 mysqli_error()是否返回空字符串, mysqli_errno()是否返回非零值,或者 mysqli_field_count()是否返回非零值来检查是否有错误。FALSE成功调用 mysqli_query()后返回此函数的可能原因可能是结果集太大(无法分配内存)。如果 mysqli_field_count()返回一个非零值,则该语句应该产生一个非空的结果集。

笔记

:虽然它始终是很好的做法,以释放使用的查询结果使用的内存 mysqli_free_result()函数,使用转送大结果集时 mysqli_store_result()这一点变得尤其重要。

例子

请参阅 mysqli_multi_query()。

也可以看看

  • mysqli_real_query() - 执行一个 SQL 查询
  • mysqli_use_result() - 启动结果集检索

← mysqli::stmt_init

mysqli::$thread_id →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com