切换到mysqli还是继续使用mysql? [英] Switch to mysqli or stay with mysql?

查看:72
本文介绍了切换到mysqli还是继续使用mysql?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们这里有一个应用程序,该应用程序已经开发(现已投入生产)已经一年多了.总共有超过500个mysql_*呼叫.

We have an app here that has been in development (and now in production) for more than a year. Which has in total over 500 mysql_* calls.

将代码中mysql_*全部切换到mysqli_*

是否值得追逐所有可能(而且很可能会)出现的错误?

Is it worth chasing all the bugs that might (and most probably will) come about?

我从这样的问题中看到:要将其从MySQL更改为MySQLi吗?仅在每个mysql*通话可能会导致我出现很多错误.值得我花时间吗?

I see from questions like this: Changing this from MySQL to MySQLi? that just adding i after every mysql* call can lead me to alot of errors. Is it worth my time?

mysql_*可能会长期存在(甚至在不赞成使用的谣言中),因此,真的值得任何程序员有条不紊地切换吗?

mysql_* will probably around for the long haul (even amongst rumors of deprecation), so it it really worth any programmers time to methodically switch over?

另请参阅此讨论

推荐答案

引用 ext/mysqli 的手册:

Quoting the manual for ext/mysqli:

mysqli扩展具有许多优点,相对于mysql扩展而言,主要增强之处在于:

The mysqli extension has a number of benefits, the key enhancements over the mysql extension being:

  • 面向对象的界面
  • 对准备好的语句的支持
  • 支持多条语句
  • 交易支持
  • 增强的调试功能
  • 嵌入式服务器支持
  • Object-oriented interface
  • Support for Prepared Statements
  • Support for Multiple Statements
  • Support for Transactions
  • Enhanced debugging capabilities
  • Embedded server support

注意:如果您使用的是MySQL 4.1.3或更高版本,则强烈建议您使用此扩展名.

Note: If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use this extension.

如果仅需要这些功能之一并且可以负担得起重构的费用,那么可以.如果您不需要任何这些功能,请不要这样做.没有好处就没有理由重构.

If you need just one of those features and can afford the refactoring, then yes, go for it. If you dont need any of those features then dont do it. There is no reason to refactor if there is no benefits.

在旁注中,谣言属实. ext/mysql 很可能会被弃用(尽管在撰写本文时没有人说什么时候.它肯定不会被5.4弃用.它可能会作为pecl扩展名提供)永远)无论如何,当您拥有高级扩展名时,就不应该再使用ext/mysql启动任何新项目.

On a sidenote, the rumors are true. ext/mysql will likely be deprecated (although no one can say when at the time of this writing. It certainly wont be deprecated with 5.4. and it will likely be available as a pecl extension forever) In any case, you shouldnt be starting any new projects with ext/mysql anymore when you have a superior extension to start with.

另请参见 http://blog.ulf -wendel.de/2012/php-mysql-why-to-upgrade-extmysql/

这篇关于切换到mysqli还是继续使用mysql?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆