1
A
回答
1
目前,這是不可能的。儘管PDOStatement對象的每個實例存儲用於創建它(quoting lxr for PHP 5.6)一DB手柄:
/* represents a prepared statement */
543 struct _pdo_stmt_t {
544 /* these items must appear in this order at the beginning of the
545 struct so that this can be cast as a zend_object. we need this
546 to allow the extending class to escape all the custom handlers
547 that PDO declares.
548 */
549 zend_object std;
550
...
572 /* we want to keep the dbh alive while we live, so we own a reference */
573 zval database_object_handle;
574 pdo_dbh_t *dbh;
...它不是通過公共方法暴露。
這可能是值得一記,反過來pdo_dbh_t
實例可以(至少看起來如此)引用存儲到pdo_stmt_t
(link)的:
427 /* represents a connection to a database */
428 struct _pdo_dbh_t {
...
501 /* when calling PDO::query(), we need to keep the error
502 * context from the statement around until we next clear it.
503 * This will allow us to report the correct error message
504 * when PDO::query() fails */
505 pdo_stmt_t *query_stmt;
相關問題
- 1. 警告:PDOStatement對象::執行()[pdostatement.execute]:SQLSTATE [23000]:
- 2. PHP PDOStatement對象使用fetchall第二次
- 3. PDOStatement對象執行不使用MySQL-ODBC
- 4. PDOStatement對象在foreach循環PHP
- 5. 致命錯誤:類PDOStatement對象的對象不能轉換
- 6. 如何修復注意:類PDOStatement對象的對象無法轉換成int
- 7. 確定是否PDOStatement對象對象來源於PDO ::查詢()或PDO ::準備()
- 8. 是我之間的差,d,S,B在PDOStatement對象:: bindParam
- 9. 可能性爲PDOStatement對象:: fetch()方法拋出一個PDOException
- 10. 錯誤提交警告時:PDOStatement對象::執行():SQLSTATE [HY093]
- 11. PDOStatement to json
- 12. PHP PDO PDOStatement-> execute()
- 13. 模擬PDOStatement ::執行
- 14. PDOStatement對象::使用fetchall()之後施加一個PHP函數到一列
- 15. 致命的PDO錯誤:不能使用PDOStatement類型的對象作爲數組
- 16. 警告:PDOStatement對象::執行():SQLSTATE [HY093]:無效參數數:參數沒有在... FILETEXT
- 17. 警告:PDOStatement :: execute()[pdostatement.execute]:SQLSTATE [HY093]:
- 18. PDostatement :: bindParam data_type參數列表
- 19. PDO :: PARAM_INT在PDOStatement ::執行
- 20. 使用PDOStatement的優勢?
- 21. 從對象
- 22. 從SimpleXML對象
- 23. RxJS:從對象
- 24. C#從對象
- 25. JavaScript從對象
- 26. 蟒從對象
- 27. 從對象
- 28. 從對象
- 29. 從對象
- 30. 從對象
'的var_dump($ PDOStatement對象)'會顯示語句對象中的任何反向鏈接。 – 2014-12-01 21:23:09
['PDOStatement'](http://php.net/manual/en/class.pdostatement.php)的文檔似乎沒有顯示任何方式來做到這一點。我可以問*你爲什麼要這樣做?你想在這裏解決的*實際*問題是什麼? – 2014-12-01 21:35:43
這是微不足道的。我正在編寫的類需要一個「PDOStatement」實例和生成它的「PDO」實例。我想知道是否可以簡化課程的界面。 – 2014-12-01 21:46:11