問題描述
當我嘗試在 mysql 中調用存儲過程以返回結果集時,它一直說無法在給定的上下文中返回結果集".
When ever I try to call store procedure in mysql that sends back a result set, it keeps saying me that "can't return a result set in the given context".
我在谷歌上搜索過,有人說是 mysql 錯誤,有人說你應該更改 mysqli 驅動程序,然后......
I've google it and some said it's mysql bug, some said you should change your mysqli driver and ....
情況:
使用 mysqli 驅動客戶端 API 庫版本 5.0.51a,PHP 版本 5.2.4-2ubuntu5.6,使用 Zend 1.9 RC 1 Mysqli 適配器.
Using mysqli driver Client API library version 5.0.51a , PHP Version 5.2.4-2ubuntu5.6, Using Zend 1.9 RC 1 Mysqli adapter.
我該怎么辦!?
推薦答案
不確定這是您問題的解決方案,但是嘗試使用更新版本的 PHP 怎么樣?
PHP 5.2.4 肯定很老了——所以,如果它是 PHP 的 mysqli 驅動程序中的一個錯誤,它可能已經被糾正了......
Not sure this is the solution to your problem, but what about trying with a more recent version of PHP ?
PHP 5.2.4 is definitly quite old -- so, if it's a bug in PHP's mysqli driver, it might have been corrected since...
實際上,在快速搜索之后,您看到的問題似乎已經出現在 PHP 5.2.3 和 PHP 5.2.4 之間(并且在 PHP 5.2.5 中仍然存在).
請參閱錯誤 #42548:PROCEDURE xxx 無法返回給定的結果集上下文(適用于 5.2.3 !!)
Actually, after a quick search, it seems a problem like the one you are witnessing has been introduced between PHP 5.2.3 and PHP 5.2.4 (and was still here in PHP 5.2.5).
See bug #42548 : PROCEDURE xxx can't return a result set in the given context (works in 5.2.3!!)
你能用 PHP 5.2.9 或 5.2.10 之類的東西進行測試嗎?
我知道這些不是由 Ubuntu 提供的,即使在最新的 Ubuntu 穩定版本中 :-( 您可能必須從源代碼編譯 :-(
Are you able to test with something like PHP 5.2.9 or 5.2.10 ?
I know these are not provided by Ubuntu, even in the last Ubuntu stable version :-( You might have to compile from sources :-(
另一個想法是嘗試 mith PDO_MySql 適配器:也許它可以與那個一起工作?
是否可以在不造成太多麻煩/無需花費數小時進行測試的情況下更換適配器?
Yet another idea would be to try mith PDO_MySql adapter : maybe it would work with that one ?
It might be possible to change Adapter without causing too much trouble / without taking hours to test ?
當您使用 Zend Framework 1.9 時,這里有另一篇您可能會感興趣并且可能更容易測試的帖子:升級到 1.8 后存儲過程錯誤
As you are working with Zend Framework 1.9, here's another post that might interest you, and might be easier to test : stored procedure error after upgrade to 1.8
一個簡單的嘗試解決方案是回到 Zend Framework 1.7 ;對你來說可以嗎,只是為了測試?
An easy solution to try that would be to go back to Zend Framework 1.7 ; would it be possible for you, just to test ?
無論如何...祝你好運!
而且,如果您找到了解決方案,請不要忘記指出問題是什么,以及您是如何解決的;-)
Anyway... Good luck !
And, if you find the solution, don't forget to indicate what the problem was, and how you solved it ;-)
這篇關于無法在給定上下文中返回結果集的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!