Re: MySQLi Compat question
| From: | John Coggeshall | Date: | Mon, 09 Jun 2003 16:40:11 +0000 |
| Subject: | Re: MySQLi Compat question | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17210@lists.php.net to get a copy of this message | ||
> Maybe I'm on a limb here, but I don't understand why there has to be a
> new mysql extension (mysqli) which have the same native functions as the
> mysql extension (mysqli_connect, etc)
The new mysqli extension is a major improvement over the mysql extension
on many levels.. it is based off of MySQL 4.1, and the implementation of
the API itself is much easier to maintain. mysqli supports things like
bindings, etc as well... it's really a major improvement over the old
extension and is still BC (at least from a functional standpoint) with
3.23 servers. There's also a great deal of efficiency gained with the
new extension as well.
Hope that answers your question :)
> From what I remember mysqli should be an OO extension to mysql, but my
> memory might be week :)
That's partially true. MySQLi is actually a hybrid (which is really
cool)... what it does is
$mysql = mysqli_connect(...);
$result = mysqli_query($mysql, "SELECT * FROM foo");
but at the exact same time, the following is also acceptable:
$mysql = mysqli_connect(...);
$result = $mysql->query("SELECT * FROM foo");
i.e. statement, connection, and result resources (I think results are in
there too, I'd have to double-check) can be accessed both as objects or
as just resources.
John
--
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
John Coggeshall
john at coggeshall dot org http://www.coggeshall.org/
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-