3
在.NET中SqlDataReader的可检索多个记录集:PHP中有多个结果集?
Dim Connection As New SqlConnection(SomeConnectionString)
'Note that the command will generate three result
Dim Command As New SqlCommand("select '1a', '1b'; " & _
"select '2a', '2b', '2c'; " & _
"select '3a', '3b'; ", Connection)
Dim Reader As SqlDataReader
Connection.Open()
Reader = Command.ExecuteReader
Do
While Reader.Read
'Do something with the data
End While
Loop While (Reader.NextResult) 'Proceed to next result
Reader.Close()
Connection.Close()
的.NextResult
移动阅读器到下一个结果。如何在PHP中做到这一点?我基本上想要避免多次往返数据库。
注意:.Read
此处移动下一行,而.NextResult
移动到下一个结果。
1查询,3分的结果:
结果1个
1a 1b
结果2
2a 2b 2c
结果3
3a 3b
注:行不等于导致。结果更像是一个表或一组行。
我认为就是这样。 MySQL或MSSQL?你怎么看? – dpp
我不认为MySQL(或者至少PDO mysql驱动程序)支持多个结果集。 PostgreSQL可能会,而且我也没有任何关于PDO的SQL Server驱动程序的第一手经验,所以我不能对此发表评论。 – cdhowie
Noooooooo !!我只会对此做一些研究。 Thanks1 – dpp