简体   繁体   English

mssql_fetch_array是否执行与数据库服务器的连接?

[英]Does mssql_fetch_array executes a connection to the database server?

I am developing a script that connects to a SQL Server database to fetch data and store it in a MySQL one. 我正在开发一个脚本,该脚本连接到SQL Server数据库以获取数据并将其存储在MySQL数据库中。

One of the problems I am having is that the SQL Server is not prepared to handle heavy traffic. 我遇到的问题之一是SQL Server不准备处理大量流量。

At this point, I am executing a query that returns 4385 results (mssql_num_rows), and I want to loop over them. 此时,我正在执行一个查询,该查询返回4385个结果(mssql_num_rows),并且我想遍历它们。 My question is if every mssql_fetch_array call connects to the database, or if the result of mssql_query is stored in memory. 我的问题是每个mssql_fetch_array调用是否都连接到数据库,或者mssql_query的结果是否存储在内存中。

I am not in the position of testing it to see if the server crashes, so that's why I have to ask before doing anything. 我无法对其进行测试以查看服务器是否崩溃,因此这就是为什么在执行任何操作之前都必须询问的原因。

Thank you in advance. 先感谢您。

mssql_fetch_array does not connect to the database each time. mssql_fetch_array不会每次都连接到数据库。 It will just loop through the record fetched by mssql_query(). 它将循环遍历mssql_query()提取的记录。

Refer to below given link for further understanding of mssql_fetch_array. 请参阅下面的链接,以进一步了解mssql_fetch_array。

http://php.net/manual/en/function.mssql-fetch-array.php[mssql_fetch_array][1] http://php.net/manual/en/function.mssql-fetch-array.php[mssql_fetch_array][1]

从数据库检索到的所有数据都存储在一个变量中,因此您的循环将不会连接到数据库!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM