Spec-Zone .ru
спецификации, руководства, описания, API
|
Table of Contents
CALL
StatementsMysql
)Mysqli
)MySQL (PDO)
)Mysqlnd
)mysqlnd_ms
)mysqlnd_qc
)mysqlnd_uh
)mysqlnd_mux
)mysqlnd_memcache
)mysql
and mysqli
inPHPMySQL Connectors provide connectivity to the MySQL server for client programs. APIs provide low-level access to the MySQL protocol and MySQL resources. Both Connectors and the APIs enable you to connect and execute MySQL statements from another language or environment, including ODBC, Java (JDBC), Perl, Python, PHP, Ruby, and native C and embedded MySQL instances.
Connector version numbers do not correlate with MySQL Server version numbers. See Table 22.2, "MySQL Connector Versions and MySQL Server Versions".
Oracle develops a number of connectors:
Connector/ODBC provides driver support for connecting to MySQL using the Open Database Connectivity (ODBC) API. Support is available for ODBC connectivity from Windows, Unix, and Mac OS X platforms.
Connector/Net enables developers to create .NET applications that connect to MySQL. Connector/Net implements a fully functional ADO.NET interface and provides support for use with ADO.NET aware tools. Applications that use Connector/Net can be written in any supported .NET language.
The MySQL Visual Studio Plugin works with Connector/Net and Visual Studio 2005. The plugin is a MySQL DDEX Provider, which means that you can use the schema and data manipulation tools available in Visual Studio to create and edit objects within a MySQL database.
Connector/J provides driver support for connecting to MySQL from Java applications using the standard Java Database Connectivity (JDBC) API.
Connector/Python provides driver support
for connecting to MySQL from Python applications using an API that is compliant with the
Connector/C++ enables C++ applications to connect to MySQL.
Connector/C is a standalone replacement for
the MySQL Client Library (libmysqlclient
), to be used for C applications.
For direct access to using MySQL natively within a C application, there are two methods:
The C
API provides low-level access to the MySQL client/server protocol through the libmysqlclient
client library. This is the primary method used to connect to an instance of the MySQL server, and is
used both by MySQL command-line clients and many of the MySQL Connectors and third-party APIs detailed
here.
libmysqlclient
is included in MySQL distributions and in MySQL
Connector/C distributions.
libmysqld
is an embedded MySQL server library that
enables you to embed an instance of the MySQL server into your C applications.
libmysqld
is included in MySQL distributions, but not in MySQL
Connector/C distributions.
See also Section 22.8.1, "MySQL C API Implementations".
To access MySQL from a C application, or to build an interface to MySQL for a language not supported by the Connectors or APIs in this chapter, the C API is where to start. A number of programmer's utilities are available to help with the process; see Section 4.7, "MySQL Program Development Utilities".
The remaining APIs described in this chapter provide an interface to MySQL from specific application languages. These third-party solutions are not developed or supported by Oracle. Basic information on their usage and abilities is provided here for reference purposes only.
All the third-party language APIs are developed using one of two methods, using libmysqlclient
or by implementing a native driver. The two solutions offer different benefits:
Using libmysqlclient
offers complete compatibility with MySQL because
it uses the same libraries as the MySQL client applications. However, the feature set is limited to the
implementation and interfaces exposed through libmysqlclient
and the
performance may be lower as data is copied between the native language, and the MySQL API components.
Native drivers are an implementation of the MySQL network protocol entirely within the host language or environment. Native drivers are fast, as there is less copying of data between components, and they can offer advanced functionality not available through the standard MySQL API. Native drivers are also easier for end users to build and deploy because no copy of the MySQL client libraries is needed to build the native driver components.
Table 22.1, "MySQL APIs and Interfaces" lists many of the libraries and interfaces available for MySQL. Table 22.2, "MySQL Connector Versions and MySQL Server Versions" shows which MySQL Server versions each connector supports.
Table 22.1. MySQL APIs and Interfaces
Environment | API | Type | Notes |
---|---|---|---|
Ada | GNU Ada MySQL Bindings | libmysqlclient |
See |
C | C API | libmysqlclient |
See Section 22.8, "MySQL C API". |
C | Connector/C | Replacement for libmysqlclient |
See Section 22.5, "MySQL Connector/C". |
C++ | Connector/C++ | libmysqlclient |
See Section 22.4, "MySQL Connector/C++". |
MySQL++ | libmysqlclient |
See |
|
MySQL wrapped | libmysqlclient |
See |
|
Cocoa | MySQL-Cocoa | libmysqlclient |
Compatible with the Objective-C Cocoa environment. See |
D | MySQL for D | libmysqlclient |
See |
Eiffel | Eiffel MySQL | libmysqlclient |
See Section 22.14, "MySQL Eiffel Wrapper". |
Erlang | erlang-mysql-driver |
libmysqlclient |
See erlang-mysql-driver . |
Haskell | Haskell MySQL Bindings | Native Driver | See |
hsql-mysql |
libmysqlclient |
See |
|
Java/JDBC | Connector/J | Native Driver | See Section 22.3, "MySQL Connector/J". |
Kaya | MyDB | libmysqlclient |
See |
Lua | LuaSQL | libmysqlclient |
See |
.NET/Mono | Connector/Net | Native Driver | See Section 22.2, "MySQL Connector/Net". |
Objective Caml | OBjective Caml MySQL Bindings | libmysqlclient |
See |
Octave | Database bindings for GNU Octave | libmysqlclient |
See |
ODBC | Connector/ODBC | libmysqlclient |
See Section 22.1, "MySQL Connector/ODBC". |
Perl | DBI /DBD::mysql |
libmysqlclient |
See Section 22.10, "MySQL Perl API". |
Net::MySQL |
Native Driver | See Net::MySQL |
|
PHP | mysql , ext/mysql interface
(deprecated)
|
libmysqlclient |
See Section 22.9.2, "Original MySQL API (Mysql )".
|
mysqli , ext/mysqli interface |
libmysqlclient |
See Section 22.9.3, "MySQL Improved
Extension (Mysqli )".
|
|
PDO_MYSQL |
libmysqlclient |
See Section 22.9.4, "MySQL
Functions (PDO_MYSQL) (MySQL (PDO) )".
|
|
PDO mysqlnd | Native Driver | ||
Python | Connector/Python | Native Driver | See Section 22.6, "MySQL Connector/Python". |
MySQLdb | libmysqlclient |
See Section 22.11, "MySQL Python API". | |
Ruby | MySQL/Ruby | libmysqlclient |
Uses libmysqlclient . See Section
22.12.1, "The MySQL/Ruby API".
|
Ruby/MySQL | Native Driver | See Section 22.12.2, "The Ruby/MySQL API". | |
Scheme | Myscsh |
libmysqlclient |
See Myscsh |
SPL | sql_mysql |
libmysqlclient |
See sql_mysql for SPL |
Tcl | MySQLtcl | libmysqlclient |
See Section 22.13, "MySQL Tcl API". |
Table 22.2. MySQL Connector Versions and MySQL Server Versions
Connector | Connector version | MySQL Server version |
---|---|---|
Connector/C | 6.1.0 GA | 5.6, 5.5, 5.1, 5.0, 4.1 |
Connector/C++ | 1.0.5 GA | 5.6, 5.5, 5.1 |
Connector/J | 5.1.8 | 5.6, 5.5, 5.1, 5.0, 4.1 |
Connector/Net | 6.5 | 5.6, 5.5, 5.1, 5.0 |
Connector/Net | 6.4 | 5.6, 5.5, 5.1, 5.0 |
Connector/Net | 6.3 | 5.6, 5.5, 5.1, 5.0 |
Connector/Net | 6.2 (No longer supported) | 5.6, 5.5, 5.1, 5.0 |
Connector/Net | 6.1 (No longer supported) | 5.6, 5.5, 5.1, 5.0 |
Connector/Net | 6.0 (No longer supported) | 5.6, 5.5, 5.1, 5.0 |
Connector/Net | 5.2 (No longer supported) | 5.6, 5.5, 5.1, 5.0 |
Connector/Net | 1.0 (No longer supported) | 5.0, 4.0 |
Connector/ODBC | 5.1 | 5.6, 5.5, 5.1, 5.0, 4.1.1+ |
Connector/ODBC | 3.51 (Unicode not supported) | 5.6, 5.5, 5.1, 5.0, 4.1 |