开发者

pdo and mysqli in the same project

there is a problem, if in my project 开发者_Go百科i use mysqli for the most part of the project and for a specific query to another db use the pdo?

I'll probably have to do some queries to another databases, but i prefer using mysqli in terms of performance for the rest of the project.

I don't know what is the SGBD in another databases for now.


It is possible to use multiple database access layers within the same application without issue. From a readability/maintainability standpoint, it's recommended to use just one. If you're not seeing good enough performance from PDO, it's okay to use mysqli_ for a performance sensitive part of your application as long as you recognize the tradeoff you're making. Run some simple benchmarks to prove your case. Also, please keep in mind that if you're using PDO and mysqli_ connecting to the same database on the same page you'll be creating an extra database connection. One more thing to keep in mind; No matter what your database access layer, using parameterized queries to protect against SQL injection is strongly encouraged. Parameterized queries are support in both PDO and mysqli_.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜