I have read several questions regarding this but I fear they may be out of date as newer versions of the PDO libraries have been released since these questions were answered.
I have written a MySQL class that builds queries and escapes parameters, and then returns results based on the query. Currently this class is using the built-in mysql functions.
I am well aware of the advantages of using the PDO Library, e.g. it is compatible with other databases, stored procedures are easier to execute etc... However, what I would like to know is simply; is using the PDO Library faster then using the mysql built-in functions?
I have just written the equivalent class for MsSQL, so rewriting it to work with all databases would not take me long at all. Is it worth it or is the PDO library slower?
mysql_real_escape_string()
call" :). – Konrad Borowskimysql
functions. However, whatmysql
extension doesn't have is prepared statements. Therefore, if you have a lengthy insert, using PDO will be much faster via prepared statements because you'll just send parameters to already parsed query. However, speed should not be the deciding factor here. You should use PDO instead ofmysql
functions. Also, it's much easier to code with PDO plus it's great to do stuff in 1 line that you'd do in 5 - 10 lines withmysql
stuff. – N.B.