Skip to content

Commit

Permalink
Import mysqlnd
Browse files Browse the repository at this point in the history
Patch ext/mysql and ext/mysqli to support mysqlnd
  • Loading branch information
faizshukri committed Oct 5, 2007
1 parent 9f9495a commit 8b9b553
Show file tree
Hide file tree
Showing 53 changed files with 17,238 additions and 1,225 deletions.
23 changes: 17 additions & 6 deletions ext/mysql/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [


PHP_ARG_WITH(mysql, for MySQL support,
[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory])
[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory.
If mysqlnd is passed as DIR, the MySQL native driver will be used])

PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
[ --with-mysql-sock[=DIR] MySQL: Location of the MySQL unix socket pointer.
Expand All @@ -51,9 +52,11 @@ if test -z "$PHP_ZLIB_DIR"; then
[ --with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix], no, no)
fi

if test "$PHP_MYSQL" = "mysqlnd"; then
dnl enables build of mysqnd library
PHP_MYSQLND_ENABLED=yes

if test "$PHP_MYSQL" != "no"; then
AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
elif test "$PHP_MYSQL" != "no"; then

AC_MSG_CHECKING([for MySQL UNIX socket location])
if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
Expand Down Expand Up @@ -137,14 +140,22 @@ Note that the MySQL client library is not bundled anymore!])
PHP_ADD_LIBRARY_WITH_PATH($MYSQL_LIBNAME, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD)
PHP_ADD_INCLUDE($MYSQL_INC_DIR)

PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared)

MYSQL_MODULE_TYPE=external
MYSQL_LIBS="-L$MYSQL_LIB_DIR -l$MYSQL_LIBNAME $MYSQL_LIBS"
MYSQL_INCLUDE=-I$MYSQL_INC_DIR

PHP_SUBST(MYSQL_SHARED_LIBADD)
PHP_SUBST_OLD(MYSQL_MODULE_TYPE)
PHP_SUBST_OLD(MYSQL_LIBS)
PHP_SUBST_OLD(MYSQL_INCLUDE)
fi

dnl Enable extension
if test "$PHP_MYSQL" != "no"; then
AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared)
PHP_SUBST(MYSQL_SHARED_LIBADD)

if test "$PHP_MYSQLI" = "mysqlnd"; then
PHP_ADD_EXTENSION_DEP(mysqli, mysqlnd)
fi
fi
15 changes: 10 additions & 5 deletions ext/mysql/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
ARG_WITH("mysql", "MySQL support", "no");

if (PHP_MYSQL != "no") {
if (CHECK_LIB("libmysql.lib", "mysql", PHP_MYSQL) &&
if (PHP_MYSQLI != "mysqlnd") {
if (CHECK_LIB("libmysql.lib", "mysql", PHP_MYSQL) &&
CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQL",
PHP_MYSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\mysql;" + PHP_MYSQL)) {
EXTENSION("mysql", "php_mysql.c");
AC_DEFINE('HAVE_MYSQL', 1, 'Have MySQL library');
PHP_MYSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\mysql;" + PHP_MYSQL)) {
} else {
WARNING("mysql not enabled; libraries and headers not found");
}
} else {
WARNING("mysql not enabled; libraries and headers not found");
AC_DEFINE('HAVE_MYSQLND', 1, 'MySQL native driver support enabled');
ADD_EXTENSION_DEP('mysql', 'mysqlnd', true);
}
EXTENSION("mysql", "php_mysql.c");
AC_DEFINE('HAVE_MYSQL', 1, 'Have MySQL library');
}
41 changes: 41 additions & 0 deletions ext/mysql/mysql_mysqlnd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Georg Richter <[email protected]> |
| Andrey Hristov <[email protected]> |
| Ulf Wendel <[email protected]> |
+----------------------------------------------------------------------+
*/

#ifndef MYSQL_MYSQLND_H
#define MYSQL_MYSQLND_H

#include "ext/mysqlnd/mysqlnd_libmysql_compat.h"

/* Here comes non-libmysql API to have less ifdefs in mysqli*/
#define MYSQLI_CLOSE_EXPLICIT MYSQLND_CLOSE_EXPLICIT
#define MYSQLI_CLOSE_IMPLICIT MYSQLND_CLOSE_IMPLICIT
#define MYSQLI_CLOSE_DISCONNECTED MYSQLND_CLOSE_DISCONNECTED

#define mysqli_result_is_unbuffered(r) ((r)->unbuf)
#define mysqli_server_status(c) (c)->upsert_status.server_status
#define mysqli_stmt_warning_count(s) mysqlnd_stmt_warning_count((s))
#define mysqli_stmt_server_status(s) (s)->upsert_status.server_status
#define mysqli_stmt_get_connection(s) (s)->conn
#define mysqli_close(c, how) mysqlnd_close((c), (how))
#define mysqli_stmt_close(c, implicit) mysqlnd_stmt_close((c), (implicit))
#define mysqli_free_result(r, implicit) mysqlnd_free_result((r), (implicit))

#endif
Loading

0 comments on commit 8b9b553

Please sign in to comment.