我们使用Doctrine2编写了一个应用程序,该应用程序在与MySQL或Postgres数据库一起使用时效果很好。Doctrine和MS SQL 2008的SELECT问题
我们现在使用PDO Driver DBLib将应用程序连接到SQL Server 2008数据库,该数据库使用SQL Server和Sybase共享的TDS(Tabular DataStream协议)的FreeTDS
实现。
初步架构创建,事务和INSERT
s到表中工作正常..经过一些调整Doctrine SQLServerPlatform
和我们的MSSQL驱动程序包。
但是,当选择数据,我们面临以下错误:
General error: 20019 Attempt to initiate a new Adaptive Server operation with results pending
大量的谷歌搜索后,我发现this detail in the FAQ of FreeTDS:
If you are accustomed to programming with other database servers, you may be surprised when you first encounter this aspect of the TDS protocol. [...]
The server requires the client either to read all the results from a query, or to indicate that no further rows are desired i.e., to issue a cancellation. Until one of those two things happens, the server will not accept new queries on that connection. It will complain about "pending results".
所以对于错误信息的原因是,由于某种原因, Doctrine(DBAL-> PDO-> FreeTDS)没有从连接缓冲区中读取所有结果行,并且服务器/库不允许应用程序在读取所有行之前发布新的exec()
/。
- 我的理解权
$doctrinequery->getResults()
在返回之前提取所有结果吗? - 我的理解权是
$entity->getLinkedEntity()
(即$user->getGroupNames()
)在返回之前获取所有结果吗? - 您将如何解决问题出在哪里?
Stacktraces根本没有帮助我们,代码库已经增长。 - 其他人已经有这个问题,可以分享一些见解?
- 有没有其他的方法可以用来将Doctrine连接到MSSQL,而不会遇到这个问题?