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