简体   繁体   English

一起使用MDB2和MySQLi(好还是坏?)

[英]Using MDB2 and MySQLi together (Good or bad?)

I want to use the PEAR Mail_queue package which requires the PEAR MDB2 package for database abstraction. 我想使用需要PEAR MDB2软件包进行数据库抽象的PEAR Mail_queue软件包。

I currently use MySQLi for all my database queries and dont really desire using MDB2. 我目前对所有数据库查询都使用MySQLi,但我真的不希望使用MDB2。

Would it be bad practice to use both MDB2 and MySQLi in my PHP applications at the same time? 同时在我的PHP应用程序中同时使用MDB2和MySQLi是不好的做法吗?

Can anyone give me a good reason to use MDB2 over MySQLi all together? 谁能给我一个很好的理由在MySQLi上一起使用MDB2?

Thanks. 谢谢。

PEAR::MDB2 has a driver that uses mysqli , so I don't get the point of your question. PEAR :: MDB2有一个使用mysqli的驱动程序 ,所以我不明白您的问题。 If your asking: 如果您问:

It is good or bad to have one connection opened with mysqli_* and another opened with PEAR::MDB2 用mysqli_ *打开一个连接并用PEAR :: MDB2打开另一个连接是好是坏

then it's not bad, but you may be opening two connections to the same database while only one could be necessary. 那就不错了,但是您可能要打开到同一数据库的两个连接,而可能只需要一个。 Be aware that if you start mixing both connections in your code, you can get confused quickly when it comes to maintenance. 请注意,如果您开始在代码中混合使用两个连接,则在维护时可能会很快感到困惑。

There are no known issues with using MDB2 and any other method of connecting to a mysql database concurrently. 使用MDB2和任何其他同时连接到mysql数据库的方法没有已知问题。 You should be fine. 你应该没事的。

It's good practice to use MDB2 or any other abstraction layer so you can later migrate to using a different type of database server (postgresql or sqlite for example) with a minimum of fuss. 最好使用MDB2或任何其他抽象层,以便以后可以迁移到使用其他类型的数据库服务器(例如postgresql或sqlite),而不必大惊小怪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM