<s>
The	O
MySQLi	B-Language
Extension	I-Language
(	O
MySQL	B-Language
Improved	I-Language
)	O
is	O
a	O
relational	B-Application
database	I-Application
driver	O
used	O
in	O
the	O
PHP	B-Application
scripting	B-Language
language	I-Language
to	O
provide	O
an	O
interface	O
with	O
MySQL	B-Application
databases	O
.	O
</s>
<s>
There	O
are	O
three	O
main	O
API	O
options	O
when	O
considering	O
connecting	O
to	O
a	O
MySQL	B-Application
database	O
server	O
:	O
</s>
<s>
The	O
PHP	B-Application
code	O
consists	O
of	O
a	O
core	O
,	O
with	O
optional	O
extensions	O
to	O
the	O
core	O
functionality	O
.	O
</s>
<s>
PHP	B-Application
's	O
MySQL-related	O
extensions	O
,	O
such	O
as	O
the	O
MySQLi	B-Language
extension	I-Language
,	O
and	O
the	O
MySQL	B-Application
extension	O
,	O
are	O
implemented	O
using	O
the	O
PHP	B-Application
extension	O
framework	O
.	O
</s>
<s>
An	O
extension	O
typically	O
exposes	O
an	O
API	O
to	O
the	O
PHP	B-Application
developer	O
,	O
to	O
allow	O
its	O
facilities	O
to	O
be	O
used	O
programmatically	O
.	O
</s>
<s>
However	O
,	O
some	O
extensions	O
which	O
use	O
the	O
PHP	B-Application
extension	O
framework	O
do	O
not	O
expose	O
an	O
API	O
to	O
the	O
PHP	B-Application
developer	O
.	O
</s>
<s>
The	O
PDO	O
MySQL	B-Application
driver	O
extension	O
,	O
for	O
example	O
,	O
does	O
not	O
expose	O
an	O
API	O
to	O
the	O
PHP	B-Application
developer	O
,	O
but	O
provides	O
an	O
interface	O
to	O
the	O
PDO	O
layer	O
above	O
it	O
.	O
</s>
<s>
MySQLi	B-Language
is	O
an	O
improved	O
version	O
of	O
the	O
older	O
PHP	B-Application
MySQL	B-Application
driver	O
,	O
offering	O
various	O
benefits	O
.	O
</s>
<s>
The	O
authors	O
of	O
the	O
PHP	B-Application
scripting	B-Language
language	I-Language
recommend	O
using	O
MySQLi	B-Language
when	O
dealing	O
with	O
MySQL	B-Application
server	I-Application
versions	O
4.1.3	O
and	O
newer	O
(	O
takes	O
advantage	O
of	O
new	O
functionality	O
)	O
.	O
</s>
<s>
The	O
MySQLi	B-Language
extension	I-Language
provides	O
various	O
benefits	O
with	O
respect	O
to	O
its	O
predecessor	O
,	O
the	O
most	O
prominent	O
of	O
which	O
(	O
according	O
to	O
the	O
PHP	B-Application
website	O
)	O
are	O
:	O
</s>
<s>
The	O
MySQLi	B-Language
extension	I-Language
features	O
a	O
dual	O
interface	O
-	O
it	O
supports	O
both	O
the	O
procedural	O
and	O
object-oriented	B-Language
programming	I-Language
paradigms	O
.	O
</s>
<s>
Users	O
migrating	O
from	O
the	O
old	O
MySQL	B-Application
extension	O
may	O
prefer	O
the	O
procedural	O
interface	O
.	O
</s>
<s>
The	O
procedural	O
interface	O
is	O
similar	O
to	O
that	O
of	O
the	O
old	O
MySQL	B-Application
extension	O
.	O
</s>
<s>
Some	O
MySQLi	B-Language
functions	O
take	O
a	O
connection	O
handle	O
as	O
their	O
first	O
argument	O
,	O
whereas	O
matching	O
functions	O
in	O
the	O
old	O
MySQL	B-Application
interface	O
took	O
it	O
as	O
an	O
optional	O
last	O
argument	O
.	O
</s>
<s>
The	O
MySQL	B-Application
server	I-Application
supports	O
the	O
use	O
of	O
different	O
transport	O
layers	O
for	O
connections	O
.	O
</s>
<s>
PHP	B-Application
applications	O
can	O
navigate	O
freely	O
through	O
buffered	O
results	O
.	O
</s>
<s>
At	O
the	O
level	O
of	O
the	O
MySQL	B-Application
Client	O
Server	O
Protocol	O
,	O
the	O
command	O
COM_QUERY	O
and	O
the	O
text	O
protocol	O
are	O
used	O
for	O
statement	O
execution	O
.	O
</s>
<s>
With	O
the	O
text	O
protocol	O
,	O
the	O
MySQL	B-Application
server	I-Application
converts	O
all	O
data	O
of	O
a	O
result	O
sets	O
into	O
strings	O
before	O
sending	O
.	O
</s>
<s>
The	O
MySQL	B-Application
client	O
libraries	O
receive	O
all	O
column	O
values	O
as	O
strings	O
.	O
</s>
<s>
Instead	O
,	O
all	O
values	O
are	O
provided	O
as	O
PHP	B-Application
strings	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
convert	O
integer	O
and	O
float	O
columns	O
back	O
to	O
PHP	B-Application
numbers	O
by	O
setting	O
the	O
MYSQLI_OPT_INT_AND_FLOAT_NATIVE	O
connection	O
option	O
,	O
if	O
using	O
the	O
mysqlnd	O
library	O
.	O
</s>
<s>
If	O
set	O
,	O
the	O
mysqlnd	O
library	O
will	O
check	O
the	O
result	O
set	O
meta	O
data	O
column	O
types	O
and	O
convert	O
numeric	O
SQL	O
columns	O
to	O
PHP	B-Application
numbers	O
,	O
if	O
the	O
PHP	B-Application
data	O
type	O
value	O
range	O
allows	O
for	O
it	O
.	O
</s>
<s>
The	O
MySQL	B-Application
database	O
supports	O
prepared	O
statements	O
.	O
</s>
<s>
The	O
MySQL	B-Application
server	I-Application
supports	O
using	O
anonymous	O
,	O
positional	O
placeholder	O
with	O
?	O
.	O
</s>
<s>
The	O
MySQL	B-Application
database	O
supports	O
stored	B-General_Concept
procedures	I-General_Concept
.	O
</s>
<s>
A	O
stored	B-General_Concept
procedure	I-General_Concept
is	O
a	O
subroutine	O
stored	O
in	O
the	O
database	O
catalog	O
.	O
</s>
<s>
Applications	O
can	O
call	O
and	O
execute	O
the	O
stored	B-General_Concept
procedure	I-General_Concept
.	O
</s>
<s>
The	O
CALL	O
SQL	O
statement	O
is	O
used	O
to	O
execute	O
a	O
stored	B-General_Concept
procedure	I-General_Concept
.	O
</s>
<s>
Stored	B-General_Concept
procedures	I-General_Concept
can	O
have	O
IN	O
,	O
INOUT	O
and	O
OUT	O
parameters	O
,	O
depending	O
on	O
the	O
MySQL	B-Application
version	O
.	O
</s>
<s>
The	O
MySQLi	B-Language
interface	O
has	O
no	O
special	O
notion	O
for	O
the	O
different	O
kinds	O
of	O
parameters	O
.	O
</s>
<s>
MySQL	B-Application
optionally	O
allows	O
having	O
multiple	O
statements	O
in	O
one	O
statement	O
string	O
.	O
</s>
<s>
The	O
MySQL	B-Application
server	I-Application
allows	O
having	O
statements	O
that	O
do	O
return	O
result	O
sets	O
and	O
statements	O
that	O
do	O
not	O
return	O
result	O
sets	O
in	O
one	O
multiple	O
statement	O
.	O
</s>
<s>
The	O
MySQL	B-Application
server	I-Application
supports	O
transactions	O
depending	O
on	O
the	O
storage	O
engine	O
used	O
.	O
</s>
<s>
A	O
MySQL	B-Application
result	O
set	O
contains	O
metadata	O
.	O
</s>
<s>
All	O
metadata	O
sent	O
by	O
MySQL	B-Application
is	O
accessible	O
through	O
the	O
MySQLi	B-Language
interface	O
.	O
</s>
<s>
Differences	O
between	O
MySQL	B-Application
server	I-Application
versions	O
are	O
not	O
aligned	O
.	O
</s>
<s>
Persistent	O
connection	O
support	O
was	O
introduced	O
in	O
PHP	B-Application
5.3	O
for	O
the	O
MySQLi	B-Language
extension	I-Language
.	O
</s>
<s>
Support	O
was	O
already	O
present	O
in	O
PDO	O
MYSQL	B-Application
and	O
ext/mysql	O
.	O
</s>
<s>
Unlike	O
the	O
MySQL	B-Application
extension	O
,	O
MySQLi	B-Language
does	O
not	O
provide	O
a	O
separate	O
function	O
for	O
opening	O
persistent	O
connections	O
.	O
</s>
<s>
The	O
persistent	O
connection	O
of	O
the	O
MySQLi	B-Language
extension	I-Language
however	O
provides	O
built-in	O
cleanup	O
handling	O
code	O
.	O
</s>
<s>
The	O
cleanup	O
carried	O
out	O
by	O
MySQLi	B-Language
includes	O
:	O
</s>
<s>
The	O
MySQLi	B-Language
extension	I-Language
does	O
this	O
cleanup	O
by	O
automatically	O
calling	O
the	O
C-API	O
function	O
mysql_change_user( )	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
switch	O
off	O
the	O
automatic	O
cleanup	O
code	O
,	O
by	O
compiling	O
PHP	B-Application
with	O
MYSQLI_NO_CHANGE_USER_ON_PCONNECT	O
defined	O
.	O
</s>
<s>
The	O
MySQLi	B-Language
extension	I-Language
supports	O
persistent	O
connections	O
when	O
using	O
either	O
MySQL	B-Application
Native	O
Driver	O
or	O
MySQL	B-Application
Client	O
Library	O
.	O
</s>
