从mysql迁移到mysqli或pdo? [英] Moving from mysql to mysqli or pdo?

查看:85
本文介绍了从mysql迁移到mysqli或pdo?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重复: mysqli或PDO-优点和缺点缺点?

我希望将网站从mysql迁移到mysqli或pdo,这主要是一种学习工具,但是如果可能的话,也可以提高性能.

I'm looking to move a website from mysql to either mysqli or pdo as primarily a learning tool, but also for performance increases if possible.

我已阅读 http://php.net/manual/zh-/mysqli .overview.php ,看起来两者都可以满足我的需求,但是两种方法都不太适合.

I have read through http://php.net/manual/en/mysqli.overview.php and it seems like both would suit my needs, but it doesn't lean strongly either way.

该站点当前主要使用非面向对象的代码,但是我确实有使用其他语言的OO的经验.绝大多数查询是简单的,复杂的select语句,几乎没有更新/插入.您认为从我自己的教育和这个特定站点来看,最有用的是什么?

The site currently uses primarily non object orientated code, but I do have experience with OO in other languages. A huge majority of the queries are simple complex select statements with very little update/inserts. What do you suggest as being the most useful both from my own education and for this specific site?

如果您需要任何其他信息,请告诉我.

If you need any additional information please let me know.

谢谢.

推荐答案

PDO Pro:

  • PHP 5.x以上版本的本地语言
  • 支持命名参数相反 到数字索引?的
  • 相同的抽象库支持多个不同的RDBM.
  • Native to PHP as of 5.x
  • Supports named parameters as opposed to numerically indexed ?'s
  • Same abstraction library supports multiple different RDBM's

Mysqli Con的:

Mysqli Con's:

  • 在正确存储和存储时存在问题 检索中的大对象 数据库.
  • 不支持命名参数.
  • Has issues with properly storing and retrieving large objects in the database.
  • No support for named parameters.

否则,两个库基本上都是同一事物的不同口味.它们都具有引用参数的功能,并且都支持参数化查询.

Otherwise, both libraries are basically different flavors of the same thing. They both have functions to quote parameters and both support parameterized queries.

如果以上任何一个参数都不动摇,则根据其语法,样式等选择您喜欢的任何库.

If none of the above arguments sway you, then go with whichever library you prefer based on its syntax, style, etc.

这篇关于从mysql迁移到mysqli或pdo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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