doujia4619 2012-03-03 14:08 采纳率: 0%
浏览 26
已采纳

将PDO与现有的MYSQL / PHP应用程序集成

I am building some new additions to an existing WebApp. The old code was written using mysql functions. Changing the entire application to use PDO would be a VERY man-hour-intense thing to do. However, for all new code, I'd like to begin using PDO.

Are there any concerns I need to be aware of for using PDO within an existing application that does NOT use PDO to interface with the database? It's no problem to connect to the DB using both/either of these options at the same time when a page is loaded, correct?

While I'm at it - I am interested to know how big the need is to close a PDO connection after a page loads - or is it fine to leave the connection open?

Thanks all.

  • 写回答

1条回答 默认 最新

  • dongshen7407 2012-03-03 14:44
    关注

    There's no need to close any type of database connection when a page finishes loading - PHP always does this for you (unless you make the mistake of enabling persistent connections).

    However, if you use PDO AND mysql_ in the same page, connecting to the same database, it will consume twice as many connections (while the page is executing) on the server. This may or may not be a problem.

    Personally I would recommend that you remain consistent within the application if you don't want to refactor it to use PDO throughout.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度