dongzi1959
2012-12-04 15:41
浏览 37
已采纳

Pear :: MDB2 - 获取最后执行的查询

I have to use Pear MDB2 but don't know how to get the last executed query. Is there a way to do that?

Thanks,

图片转代码服务由CSDN问答提供 功能建议

我必须使用Pear MDB2,但不知道如何获取最后执行的查询。 有没有办法做到这一点?

谢谢,

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushi3189 2012-12-04 16:25
    已采纳

    AS you can see in this link: https://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html#var$last_query you have a variable called $last_query that stores the last query sent to the driver.

    I have not checked it, but based on the documentation you can use:

    $mdb2 =& MDB2::connect('YOUR_DSN');
    if (PEAR::isError($mdb2)) {
        die($mdb2->getMessage());
    }
    
    // Proceed with a query...
    $res =& $mdb2->query('SELECT * FROM clients');
    
    echo $mdb2->last_query;
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题