- PHP5 comes with a new MySQL extension called mysqli. While the i stands for improved, interface and incompatible (some say incomplete – HA!).
- Supports MySQL versions starting with MySQL 4.1.
- The new function was basically a way to start over and clean things up to work with the new features in 4.1+.
- Includes SSL connections, stronger password algorithm, prepared statements prevent SQL injection, no default connection parameters. Overall, their goal was to make it safer.
- Can make use of new and more efficient MySQL binary protocol, prepared statements give massive performance improvements on large data sets, faster overall code, support for gzip compressed connections. Additionally, the MySQL server can be embedded into PHP (wtf?).
- You can use either OOP or procedural interfaces, prepared statements make certain operations easier and there’s less that can go wrong (which seems a bit ambiguous).
- Some redundant functions have been dropped, some new functions that support new features and persistent connections are no longer support (about damn time).
- The OOP interface is “marginally” slower than the procedural interface, but tiny compared to the cost of actually getting the data. In other words, use whichever you like.
- In PHP5, the OOP interface supports Exceptions (ie. ConnectException, etc.).
- Added autocommit(), commit() and rollback() functions to the OOP interface.
- Now supports multiple queries with the multi_query() function. This looks absurdly awkward.
Not sure if I can even think of a reason to use this.This functionality was added specifically for stored procedures which can return multiple result sets.
Nevermind, Ian just noticed he’s reading the notes verbatim from the manual. That being said, this looks like an extremely interesting enhancement over the old MySQL client library. We’ll probably look into switching things over when we get back and start forming a larger MySQL strategy.
Pingback: Trying to be a Web Developer » MySQLi
Pingback: Kapusta Brothers » Blog Archive » MySQLi