diff options
Diffstat (limited to 'ext/mysqli')
68 files changed, 0 insertions, 5230 deletions
diff --git a/ext/mysqli/CREDITS b/ext/mysqli/CREDITS deleted file mode 100644 index 68cfa8a4ae..0000000000 --- a/ext/mysqli/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -MySQLi -Zak Greant, Georg Richter diff --git a/ext/mysqli/EXPERIMENTAL b/ext/mysqli/EXPERIMENTAL deleted file mode 100644 index e69de29bb2..0000000000 --- a/ext/mysqli/EXPERIMENTAL +++ /dev/null diff --git a/ext/mysqli/TODO b/ext/mysqli/TODO deleted file mode 100644 index 6b457571f6..0000000000 --- a/ext/mysqli/TODO +++ /dev/null @@ -1,13 +0,0 @@ -- review/code inspection of the bind stuff -- test -- documentation -- benchmarks /ext/mysql vs. ext/mysqli -- testing/compiling under windows -- migration guide: - diffrences between ext/mysql and mysqli - not supported functions from ext/mysql (mysql_db_query) -- ini-settings -- phpinfo output (Status: mostly done, maybe some more information could be interesting) -- blob support for mysql_prepare -- multi query support (still open until there is a decision (MySQL AB)) -- bundled libmysql 4.1 diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4 deleted file mode 100644 index e7c34850b7..0000000000 --- a/ext/mysqli/config.m4 +++ /dev/null @@ -1,58 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension mysqli - -dnl Comments in this file start with the string 'dnl'. -dnl Remove where necessary. This file will not work -dnl without editing. - -dnl If your extension references something external, use with: - -PHP_ARG_WITH(mysqli, for mysqli support, -[ --with-mysqli[=DIR] Include mysqli support]) - -if test "$PHP_MYSQLI" != "no"; then - - SEARCH_PATH="/usr/local /usr" # you might want to change this - if test -r $PHP_MYSQLI/; then # path given as parameter - SEARCH_PATH=$PHP_MYSQLI - else - AC_MSG_CHECKING([for mysqli files in default path]) - fi - - for i in $SEARCH_PATH ; do - if test -r $i/include/mysql/mysql.h; then - MYSQLI_DIR=$i/lib/mysql - MYSQLI_INC_DIR=$i/include/mysql - AC_MSG_RESULT(found in $i) - elif test -r $i/include/mysql.h; then - MYSQLI_DIR=$i/lib - MYSQLI_INC_DIR=$i/include - AC_MSG_RESULT(found in $i) - fi - done - - if test -z "$MYSQLI_DIR"; then - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Please reinstall the mysqli distribution]) - fi - - # --with-mysqli -> add include path - PHP_ADD_INCLUDE($MYSQLI_INC_DIR) - - # --with-mysqli -> check for lib and symbol presence - LIBNAME=mysqlclient - LIBSYMBOL=mysql_bind_param - - PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, - [ - PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $MYSQLI_DIR, MYSQLI_SHARED_LIBADD) - AC_DEFINE(HAVE_MYSQLILIB,1,[ ]) - ],[ - AC_MSG_ERROR([wrong mysql library version or lib not found]) - ],[ - `$PHP_MYSQLI/bin/mysql_config --libs | sed -e "s/'//g"` - ]) - PHP_SUBST(MYSQLI_SHARED_LIBADD) - - PHP_NEW_EXTENSION(mysqli, mysqli.c mysqli_api.c mysqli_nonapi.c mysqli_fe.c, $ext_shared) -fi diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c deleted file mode 100644 index 361132784d..0000000000 --- a/ext/mysqli/mysqli.c +++ /dev/null @@ -1,421 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.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 | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Georg Richter <georg@php.net> | - +----------------------------------------------------------------------+ - - $Id$ -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <signal.h> - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/standard/php_string.h" -#include "php_mysqli.h" - - -#define MYSQLI_STORE_RESULT 0 -#define MYSQLI_USE_RESULT 1 - -ZEND_DECLARE_MODULE_GLOBALS(mysqli) - -static zend_object_handlers mysqli_object_handlers; - -/* {{{ php_clear_stmt_bind */ -void php_clear_stmt_bind(STMT *stmt) -{ - unsigned int i; - - if (stmt->stmt) { - mysql_stmt_close(stmt->stmt); - } - - if (stmt->var_cnt) { - for (i = 0; i < stmt->var_cnt; i++) { - if (stmt->type == FETCH_RESULT) { - if (stmt->bind[i].type == IS_STRING) { - efree(stmt->bind[i].buffer); - } - } - if (stmt->vars[i]) { - ZVAL_DELREF(stmt->vars[i]); - } - } - if (stmt->type == FETCH_RESULT) { - efree(stmt->bind); - } - efree(stmt->vars); - efree(stmt->is_null); - } - efree(stmt); - return; -} -/* }}} */ - -/* {{{ mysqli_objects_dtor - */ -static void mysqli_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC) -{ - mysqli_object *intern = (mysqli_object *)object; - - /* link object */ - if (intern->zo.ce == mysqli_link_class_entry) { - MYSQL *mysql = (MYSQL *)intern->ptr; - if (mysql) { - mysql_close(mysql); - } - } else if (intern->zo.ce == mysqli_stmt_class_entry) { /* stmt object */ - STMT *stmt = (STMT *)intern->ptr; - if (stmt) { - php_clear_stmt_bind(stmt); - } - } else if (intern->zo.ce == mysqli_result_class_entry) { /* result object */ - MYSQL_RES *res = (MYSQL_RES *)intern->ptr; - if (res) { - mysql_free_result(res); - } - } - zend_objects_destroy_object(object, handle TSRMLS_CC); -} -/* }}} */ - -/* {{{ mysqli_objects_clone - */ -static void mysqli_objects_clone(void *object, void **object_clone TSRMLS_DC) -{ - /* TODO */ -} -/* }}} */ - -/* {{{ mysqli_objects_new - */ -PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_type TSRMLS_DC) -{ - zend_object_value retval; - mysqli_object *intern; - zval *tmp; - - intern = emalloc(sizeof(mysqli_object)); - intern->zo.ce = class_type; - intern->zo.in_get = 0; - intern->zo.in_set = 0; - - ALLOC_HASHTABLE(intern->zo.properties); - zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); - - retval.handle = zend_objects_store_put(intern, mysqli_objects_dtor, mysqli_objects_clone TSRMLS_CC); - retval.handlers = &mysqli_object_handlers; - - return retval; -} -/* }}} */ - -/* {{{ mysqli_module_entry - */ -zend_module_entry mysqli_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 - STANDARD_MODULE_HEADER, -#endif - "mysqli", - mysqli_functions, - PHP_MINIT(mysqli), - PHP_MSHUTDOWN(mysqli), - PHP_RINIT(mysqli), /* Replace with NULL if there's nothing to do at request start */ - PHP_RSHUTDOWN(mysqli), /* Replace with NULL if there's nothing to do at request end */ - PHP_MINFO(mysqli), -#if ZEND_MODULE_API_NO >= 20010901 - "0.1", /* Replace with version number for your extension */ -#endif - STANDARD_MODULE_PROPERTIES -}; -/* }}} */ - -#ifdef COMPILE_DL_MYSQLI -ZEND_GET_MODULE(mysqli) -#endif - -/* {{{ PHP_INI_BEGIN -*/ -PHP_INI_BEGIN() - STD_PHP_INI_ENTRY_EX("mysqli.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_mysqli_globals, mysqli_globals, display_link_numbers) - STD_PHP_INI_ENTRY("mysqli.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, zend_mysqli_globals, mysqli_globals) - STD_PHP_INI_ENTRY("mysqli.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysqli_globals, mysqli_globals) - STD_PHP_INI_ENTRY("mysqli.default_pw", NULL, PHP_INI_ALL, OnUpdateString, default_pw, zend_mysqli_globals, mysqli_globals) - STD_PHP_INI_ENTRY("mysqli.default_port", "3306", PHP_INI_ALL, OnUpdateInt, default_port, zend_mysqli_globals, mysqli_globals) - STD_PHP_INI_ENTRY("mysqli.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysqli_globals, mysqli_globals) -PHP_INI_END() - -/* }}} */ - -/* {{{ php_mysqli_init_globals - */ -static void php_mysqli_init_globals(zend_mysqli_globals *mysqli_globals) -{ - mysqli_globals->num_links = 0; - mysqli_globals->max_links = 0; - mysqli_globals->default_port = 0; - mysqli_globals->default_host = NULL; - mysqli_globals->default_user = NULL; - mysqli_globals->default_pw = NULL; - mysqli_globals->default_socket = NULL; -} -/* }}} */ - -/* {{{ PHP_MINIT_FUNCTION - */ -PHP_MINIT_FUNCTION(mysqli) -{ - - ZEND_INIT_MODULE_GLOBALS(mysqli, php_mysqli_init_globals, NULL); - REGISTER_INI_ENTRIES(); - - memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - mysqli_object_handlers.clone_obj = zend_objects_store_clone_obj; - - REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods); - REGISTER_MYSQLI_CLASS_ENTRY("mysqli_result", mysqli_result_class_entry, mysqli_result_methods); - REGISTER_MYSQLI_CLASS_ENTRY("mysqli_stmt", mysqli_stmt_class_entry, mysqli_stmt_methods); - - /* mysqli_options */ - REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); - - /* mysqli_real_connect flags */ - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_MULTI_QUERIES", CLIENT_MULTI_QUERIES, CONST_CS | CONST_PERSISTENT); - - - /* for mysqli_query */ - REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_USE_RESULT", 1, CONST_CS | CONST_PERSISTENT); - - /* for mysqli_fetch_assoc */ - REGISTER_LONG_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT); - - - /* column information */ - REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_FLOAD", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); - - /* bindtypes for mysqli_bind_result */ - REGISTER_LONG_CONSTANT("MYSQLI_BIND_STRING", MYSQLI_BIND_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BIND_INT", MYSQLI_BIND_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BIND_DOUBLE", MYSQLI_BIND_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BIND_SEND_DATA", MYSQLI_BIND_SEND_DATA, CONST_CS | CONST_PERSISTENT); - - /* replication */ - REGISTER_LONG_CONSTANT("MYSQLI_RPL_MASTER", MYSQL_RPL_MASTER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_RPL_SLAVE", MYSQL_RPL_SLAVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_RPL_ADMIN", MYSQL_RPL_ADMIN, CONST_CS | CONST_PERSISTENT); - - /* bind blob support */ - REGISTER_LONG_CONSTANT("MYSQLI_NEED_DATA", MYSQL_NEED_DATA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MSHUTDOWN_FUNCTION - */ -PHP_MSHUTDOWN_FUNCTION(mysqli) -{ - /* uncomment this line if you have INI entries - UNREGISTER_INI_ENTRIES(); - */ - return SUCCESS; -} -/* }}} */ - -/* Remove if there's nothing to do at request start */ -/* {{{ PHP_RINIT_FUNCTION - */ -PHP_RINIT_FUNCTION(mysqli) -{ - MyG(error_msg) = NULL; - MyG(error_no) = 0; - - return SUCCESS; -} -/* }}} */ - -/* Remove if there's nothing to do at request end */ -/* {{{ PHP_RSHUTDOWN_FUNCTION - */ -PHP_RSHUTDOWN_FUNCTION(mysqli) -{ - if (MyG(error_msg)) { - efree(MyG(error_msg)); - } - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MINFO_FUNCTION - */ -PHP_MINFO_FUNCTION(mysqli) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "MysqlI Support", "enabled"); - php_info_print_table_row(2, "Client API version", mysql_get_client_info()); - php_info_print_table_row(2, "MYSQLI_SOCKET", MYSQL_UNIX_ADDR); - - - php_info_print_table_end(); - - DISPLAY_INI_ENTRIES(); -} -/* }}} */ - -/* {{{ php_mysqli_fetch_into_hash - */ -void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags) -{ - MYSQL_RES *result; - zval *mysql_result; - int fetchtype; - int copyflag; - unsigned int i; - MYSQL_FIELD *fields; - MYSQL_ROW row; - unsigned long *field_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() < 2 && !override_flags) { - fetchtype = MYSQLI_BOTH; - } - - if (override_flags) { - fetchtype = override_flags; - } - - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - fields = mysql_fetch_fields(result); - if (!(row = mysql_fetch_row(result))) { - RETURN_FALSE; - } - array_init(return_value); - field_len = mysql_fetch_lengths(result); - - for (i = 0; i < mysql_num_fields(result); i++) { - if (row[i]) { - char *column; - int column_len; - - /* check if we need magic quotes */ - if (PG(magic_quotes_runtime)) { - column = php_addslashes(row[i], field_len[i], &column_len, 0 TSRMLS_CC); - copyflag = 0; - } else { - column = row[i]; - column_len = field_len[i]; - copyflag = 1; - } - if (fetchtype & MYSQLI_NUM) { - add_index_stringl(return_value, i, column, column_len, copyflag); - copyflag = 1; - } - if (fetchtype & MYSQLI_ASSOC) { - add_assoc_stringl(return_value, fields[i].name, column, column_len, copyflag); - } - } else { - if (fetchtype & MYSQLI_NUM) { - add_index_null(return_value, i); - } - if (fetchtype & MYSQLI_ASSOC) { - add_assoc_null(return_value, fields[i].name); - } - } - } -} -/* }}} */ - -/* {{{ php_mysqli_set_error - */ -PHP_MYSQLI_API void php_mysqli_set_error(long mysql_errno, char *mysql_err TSRMLS_DC) -{ - MyG(error_no) = mysql_errno; - if (MyG(error_msg)) { - efree(MyG(error_msg)); - } - MyG(error_msg) = estrdup(mysql_err); -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/mysqli/mysqli.dsp b/ext/mysqli/mysqli.dsp deleted file mode 100755 index fc4ec4c5b8..0000000000 --- a/ext/mysqli/mysqli.dsp +++ /dev/null @@ -1,120 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mysqli" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mysqli - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mysqli.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mysqli.mak" CFG="mysqli - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mysqli - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysqli - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mysqli - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQLI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\mysqli" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MYSQLI" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MYSQLI_EXPORTS" /D "HAVE_ZLIB" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib zlib.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mysqli.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
-
-!ELSEIF "$(CFG)" == "mysqli - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQLI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\mysqli" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MYSQLI" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MYSQLI_EXPORTS" /D "HAVE_ZLIB" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib zlib.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mysqli.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mysqli - Win32 Release_TS"
-# Name "mysqli - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mysqli.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_api.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_fe.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_nonapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mysqli.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c deleted file mode 100644 index 79d75667d6..0000000000 --- a/ext/mysqli/mysqli_api.c +++ /dev/null @@ -1,1713 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.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 | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Georg Richter <georg@php.net> | - +----------------------------------------------------------------------+ - - $Id$ -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <signal.h> - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_mysqli.h" - - -/* {{{ proto mixed mysqli_affected_rows(resource link) -*/ -PHP_FUNCTION(mysqli_affected_rows) -{ - MYSQL *mysql; - zval *mysql_link; - my_ulonglong rc; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - rc = mysql_affected_rows(mysql); - MYSQLI_RETURN_LONG_LONG(rc); -} -/* }}} */ - -/* {{{ proto bool mysqli_autocommit(resource link, bool mode) -*/ -PHP_FUNCTION(mysqli_autocommit) -{ - MYSQL *mysql; - zval *mysql_link; - unsigned long automode; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_BOOL((long) mysql_autocommit(mysql, automode)); -} -/* }}} */ - -/* {{{ proto bool mysqli_bind_param(resource stmt, mixed, [mixed,....]) -*/ - -PHP_FUNCTION(mysqli_bind_param) -{ - zval ***args; - int argc = ZEND_NUM_ARGS(); - int i; - int num_vars; - int start = 0; - int ofs; - STMT *stmt; - MYSQL_BIND *bind; - zval **object; - - /* check if number of parameters > 2 and odd */ - if (argc < 3 || !(argc & 1)) { - WRONG_PARAM_COUNT; - } else { - num_vars = (argc - 1) / 2; - } - - args = (zval ***)emalloc(argc * sizeof(zval **)); - - if (zend_get_parameters_array_ex(argc, args) == FAILURE) { - efree(args); - WRONG_PARAM_COUNT; - } - - if (!getThis()) { - if (Z_TYPE_PP(args[0]) != IS_OBJECT) { - efree(args); - RETURN_FALSE; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, args[0], "mysqli_stmt"); - start = 1; - } else { - object = &(getThis()); - MYSQLI_FETCH_RESOURCE(stmt, STMT *, object, "mysqli_stmt"); - } - - - /* prevent leak if variables are already bound */ - if (stmt->var_cnt) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variables already bound"); - efree(args); - RETURN_FALSE; - } - stmt->is_null = ecalloc(num_vars, sizeof(char)); - bind = (MYSQL_BIND *)ecalloc(num_vars, sizeof(MYSQL_BIND)); - - for (i=start; i < num_vars * 2 + start; i+=2) { - ofs = (i - start) / 2; - if (!PZVAL_IS_REF(*args[i]) && Z_LVAL_PP(args[i+1]) != MYSQLI_BIND_SEND_DATA) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter %d wasn't passed by reference", i+1); - efree(bind); - efree(args); - RETURN_FALSE; - } - - /* set specified type */ - switch (Z_LVAL_PP(args[i+1])) { - case MYSQLI_BIND_DOUBLE: - bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE; - bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]); - bind[ofs].is_null = &stmt->is_null[ofs]; - break; - - case MYSQLI_BIND_INT: - bind[ofs].buffer_type = MYSQL_TYPE_LONG; - bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]); - bind[ofs].is_null = &stmt->is_null[ofs]; - break; - - case MYSQLI_BIND_SEND_DATA: - bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING; - bind[ofs].is_null = 0; - bind[ofs].length = 0; - break; - - case MYSQLI_BIND_STRING: - bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING; - bind[ofs].buffer = NULL; - bind[ofs].buffer_length = 0; - bind[ofs].is_null = &stmt->is_null[ofs]; - break; - - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Undefined fieldtype %d (parameter %d)", Z_LVAL_PP(args[i]), i+1); - efree(args); - efree(bind); - RETURN_FALSE; - break; - } - } - - if (mysql_bind_param(stmt->stmt, bind)) { - efree(args); - efree(bind); - RETURN_FALSE; - } - - stmt->var_cnt = num_vars; - stmt->type = FETCH_SIMPLE; - stmt->vars = (zval **)emalloc(num_vars * sizeof(zval)); - for (i = 0; i < num_vars*2; i+=2) { - if (Z_LVAL_PP(args[i+1+start]) != MYSQLI_BIND_SEND_DATA) { - ZVAL_ADDREF(*args[i+start]); - stmt->vars[i/2] = *args[i+start]; - } else { - stmt->vars[i/2] = NULL; - } - } - efree(args); - efree(bind); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_bind_result(resource stmt, mixed var, long len, [mixed,long....]) -*/ - -/* TODO: - do_alloca, free_alloca -*/ - -PHP_FUNCTION(mysqli_bind_result) -{ - zval ***args; - int argc = ZEND_NUM_ARGS(); - zval **object; - int i; - int start = 0; - int var_cnt; - int ofs; - long col_type; - STMT *stmt; - MYSQL_BIND *bind; - - if (argc < 2) { - WRONG_PARAM_COUNT; - } - - args = (zval ***)emalloc(argc * sizeof(zval **)); - - if (zend_get_parameters_array_ex(argc, args) == FAILURE) { - efree(args); - WRONG_PARAM_COUNT; - } - - if (!getThis()) { - if (Z_TYPE_PP(args[0]) != IS_OBJECT) { - efree(args); - RETURN_FALSE; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, args[0], "mysqli_stmt"); - start = 1; - } else { - object = &(getThis()); - MYSQLI_FETCH_RESOURCE(stmt, STMT *, object, "mysqli_stmt"); - } - - var_cnt = argc - start; - - /* prevent leak if variables are already bound */ - if (stmt->var_cnt) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variables already bound"); - efree(args); - RETURN_FALSE; - } - - bind = (MYSQL_BIND *)ecalloc(var_cnt, sizeof(MYSQL_BIND)); - stmt->bind = (BIND_BUFFER *)ecalloc(var_cnt,sizeof(BIND_BUFFER)); - stmt->is_null = (char *)ecalloc(var_cnt, sizeof(char)); - stmt->type = FETCH_RESULT; - - for (i=start; i < var_cnt + start ; i++) { - ofs = i - start; - stmt->is_null[ofs] = 0; - if (!PZVAL_IS_REF(*args[i])) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter %d wasn't passed by reference", i); - efree(bind); - efree(args); - php_clear_stmt_bind(stmt); - RETURN_FALSE; - } - - col_type = (stmt->stmt->fields) ? stmt->stmt->fields[ofs].type : MYSQL_TYPE_STRING; - - switch (col_type) { - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_DOUBLE: - case MYSQL_TYPE_FLOAT: - convert_to_double_ex(args[i]); - stmt->bind[ofs].type = IS_DOUBLE; - stmt->bind[ofs].buflen = 0; - bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE; - bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]); - bind[ofs].is_null = &stmt->is_null[ofs]; - break; - - case MYSQL_TYPE_SHORT: - case MYSQL_TYPE_TINY: - case MYSQL_TYPE_LONG: - case MYSQL_TYPE_INT24: - case MYSQL_TYPE_YEAR: - convert_to_long_ex(args[i]); - stmt->bind[ofs].type = IS_LONG; - stmt->bind[ofs].buflen = 0; - bind[ofs].buffer_type = MYSQL_TYPE_LONG; - bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]); - bind[ofs].is_null = &stmt->is_null[ofs]; - break; - - case MYSQL_TYPE_LONGLONG: - stmt->bind[ofs].type = IS_STRING; - stmt->bind[ofs].buflen = sizeof(my_ulonglong); - stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen); - bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG; - bind[ofs].buffer = stmt->bind[ofs].buffer; - bind[ofs].is_null = &stmt->is_null[ofs]; - bind[ofs].buffer_length = stmt->bind[ofs].buflen; - break; - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_TIME: - case MYSQL_TYPE_DATETIME: - case MYSQL_TYPE_NEWDATE: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_BLOB: - case MYSQL_TYPE_TIMESTAMP: - stmt->bind[ofs].type = IS_STRING; - stmt->bind[ofs].buflen = (stmt->stmt->fields) ? stmt->stmt->fields[ofs].length + 1: 256; - stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen); - bind[ofs].buffer_type = MYSQL_TYPE_STRING; - bind[ofs].buffer = stmt->bind[ofs].buffer; - bind[ofs].is_null = &stmt->is_null[ofs]; - bind[ofs].buffer_length = stmt->bind[ofs].buflen; - bind[ofs].length = &stmt->bind[ofs].buflen; - break; - } - } - - if (mysql_bind_result(stmt->stmt, bind)) { - efree(bind); - efree(args); - php_clear_stmt_bind(stmt); - RETURN_FALSE; - } - - stmt->var_cnt = var_cnt; - stmt->vars = (zval **)emalloc((var_cnt) * sizeof(zval)); - for (i = start; i < var_cnt+start; i++) { - ofs = i-start; - ZVAL_ADDREF(*args[i]); - stmt->vars[ofs] = *args[i]; - } - - efree(args); - efree(bind); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_change_user(resource link, string user, string password, string database) -*/ -PHP_FUNCTION(mysqli_change_user) -{ - MYSQL *mysql; - zval *mysql_link = NULL; - char *user, *password, *dbname; - int user_len, password_len, dbname_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osss", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_change_user(mysql, user, password, dbname)) { - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string mysqli_character_set_name(resource link) -*/ -PHP_FUNCTION(mysqli_character_set_name) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - RETURN_STRING((char *)mysql_character_set_name(mysql), 1); -} -/* }}} */ - -/* {{{ proto bool mysqli_close(resource link) - close connection */ -PHP_FUNCTION(mysqli_close) -{ - zval *mysql_link; - MYSQL *mysql; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - mysql_close(mysql); - MYSQLI_CLEAR_RESOURCE(&mysql_link); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_commit(resource link) -*/ -PHP_FUNCTION(mysqli_commit) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - RETURN_BOOL(mysql_commit(mysql)); -} -/* }}} */ - -/* {{{ proto void mysqli_data_seek(resource result) -*/ -PHP_FUNCTION(mysqli_data_seek) -{ - MYSQL_RES *result; - zval *mysql_result; - - long offset; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Orl", &mysql_result, mysqli_result_class_entry, &mysql_result, &offset) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - if (result->handle && result->handle->status == MYSQL_STATUS_USE_RESULT) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT"); - RETURN_LONG(0); - } - - mysql_data_seek(result, offset); - return; -} -/* }}} */ - -/* {{{ proto void mysqli_debug(string debug) -*/ -PHP_FUNCTION(mysqli_debug) -{ - char *debug; - int debug_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &debug, &debug_len) == FAILURE) { - return; - } - - mysql_debug(debug); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void mysqli_disable_reads_from_master(resource link) -*/ -PHP_FUNCTION(mysqli_disable_reads_from_master) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - mysql_disable_reads_from_master(mysql); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void mysqli_disable_rpl_parse(resource link) -*/ -PHP_FUNCTION(mysqli_disable_rpl_parse) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - mysql_disable_rpl_parse(mysql); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_dump_debug_info(resource link) -*/ -PHP_FUNCTION(mysqli_dump_debug_info) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_dump_debug_info(mysql)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void mysqli_enable_reads_from_master(resource link) -*/ -PHP_FUNCTION(mysqli_enable_reads_from_master) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - mysql_enable_reads_from_master(mysql); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void mysqli_enable_rpl_parse(resource link) -*/ -PHP_FUNCTION(mysqli_enable_rpl_parse) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - mysql_enable_rpl_parse(mysql); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int mysqli_errno(resource link) -*/ -PHP_FUNCTION(mysqli_errno) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - RETURN_LONG(mysql_errno(mysql)); -} -/* }}} */ - -/* {{{ proto string mysql_error(resource link) -*/ -PHP_FUNCTION(mysqli_error) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - RETURN_STRING((char *)mysql_error(mysql),1); -} -/* }}} */ - -/* {{{ proto int mysqli_execute(resource stmt) -*/ -PHP_FUNCTION(mysqli_execute) -{ - STMT *stmt; - zval *mysql_stmt; - unsigned int i; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - if (stmt->type == FETCH_SIMPLE) { - for (i = 0; i < stmt->var_cnt; i++) { - if (stmt->vars[i]) { - stmt->is_null[i] = (stmt->vars[i]->type == IS_NULL); - - switch (stmt->stmt->params[i].buffer_type) { - case MYSQL_TYPE_VAR_STRING: - convert_to_string_ex(&stmt->vars[i]); - stmt->stmt->params[i].buffer = Z_STRVAL_PP(&stmt->vars[i]); - stmt->stmt->params[i].buffer_length = strlen(Z_STRVAL_PP(&stmt->vars[i])); - break; - case MYSQL_TYPE_DOUBLE: - convert_to_double_ex(&stmt->vars[i]); - stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->vars[i]); - break; - case MYSQL_TYPE_LONG: - convert_to_long_ex(&stmt->vars[i]); - stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->vars[i]); - break; - default: - break; - } - } - } - } - - RETURN_LONG(mysql_execute(stmt->stmt)); -} -/* }}} */ - -/* {{{ proto int mysqli_fetch(resource stmt) -*/ -PHP_FUNCTION(mysqli_fetch) -{ - STMT *stmt; - zval *mysql_stmt; - unsigned int i; - ulong ret; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - /* reset buffers */ - - - for (i = 0; i < stmt->var_cnt; i++) { - if (stmt->bind[i].type == IS_STRING) { - memset(stmt->bind[i].buffer, 0, stmt->bind[i].buflen); - } - } - - if (!(ret = mysql_fetch(stmt->stmt))) { - - for (i = 0; i < stmt->var_cnt; i++) { - if (!stmt->is_null[i]) { - switch (stmt->bind[i].type) { - case IS_LONG: - stmt->vars[i]->type = IS_LONG; - break; - case IS_DOUBLE: - stmt->vars[i]->type = IS_DOUBLE; - break; - case IS_STRING: - if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_LONGLONG) { - char tmp[50]; - my_ulonglong lval; - memcpy (&lval, stmt->bind[i].buffer, sizeof(my_ulonglong)); - if (lval != (long)lval) { - /* even though lval is declared as unsigned, the value - * may be negative. Therefor we cannot use %llu and must - * user %lld. - */ - sprintf((char *)&tmp, "%lld", lval); - ZVAL_STRING(stmt->vars[i], tmp, 1); - } else { - ZVAL_LONG(stmt->vars[i], lval); - } - } else { - if (stmt->vars[i]->type == IS_STRING) { - efree(stmt->vars[i]->value.str.val); - } - ZVAL_STRING(stmt->vars[i], stmt->bind[i].buffer, 1); - } - break; - default: - break; - } - } else { - stmt->vars[i]->type = IS_NULL; - } - } - } - - RETURN_LONG(ret); -} -/* }}} */ - -/* {{{ proto int mysql_fetch_field (resource result) -*/ -PHP_FUNCTION(mysqli_fetch_field) -{ - MYSQL_RES *result; - zval *mysql_result; - MYSQL_FIELD *field; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - if (!(field = mysql_fetch_field(result))) { - RETURN_FALSE; - } - - object_init(return_value); - - add_property_string(return_value, "name",(field->name ? field->name : ""), 1); - add_property_string(return_value, "orgname",(field->org_name ? field->org_name : ""), 1); - add_property_string(return_value, "table",(field->table ? field->table : ""), 1); - add_property_string(return_value, "orgtable",(field->org_table ? field->org_table : ""), 1); - add_property_string(return_value, "def",(field->def ? field->def : ""), 1); - add_property_long(return_value, "max_length", field->max_length); - add_property_long(return_value, "flags", field->flags); - add_property_long(return_value, "type", field->type); - add_property_long(return_value, "decimals", field->decimals); -} -/* }}} */ - -/* {{{ proto int mysql_fetch_fields (resource result) -*/ -PHP_FUNCTION(mysqli_fetch_fields) -{ - MYSQL_RES *result; - zval *mysql_result; - MYSQL_FIELD *field; - zval *obj; - - unsigned int i; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - if (!(field = mysql_fetch_field(result))) { - RETURN_FALSE; - } - - array_init(return_value); - - for (i = 0; i < mysql_num_fields(result); i++) { - field = mysql_fetch_field_direct(result, i); - - - MAKE_STD_ZVAL(obj); - object_init(obj); - - add_property_string(obj, "name",(field->name ? field->name : ""), 1); - add_property_string(obj, "orgname",(field->org_name ? field->org_name : ""), 1); - add_property_string(obj, "table",(field->table ? field->table : ""), 1); - add_property_string(obj, "orgtable",(field->org_table ? field->org_table : ""), 1); - add_property_string(obj, "def",(field->def ? field->def : ""), 1); - add_property_long(obj, "max_length", field->max_length); - add_property_long(obj, "flags", field->flags); - add_property_long(obj, "type", field->type); - add_property_long(obj, "decimals", field->decimals); - - add_index_zval(return_value, i, obj); - } -} -/* }}} */ - -/* {{{ proto int mysql_fetch_field_direct (resource result, int offset) -*/ -PHP_FUNCTION(mysqli_fetch_field_direct) -{ - MYSQL_RES *result; - zval *mysql_result; - MYSQL_FIELD *field; - int offset; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - if (!(field = mysql_fetch_field_direct(result,offset))) { - RETURN_FALSE; - } - - object_init(return_value); - - add_property_string(return_value, "name",(field->name ? field->name : ""), 1); - add_property_string(return_value, "orgname",(field->org_name ? field->org_name : ""), 1); - add_property_string(return_value, "table",(field->table ? field->table : ""), 1); - add_property_string(return_value, "orgtable",(field->org_table ? field->org_table : ""), 1); - add_property_string(return_value, "def",(field->def ? field->def : ""), 1); - add_property_long(return_value, "max_length", field->max_length); - add_property_long(return_value, "flags", field->flags); - add_property_long(return_value, "type", field->type); - add_property_long(return_value, "decimals", field->decimals); -} -/* }}} */ - -/* {{{ proto array mysqli_fetch_lengths (resource result) -*/ -PHP_FUNCTION(mysqli_fetch_lengths) -{ - MYSQL_RES *result; - zval *mysql_result; - unsigned int i; - unsigned long *ret; - - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - if (!(ret = mysql_fetch_lengths(result))) { - RETURN_FALSE; - } - - array_init(return_value); - - for (i = 0; i < mysql_num_fields(result); i++) { - add_index_long(return_value, i, ret[i]); - } -} -/* }}} */ - -/* {{{ proto array mysqli_fetch_row (resource result) -*/ -PHP_FUNCTION(mysqli_fetch_row) -{ - php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_NUM); -} -/* }}} */ - -/* {{{ proto int mysqli_field_count(resource link) -*/ -PHP_FUNCTION(mysqli_field_count) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_LONG(mysql_field_count(mysql)); -} -/* }}} */ - -/* {{{ proto int mysqli_field_seek(resource link, int fieldnr) -*/ -PHP_FUNCTION(mysqli_field_seek) -{ - MYSQL_RES *result; - zval *mysql_result; - unsigned int fieldnr; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - if (fieldnr < 0 || fieldnr >= mysql_num_fields(result)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field offset is invalid for resultset"); - RETURN_FALSE; - } - - mysql_field_seek(result, fieldnr); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int mysqli_field_tell(resource result) -*/ -PHP_FUNCTION(mysqli_field_tell) -{ - MYSQL_RES *result; - zval *mysql_result; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - RETURN_LONG(mysql_field_tell(result)); -} -/* }}} */ - -/* {{{ proto int mysqli_free_result(resource result) -*/ -PHP_FUNCTION(mysqli_free_result) -{ - MYSQL_RES *result; - zval *mysql_result; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - mysql_free_result(result); - MYSQLI_CLEAR_RESOURCE(&mysql_result); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string mysqli_get_client_info -*/ -PHP_FUNCTION(mysqli_get_client_info) -{ - RETURN_STRING((char *)mysql_get_client_info(), 1); -} -/* }}} */ - -/* {{{ proto string mysqli_get_host_info -*/ -PHP_FUNCTION(mysqli_get_host_info) -{ - MYSQL *mysql; - zval *mysql_link = NULL; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_STRING((char *)mysql_get_host_info(mysql), 1); -} -/* }}} */ - -/* {{{ proto int mysqli_get_proto_info -*/ -PHP_FUNCTION(mysqli_get_proto_info) -{ - MYSQL *mysql; - zval *mysql_link = NULL; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_LONG(mysql_get_proto_info(mysql)); -} -/* }}} */ - -/* {{{ proto string mysqli_get_server_info -*/ -PHP_FUNCTION(mysqli_get_server_info) -{ - MYSQL *mysql; - zval *mysql_link = NULL; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_STRING((char *)mysql_get_server_info(mysql), 1); -} - -/* }}} */ - -/* {{{ proto int mysqli_get_server_version -*/ -PHP_FUNCTION(mysqli_get_server_version) -{ - MYSQL *mysql; - zval *mysql_link = NULL; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_LONG(mysql_get_server_version(mysql)); -} - -/* }}} */ - -/* {{{ proto string mysqli_info(resource link) -*/ -PHP_FUNCTION(mysqli_info) -{ - MYSQL *mysql; - char *info = NULL; - zval *mysql_link = NULL; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (!(info = (char *)mysql_info(mysql))) { - RETURN_FALSE; - } - - RETURN_STRING(info, 1); -} -/* }}} */ - -/* {{{ resource mysqli_init(void) - initialize mysqli */ -PHP_FUNCTION(mysqli_init) -{ - MYSQL *mysql = mysql_init(NULL); - MYSQLI_RETURN_RESOURCE(mysql, mysqli_link_class_entry); -} -/* }}} */ - -/* {{{ proto mixed mysqli_insert_id(resource link) -*/ -PHP_FUNCTION(mysqli_insert_id) -{ - MYSQL *mysql; - my_ulonglong rc; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - rc = mysql_insert_id(mysql); - MYSQLI_RETURN_LONG_LONG(rc) -} -/* }}} */ - -/* {{{ proto bool mysqli_kill(resource link, int processid) -*/ -PHP_FUNCTION(mysqli_kill) -{ - MYSQL *mysql; - zval *mysql_link; - int processid; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_kill(mysql, processid)) { - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_master_query(resource link, string query) -*/ -PHP_FUNCTION(mysqli_master_query) { - MYSQL *mysql; - zval *mysql_link; - char *query = NULL; - unsigned int query_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_master_query(mysql, query, query_len)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int mysqli_num_fields(resource result) -*/ -PHP_FUNCTION(mysqli_num_fields) -{ - MYSQL_RES *result; - zval *mysql_result; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - - RETURN_LONG(mysql_num_fields(result)); -} -/* }}} */ - -/* {{{ proto int mysqli_num_rows(resource result) -*/ -PHP_FUNCTION(mysqli_num_rows) -{ - MYSQL_RES *result; - zval *mysql_result; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); - - if (result->handle && result->handle->status == MYSQL_STATUS_USE_RESULT) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT"); - RETURN_LONG(0); - } - - RETURN_LONG(mysql_num_rows(result)); -} -/* }}} */ - -/* {{{ proto bool mysqli_options(resource link, int flags, mixed values) - set options */ -PHP_FUNCTION(mysqli_options) -{ - MYSQL *mysql; - zval *mysql_link = NULL; - zval *mysql_value; - long mysql_option; - unsigned int l_value; - long ret; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oslz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - switch (Z_TYPE_PP(&mysql_value)) { - case IS_STRING: - ret = mysql_options(mysql, mysql_option, Z_STRVAL_PP(&mysql_value)); - break; - default: - convert_to_long_ex(&mysql_value); - l_value = Z_LVAL_PP(&mysql_value); - ret = mysql_options(mysql, mysql_option, (char *)&l_value); - break; - } - - if (ret != 0) { - RETURN_FALSE; - } else { - RETURN_TRUE; - } -} -/* }}} */ - -/* {{{ proto int mysqli_param_count(resource stmt) { - return the number of parameter for the given statement */ -PHP_FUNCTION(mysqli_param_count) -{ - STMT *stmt; - zval *mysql_stmt; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - RETURN_LONG(mysql_param_count(stmt->stmt)); -} -/* }}} */ - -/* {{{ proto int mysqli_ping(resource link) -*/ -PHP_FUNCTION(mysqli_ping) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - RETURN_LONG(mysql_ping(mysql)); -} -/* }}} */ - -/* {{{ proto resource mysqli_prepare(resource link, char* query) - */ -PHP_FUNCTION(mysqli_prepare) -{ - MYSQL *mysql; - STMT *stmt; - char *query = NULL; - unsigned int query_len; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",&mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - stmt = (STMT *)ecalloc(1,sizeof(STMT)); - stmt->var_cnt = 0; - stmt->stmt = mysql_prepare(mysql, query, query_len); - - if (!stmt->stmt) { - efree(stmt); - RETURN_FALSE; - } - - MYSQLI_RETURN_RESOURCE(stmt, mysqli_stmt_class_entry); -} -/* }}} */ - -/* {{{ proto resource mysqli_prepare_result(stmt) -*/ -PHP_FUNCTION(mysqli_prepare_result) -{ - STMT *stmt; - MYSQL_RES *result; - zval *mysql_stmt; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - if (!(result = mysql_prepare_result(stmt->stmt))){ - RETURN_FALSE; - } - - MYSQLI_RETURN_RESOURCE(result, mysqli_result_class_entry); -} -/* }}} */ - -/* {{{ proto bool mysqli_read_query_result(resource link) -*/ -PHP_FUNCTION(mysqli_read_query_result) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_read_query_result(mysql)) { - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_real_connect(resource link, [string hostname, [string username, [string passwd, [string dbname, [int port, [string socket]]]]]) - open a connection to a mysql server */ -PHP_FUNCTION(mysqli_real_connect) -{ - MYSQL *mysql; - char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL; - unsigned int hostname_len, username_len, passwd_len, dbname_len, socket_len; - unsigned int port=0, flags=0; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|sssslsl", &mysql_link, mysqli_link_class_entry, - &hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len, - &flags) == FAILURE) { - return; - } - - if (!socket_len) { - socket = NULL; - } - - /* TODO: safe mode handling */ - if (PG(sql_safe_mode)) { - } else { - if (!passwd) { - passwd = MyG(default_pw); - if (!username){ - username = MyG(default_user); - if (!hostname) { - hostname = MyG(default_host); - } - } - } - } - - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_real_connect(mysql,hostname,username,passwd,dbname,port,socket,flags) == NULL) { - /* Save error messages */ - php_mysqli_set_error(mysql_errno(mysql), (char *)mysql_error(mysql) TSRMLS_CC); - - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysql_error(mysql)); - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_real_query(resource link, string query) -*/ -PHP_FUNCTION(mysqli_real_query) -{ - MYSQL *mysql; - zval *mysql_link; - char *query = NULL; - unsigned int query_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_real_query(mysql, query, query_len)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string mysqli_real_escape_string(resource link, string escapestr) - close statement */ -PHP_FUNCTION(mysqli_real_escape_string) { - MYSQL *mysql; - zval *mysql_link = NULL; - char *escapestr, *newstr; - int escapestr_len, newstr_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &escapestr, &escapestr_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - newstr = emalloc(2 * escapestr_len + 1); - newstr_len = mysql_real_escape_string(mysql, newstr, escapestr, escapestr_len); - newstr = erealloc(newstr, newstr_len + 1); - - RETURN_STRING(newstr, 0); -} -/* }}} */ - -/* {{{ proto bool mysqli_reload (resource link) -*/ -PHP_FUNCTION(mysqli_reload) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_BOOL(!mysql_reload(mysql)); -} -/* }}} */ - -/* {{{ proto bool mysqli_rollback(resource link) -*/ -PHP_FUNCTION(mysqli_rollback) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_BOOL(mysql_rollback(mysql)); -} -/* }}} */ - -/* {{{ proto int mysqli_rpl_parse_enabled(resource link) -*/ -PHP_FUNCTION(mysqli_rpl_parse_enabled) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_LONG(mysql_rpl_parse_enabled(mysql)); -} -/* }}} */ - -/* {{{ proto bool mysqli_rpl_probe(resource link) -*/ -PHP_FUNCTION(mysqli_rpl_probe) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - - if (mysql_rpl_probe(mysql)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int mysqli_rpl_query_type(string query) -*/ -PHP_FUNCTION(mysqli_rpl_query_type) -{ - MYSQL *mysql; - zval *mysql_link; - char *query; - int query_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_LONG(mysql_rpl_query_type(query, query_len)); -} -/* }}} */ - -/* {{{ proto bool mysqli_send_long_data(resource stmt, long param_nr, string data) -*/ -PHP_FUNCTION(mysqli_send_long_data) -{ - STMT *stmt; - zval *mysql_stmt; - char *data; - long param_nr, data_len; - - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - if (!param_nr) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter number"); - RETURN_FALSE; - } - param_nr--; - - if (mysql_send_long_data(stmt->stmt, param_nr, data, data_len)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_send_query(resource link, string query) -*/ -PHP_FUNCTION(mysqli_send_query) -{ - MYSQL *mysql; - zval *mysql_link; - char *query = NULL; - unsigned int query_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_send_query(mysql, query, query_len)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysqli_slave_query(resource link, string query) -*/ -PHP_FUNCTION(mysqli_slave_query) -{ - MYSQL *mysql; - zval *mysql_link; - char *query = NULL; - unsigned int query_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_slave_query(mysql, query, query_len)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto resource mysqli_store_result(resource link) -*/ -PHP_FUNCTION(mysqli_store_result) -{ - MYSQL *mysql; - MYSQL_RES *result; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (!(result = mysql_store_result(mysql))) { - RETURN_FALSE; - } - MYSQLI_RETURN_RESOURCE(result, mysqli_result_class_entry); -} -/* }}} */ - -/* {{{ proto mixed mysqli_stmt_affected_rows(object stmt) -*/ -PHP_FUNCTION(mysqli_stmt_affected_rows) -{ - STMT *stmt; - zval *mysql_stmt; - my_ulonglong rc; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - rc = mysql_stmt_affected_rows(stmt->stmt); - MYSQLI_RETURN_LONG_LONG(rc) -} -/* }}} */ - -/* {{{ proto bool mysqli_stmt_close(resource stmt) - close statement */ -PHP_FUNCTION(mysqli_stmt_close) -{ - STMT *stmt; - zval *mysql_stmt; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - mysql_stmt_close(stmt->stmt); - stmt->stmt = NULL; - php_clear_stmt_bind(stmt); - MYSQLI_CLEAR_RESOURCE(&mysql_stmt); - RETURN_TRUE; - -} -/* }}} */ - -/* {{{ proto string mysqli_select_db(resource link, string dbname) -*/ -PHP_FUNCTION(mysqli_select_db) -{ - MYSQL *mysql; - zval *mysql_link; - char *dbname; - int dbname_len; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &mysql_link, mysqli_link_class_entry, &dbname, &dbname_len) == FAILURE) { - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &dbname, &dbname_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (!mysql_select_db(mysql, dbname)) { - RETURN_TRUE; - } - - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string mysqli_ssl_set(resource link, [string key, [string cert, [string ca, [string capath, [string cipher]]]]]) -*/ -PHP_FUNCTION(mysqli_ssl_set) -{ - MYSQL *mysql; - zval *mysql_link; - char *key=NULL, *cert=NULL, *ca=NULL, *capath=NULL, *cipher=NULL; - int key_len, cert_len, ca_len, capath_len, cipher_len; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, - &key, &key_len, &cert, &cert_len, &ca, &ca_len, &capath, &capath_len, &cipher, &cipher_len) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - mysql_ssl_set(mysql, key, cert, ca, capath, cipher); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string mysqli_stat -*/ -PHP_FUNCTION(mysqli_stat) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_STRING((char *)mysql_stat(mysql), 1); -} - -/* }}} */ - -/* {{{ proto int mysqli_stmt_errno(resource stmt) -*/ -PHP_FUNCTION(mysqli_stmt_errno) -{ - STMT *stmt; - zval *mysql_stmt; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - RETURN_LONG(mysql_stmt_errno(stmt->stmt)); -} -/* }}} */ - -/* {{{ proto string mysqli_stmt_error(resource stmt) -*/ -PHP_FUNCTION(mysqli_stmt_error) -{ - STMT *stmt; - zval *mysql_stmt; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - RETURN_STRING((char *)mysql_stmt_error(stmt->stmt),1); -} -/* }}} */ - -/* {{{ bool resource mysqli_stmt_store_result(stmt) -*/ -PHP_FUNCTION(mysqli_stmt_store_result) -{ - STMT *stmt; - zval *mysql_stmt; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); - - if (mysql_stmt_store_result(stmt->stmt)){ - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ -/* {{{ proto int mysqli_thread_id(resource link) -*/ - -PHP_FUNCTION(mysqli_thread_id) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_LONG(mysql_thread_id(mysql)); -} -/* }}} */ - -/* {{{ proto bool mysqli_thread_safe(void) -*/ -PHP_FUNCTION(mysqli_thread_safe) -{ - RETURN_BOOL(mysql_thread_safe()); -} - -/* }}} */ - -/* {{{ proto resource mysqli_use_result(resource link) -*/ -PHP_FUNCTION(mysqli_use_result) -{ - MYSQL *mysql; - MYSQL_RES *result; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (!(result = mysql_use_result(mysql))) { - RETURN_FALSE; - } - MYSQLI_RETURN_RESOURCE(result, mysqli_result_class_entry); -} -/* }}} */ - -/* {{{ proto resource mysqli_warning_count (resource link) -*/ -PHP_FUNCTION(mysqli_warning_count) -{ - MYSQL *mysql; - zval *mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - RETURN_LONG(mysql_warning_count(mysql)); -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c deleted file mode 100644 index b7e00e0b80..0000000000 --- a/ext/mysqli/mysqli_fe.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2002 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.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 | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Georg Richter <georg@php.net> | - +----------------------------------------------------------------------+ - - $Id$ -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <signal.h> - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_mysqli.h" - - -/* {{{ mysqli_functions[] - * - * Every user visible function must have an entry in mysqli_functions[]. - */ -function_entry mysqli_functions[] = { - PHP_FE(mysqli_affected_rows, NULL) - PHP_FE(mysqli_autocommit, NULL) - PHP_FE(mysqli_bind_param, NULL) - PHP_FE(mysqli_bind_result, NULL) - PHP_FE(mysqli_change_user, NULL) - PHP_FE(mysqli_character_set_name, NULL) - PHP_FALIAS(mysqli_client_encoding, - mysqli_character_set_name, NULL) - PHP_FE(mysqli_close, NULL) - PHP_FE(mysqli_commit, NULL) - PHP_FE(mysqli_connect, NULL) - PHP_FE(mysqli_data_seek, NULL) - PHP_FE(mysqli_debug, NULL) - PHP_FE(mysqli_disable_reads_from_master, NULL) - PHP_FE(mysqli_disable_rpl_parse, NULL) - PHP_FE(mysqli_dump_debug_info, NULL) - PHP_FE(mysqli_enable_reads_from_master, NULL) - PHP_FE(mysqli_enable_rpl_parse, NULL) - PHP_FE(mysqli_errno, NULL) - PHP_FE(mysqli_error, NULL) - PHP_FE(mysqli_execute, NULL) - PHP_FE(mysqli_fetch, NULL) - PHP_FE(mysqli_fetch_field, NULL) - PHP_FE(mysqli_fetch_fields, NULL) - PHP_FE(mysqli_fetch_field_direct, NULL) - PHP_FE(mysqli_fetch_lengths, NULL) - PHP_FE(mysqli_fetch_array, NULL) - PHP_FE(mysqli_fetch_assoc, NULL) - PHP_FE(mysqli_fetch_object, NULL) - PHP_FE(mysqli_fetch_row, NULL) - PHP_FE(mysqli_field_count, NULL) - PHP_FE(mysqli_field_seek, NULL) - PHP_FE(mysqli_field_tell, NULL) - PHP_FE(mysqli_free_result, NULL) - PHP_FE(mysqli_get_client_info, NULL) - PHP_FE(mysqli_get_host_info, NULL) - PHP_FE(mysqli_get_proto_info, NULL) - PHP_FE(mysqli_get_server_info, NULL) - PHP_FE(mysqli_get_server_version, NULL) - PHP_FE(mysqli_init, NULL) - PHP_FE(mysqli_info, NULL) - PHP_FE(mysqli_insert_id, NULL) - PHP_FE(mysqli_kill, NULL) - PHP_FE(mysqli_master_query, NULL) - PHP_FE(mysqli_num_fields, NULL) - PHP_FE(mysqli_num_rows, NULL) - PHP_FE(mysqli_options, NULL) - PHP_FE(mysqli_param_count, NULL) - PHP_FE(mysqli_ping, NULL) - PHP_FE(mysqli_prepare, NULL) - PHP_FE(mysqli_prepare_result, NULL) - PHP_FE(mysqli_query, NULL) - PHP_FE(mysqli_read_query_result, NULL) - PHP_FE(mysqli_real_connect, NULL) - PHP_FE(mysqli_real_escape_string, NULL) - PHP_FALIAS(mysqli_escape_string, - mysqli_real_escape_string, NULL) - PHP_FE(mysqli_real_query, NULL) - PHP_FE(mysqli_reload, NULL) - PHP_FE(mysqli_rollback, NULL) - PHP_FE(mysqli_rpl_parse_enabled, NULL) - PHP_FE(mysqli_rpl_probe, NULL) - PHP_FE(mysqli_rpl_query_type, NULL) - PHP_FE(mysqli_select_db, NULL) - PHP_FE(mysqli_send_long_data, NULL) - PHP_FE(mysqli_send_query, NULL) - PHP_FALIAS(mysqli_set_opt, mysqli_options, NULL) - PHP_FE(mysqli_slave_query, NULL) - PHP_FE(mysqli_ssl_set, NULL) - PHP_FE(mysqli_stat, NULL) - PHP_FE(mysqli_stmt_affected_rows, NULL) - PHP_FE(mysqli_stmt_close, NULL) - PHP_FE(mysqli_stmt_errno, NULL) - PHP_FE(mysqli_stmt_error, NULL) - PHP_FE(mysqli_store_result, NULL) - PHP_FE(mysqli_stmt_store_result, NULL) - PHP_FE(mysqli_thread_id, NULL) - PHP_FE(mysqli_thread_safe, NULL) - PHP_FE(mysqli_use_result, NULL) - PHP_FE(mysqli_warning_count, NULL) - {NULL, NULL, NULL} /* Must be the last line in mysqli_functions[] */ -}; -/* }}} */ - -/* {{{ mysqli_link_methods[] - * - * Every user visible function must have an entry in mysqli_functions[]. - */ -function_entry mysqli_link_methods[] = { - PHP_FALIAS(affected_rows,mysqli_affected_rows,NULL) - PHP_FALIAS(auto_commit,mysqli_autocommit,NULL) - PHP_FALIAS(change_user,mysqli_change_user,NULL) - PHP_FALIAS(character_set_name,mysqli_character_set_name,NULL) - PHP_FALIAS(client_encoding, mysqli_character_set_name,NULL) - PHP_FALIAS(close,mysqli_close,NULL) - PHP_FALIAS(commit,mysqli_commit,NULL) - PHP_FALIAS(connect,mysqli_connect,NULL) - PHP_FALIAS(debug,mysqli_debug,NULL) - PHP_FALIAS(disable_reads_from_master,mysqli_disable_reads_from_master,NULL) - PHP_FALIAS(disable_rpl_parse,mysqli_disable_rpl_parse,NULL) - PHP_FALIAS(dump_debug_info,mysqli_dump_debug_info,NULL) - PHP_FALIAS(enable_reads_from_master,mysqli_enable_reads_from_master,NULL) - PHP_FALIAS(enable_rpl_parse,mysqli_enable_rpl_parse,NULL) - PHP_FALIAS(errno,mysqli_errno,NULL) - PHP_FALIAS(error,mysqli_error,NULL) - PHP_FALIAS(get_client_info,mysqli_get_client_info,NULL) - PHP_FALIAS(get_host_info,mysqli_get_host_info,NULL) - PHP_FALIAS(get_proto_info,mysqli_get_proto_info,NULL) - PHP_FALIAS(get_server_info,mysqli_get_server_info,NULL) - PHP_FALIAS(get_server_version,mysqli_get_server_version,NULL) - PHP_FALIAS(init,mysqli_init,NULL) - PHP_FALIAS(info,mysqli_info,NULL) - PHP_FALIAS(insert_id,mysqli_insert_id,NULL) - PHP_FALIAS(kill,mysqli_kill,NULL) - PHP_FALIAS(master_query,mysqli_master_query,NULL) - PHP_FALIAS(options,mysqli_options,NULL) - PHP_FALIAS(ping,mysqli_ping,NULL) - PHP_FALIAS(prepare,mysqli_prepare,NULL) - PHP_FALIAS(query,mysqli_query,NULL) - PHP_FALIAS(read_query_result,mysqli_read_query_result,NULL) - PHP_FALIAS(real_connect,mysqli_real_connect,NULL) - PHP_FALIAS(real_escape_string,mysqli_real_escape_string,NULL) - PHP_FALIAS(escape_string, mysqli_real_escape_string,NULL) - PHP_FALIAS(real_query,mysqli_real_query,NULL) - PHP_FALIAS(reload,mysqli_reload,NULL) - PHP_FALIAS(rollback,mysqli_rollback,NULL) - PHP_FALIAS(rpl_parse_enabled,mysqli_rpl_parse_enabled,NULL) - PHP_FALIAS(rpl_probe,mysqli_rpl_probe,NULL) - PHP_FALIAS(rpl_query_type,mysqli_rpl_query_type,NULL) - PHP_FALIAS(select_db,mysqli_select_db,NULL) - PHP_FALIAS(set_opt, mysqli_options,NULL) - PHP_FALIAS(slave_query,mysqli_slave_query,NULL) - PHP_FALIAS(ssl_set,mysqli_ssl_set,NULL) - PHP_FALIAS(stat,mysqli_stat,NULL) - PHP_FALIAS(store_result,mysqli_store_result,NULL) - PHP_FALIAS(thread_id, mysqli_thread_id,NULL) - PHP_FALIAS(thread_safe,mysqli_thread_safe,NULL) - PHP_FALIAS(use_result,mysqli_use_result,NULL) - PHP_FALIAS(warning_count,mysqli_warning_count,NULL) - {NULL, NULL, NULL} -}; -/* }}} */ - -/* {{{ mysqli_result_methods[] - * - * Every user visible function must have an entry in mysqli_result_functions[]. - */ -function_entry mysqli_result_methods[] = { - PHP_FALIAS(close,mysqli_free_result,NULL) - PHP_FALIAS(data_seek,mysqli_data_seek,NULL) - PHP_FALIAS(fetch_field,mysqli_fetch_field,NULL) - PHP_FALIAS(fetch_fields,mysqli_fetch_fields,NULL) - PHP_FALIAS(fetvh_field_direct,mysqli_fetch_field_direct,NULL) - PHP_FALIAS(fetch_lengths,mysqli_fetch_lengths,NULL) - PHP_FALIAS(fetch_array,mysqli_fetch_array,NULL) - PHP_FALIAS(fetch_assoc,mysqli_fetch_assoc,NULL) - PHP_FALIAS(fetch_object,mysqli_fetch_object,NULL) - PHP_FALIAS(fetch_row,mysqli_fetch_row,NULL) - PHP_FALIAS(field_count,mysqli_field_count,NULL) - PHP_FALIAS(field_seek,mysqli_field_seek,NULL) - PHP_FALIAS(field_tell,mysqli_field_tell,NULL) - PHP_FALIAS(free_result,mysqli_free_result,NULL) - PHP_FALIAS(num_fields,mysqli_num_fields,NULL) - PHP_FALIAS(num_rows,mysqli_num_rows,NULL) - {NULL, NULL, NULL} -}; -/* }}} */ - -/* {{{ mysqli_stmt_methods[] - * - * Every user visible function must have an entry in mysqli_stmt_functions[]. - */ -function_entry mysqli_stmt_methods[] = { - PHP_FALIAS(affected_rows,mysqli_stmt_affected_rows,NULL) - PHP_FALIAS(bind_param,mysqli_bind_param,NULL) - PHP_FALIAS(bind_result,mysqli_bind_result,NULL) - PHP_FALIAS(execute,mysqli_execute,NULL) - PHP_FALIAS(fetch,mysqli_fetch,NULL) - PHP_FALIAS(param_count,mysqli_param_count,NULL) - PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL) - PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL) - PHP_FALIAS(close,mysqli_stmt_close,NULL) - PHP_FALIAS(errno,mysqli_stmt_errno,NULL) - PHP_FALIAS(error,mysqli_stmt_error,NULL) - {NULL, NULL, NULL} -}; -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c deleted file mode 100644 index a988926173..0000000000 --- a/ext/mysqli/mysqli_nonapi.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2002 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.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 | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Georg Richter <georg@php.net> | - +----------------------------------------------------------------------+ - - $Id$ -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <signal.h> - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_mysqli.h" - -/* {{{ proto resource mysqli_connect([string hostname, [string username, [string passwd, [string dbname, [int port, [string socket]]]]]) - open a connection to a mysql server */ -PHP_FUNCTION(mysqli_connect) -{ - MYSQL *mysql; - zval *object = getThis(); - char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL; - unsigned int hostname_len, username_len, passwd_len, dbname_len, socket_len; - unsigned int port=0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssls", &hostname, &hostname_len, &username, &username_len, - &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len) == FAILURE) { - return; - } - - /* TODO: safe mode handling */ - if (PG(sql_safe_mode)){ - } else { - if (!passwd) { - passwd = MyG(default_pw); - if (!username){ - username = MyG(default_user); - if (!hostname) { - hostname = MyG(default_host); - } - } - } - } - mysql = mysql_init(NULL); - - if (mysql_real_connect(mysql,hostname,username,passwd,dbname,port,socket,0) == NULL) { - /* Save error messages */ - - php_mysqli_set_error(mysql_errno(mysql), (char *) mysql_error(mysql) TSRMLS_CC); - - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysql_error(mysql)); - /* free mysql structure */ - mysql_close(mysql); - RETURN_FALSE; - } - - if (!object) { - MYSQLI_RETURN_RESOURCE(mysql, mysqli_link_class_entry); - } else { - ((mysqli_object *) zend_object_store_get_object(object TSRMLS_CC))->ptr = mysql; - } -} -/* }}} */ - -/* {{{ proto array mysqli_fetch_array (resource result, [int resulttype]) -*/ -PHP_FUNCTION(mysqli_fetch_array) -{ - php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto array mysqli_fetch_assoc (resource result) -*/ -PHP_FUNCTION(mysqli_fetch_assoc) -{ - php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_ASSOC); -} -/* }}} */ - -/* {{{ proto array mysqli_fetch_object (resource result) -*/ -PHP_FUNCTION(mysqli_fetch_object) -{ - php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_ASSOC); - - if (Z_TYPE_P(return_value) == IS_ARRAY) { - object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value)); - } -} -/* }}} */ - -/* {{{ proto resource mysqli_query(resource link, string query, [int resultmode]) -*/ -PHP_FUNCTION(mysqli_query) { - MYSQL *mysql; - zval *mysql_link; - MYSQL_RES *result; - char *query = NULL; - unsigned int query_len; - unsigned int resultmode = 0; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link"); - - if (mysql_real_query(mysql, query, query_len)) { - RETURN_FALSE; - } - - if (!mysql_field_count(mysql)) { - RETURN_FALSE; - } - - result = (resultmode == MYSQLI_USE_RESULT) ? mysql_use_result(mysql) : mysql_store_result(mysql); - if (!result) { - RETURN_FALSE; - } - MYSQLI_RETURN_RESOURCE(result, mysqli_result_class_entry); -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h deleted file mode 100644 index be3c67d439..0000000000 --- a/ext/mysqli/php_mysqli.h +++ /dev/null @@ -1,277 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.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 | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Georg Richter <georg@php.net> | - +----------------------------------------------------------------------+ - - $Id$ -*/ - -/* A little hack to prevent build break, when mysql is used together with - * c-client, which also defines LIST. - */ -#ifdef LIST -#undef LIST -#endif - -#include <mysql.h> - -#ifndef PHP_MYSQLI_H -#define PHP_MYSQLI_H - -typedef struct { - ulong buflen; - char *buffer; - ulong type; -} BIND_BUFFER; - -typedef struct { - MYSQL_STMT *stmt; - unsigned int var_cnt; - zval **vars; - BIND_BUFFER *bind; - char *is_null; - char type; -} STMT; - -typedef struct _mysqli_object { - zend_object zo; - void *ptr; -} mysqli_object; /* extends zend_object */ - -#define phpext_mysqli_ptr &mysqli_module_entry - -#ifdef PHP_WIN32 -#define PHP_MYSQLI_API __declspec(dllexport) -#else -#define PHP_MYSQLI_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -#define PHP_MYSQLI_EXPORT(__type) PHP_MYSQLI_API __type - -extern zend_module_entry mysqli_module_entry; -extern function_entry mysqli_functions[]; -extern function_entry mysqli_link_methods[]; -extern function_entry mysqli_stmt_methods[]; -extern function_entry mysqli_result_methods[]; -extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int flag); -extern void php_clear_stmt_bind(STMT *stmt); -zend_class_entry *mysqli_link_class_entry; -zend_class_entry *mysqli_stmt_class_entry; -zend_class_entry *mysqli_result_class_entry; - -zend_class_entry _mysqli_link_class_entry; -zend_class_entry _mysqli_stmt_class_entry; -zend_class_entry _mysqli_result_class_entry; - -PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry * TSRMLS_DC); - -#define REGISTER_MYSQLI_CLASS_ENTRY(name, mysqli_entry, class_functions) { \ - INIT_CLASS_ENTRY(_##mysqli_entry,name,class_functions); \ - _##mysqli_entry.create_object = mysqli_objects_new; \ - mysqli_entry = zend_register_internal_class(&_##mysqli_entry TSRMLS_CC); \ -} \ - -#define MYSQLI_REGISTER_RESOURCE_EX(__ptr, __zval, __ce) \ - ((mysqli_object *) zend_object_store_get_object(__zval TSRMLS_CC))->ptr = __ptr; - -#define MYSQLI_RETURN_RESOURCE(__ptr, __ce) \ - Z_TYPE_P(return_value) = IS_OBJECT; \ - (return_value)->value.obj = mysqli_objects_new(__ce TSRMLS_CC); \ - MYSQLI_REGISTER_RESOURCE_EX(__ptr, return_value, __ce) - -#define MYSQLI_REGISTER_RESOURCE(__ptr, __ce) \ -{\ - zval *object = getThis();\ - if (!object) {\ - object = return_value;\ - Z_TYPE_P(object) = IS_OBJECT;\ - (object)->value.obj = mysqli_objects_new(__ce TSRMLS_CC);\ - }\ - MYSQLI_REGISTER_RESOURCE_EX(__ptr, object, __ce)\ -} - -#define MYSQLI_FETCH_RESOURCE(__ptr, __type, __id, __name) \ -{ \ - mysqli_object *intern = (mysqli_object *)zend_object_store_get_object(*(__id) TSRMLS_CC);\ - if (!(__ptr = (__type)intern->ptr)) {\ - php_error(E_WARNING, "Couldn't fetch %s", intern->zo.ce->name);\ - RETURN_NULL();\ - }\ - if (!strcmp((char *)__name, "mysqli_stmt")) {\ - if (!((STMT *)__ptr)->stmt->mysql) {\ - php_error(E_WARNING, "Statement isn't valid anymore");\ - RETURN_NULL();\ - }\ - }\ -} - -#define MYSQLI_CLEAR_RESOURCE(__id) \ -{ \ - mysqli_object *intern = (mysqli_object *)zend_object_store_get_object(*(__id) TSRMLS_CC);\ - intern->ptr = NULL; \ -} - -#define MYSQLI_RETURN_LONG_LONG(__val) \ -{ \ - if ((__val) < LONG_MAX) { \ - RETURN_LONG((__val)); \ - } else { \ - char ret[40]; \ - sprintf(ret, "%llu", (__val)); \ - RETURN_STRING(ret,1); \ - } \ -} - -#define MYSQLI_STORE_RESULT 0 -#define MYSQLI_USE_RESULT 1 - -/* for mysqli_fetch_assoc */ -#define MYSQLI_ASSOC 1 -#define MYSQLI_NUM 2 -#define MYSQLI_BOTH 3 - -/* for mysqli_bind_param */ -#define MYSQLI_BIND_INT 1 -#define MYSQLI_BIND_DOUBLE 2 -#define MYSQLI_BIND_STRING 3 -#define MYSQLI_BIND_SEND_DATA 4 - -/* fetch types */ -#define FETCH_SIMPLE 0 -#define FETCH_RESULT 1 - -PHP_MYSQLI_API void mysqli_register_link(zval *return_value, void *link TSRMLS_DC); -PHP_MYSQLI_API void mysqli_register_stmt(zval *return_value, void *stmt TSRMLS_DC); -PHP_MYSQLI_API void mysqli_register_result(zval *return_value, void *result TSRMLS_DC); -PHP_MYSQLI_API void php_mysqli_set_error(long mysql_errno, char *mysql_err TSRMLS_DC); - -PHP_MINIT_FUNCTION(mysqli); -PHP_MSHUTDOWN_FUNCTION(mysqli); -PHP_RINIT_FUNCTION(mysqli); -PHP_RSHUTDOWN_FUNCTION(mysqli); -PHP_MINFO_FUNCTION(mysqli); - -PHP_FUNCTION(mysqli_affected_rows); -PHP_FUNCTION(mysqli_autocommit); -PHP_FUNCTION(mysqli_bind_param); -PHP_FUNCTION(mysqli_bind_result); -PHP_FUNCTION(mysqli_change_user); -PHP_FUNCTION(mysqli_character_set_name); -PHP_FUNCTION(mysqli_close); -PHP_FUNCTION(mysqli_commit); -PHP_FUNCTION(mysqli_connect); -PHP_FUNCTION(mysqli_data_seek); -PHP_FUNCTION(mysqli_debug); -PHP_FUNCTION(mysqli_disable_reads_from_master); -PHP_FUNCTION(mysqli_disable_rpl_parse); -PHP_FUNCTION(mysqli_dump_debug_info); -PHP_FUNCTION(mysqli_enable_reads_from_master); -PHP_FUNCTION(mysqli_enable_rpl_parse); -PHP_FUNCTION(mysqli_errno); -PHP_FUNCTION(mysqli_error); -PHP_FUNCTION(mysqli_execute); -PHP_FUNCTION(mysqli_fetch); -PHP_FUNCTION(mysqli_fetch_array); -PHP_FUNCTION(mysqli_fetch_assoc); -PHP_FUNCTION(mysqli_fetch_object); -PHP_FUNCTION(mysqli_fetch_field); -PHP_FUNCTION(mysqli_fetch_fields); -PHP_FUNCTION(mysqli_fetch_field_direct); -PHP_FUNCTION(mysqli_fetch_lengths); -PHP_FUNCTION(mysqli_fetch_row); -PHP_FUNCTION(mysqli_field_count); -PHP_FUNCTION(mysqli_field_seek); -PHP_FUNCTION(mysqli_field_tell); -PHP_FUNCTION(mysqli_free_result); -PHP_FUNCTION(mysqli_get_client_info); -PHP_FUNCTION(mysqli_get_host_info); -PHP_FUNCTION(mysqli_get_proto_info); -PHP_FUNCTION(mysqli_get_server_info); -PHP_FUNCTION(mysqli_get_server_version); -PHP_FUNCTION(mysqli_info); -PHP_FUNCTION(mysqli_insert_id); -PHP_FUNCTION(mysqli_init); -PHP_FUNCTION(mysqli_kill); -PHP_FUNCTION(mysqli_master_query); -PHP_FUNCTION(mysqli_num_fields); -PHP_FUNCTION(mysqli_num_rows); -PHP_FUNCTION(mysqli_options); -PHP_FUNCTION(mysqli_param_count); -PHP_FUNCTION(mysqli_ping); -PHP_FUNCTION(mysqli_prepare); -PHP_FUNCTION(mysqli_query); -PHP_FUNCTION(mysqli_prepare_result); -PHP_FUNCTION(mysqli_read_query_result); -PHP_FUNCTION(mysqli_real_connect); -PHP_FUNCTION(mysqli_real_query); -PHP_FUNCTION(mysqli_real_escape_string); -PHP_FUNCTION(mysqli_reload); -PHP_FUNCTION(mysqli_rollback); -PHP_FUNCTION(mysqli_row_seek); -PHP_FUNCTION(mysqli_rpl_parse_enabled); -PHP_FUNCTION(mysqli_rpl_probe); -PHP_FUNCTION(mysqli_rpl_query_type); -PHP_FUNCTION(mysqli_select_db); -PHP_FUNCTION(mysqli_send_long_data); -PHP_FUNCTION(mysqli_send_query); -PHP_FUNCTION(mysqli_slave_query); -PHP_FUNCTION(mysqli_ssl_set); -PHP_FUNCTION(mysqli_stat); -PHP_FUNCTION(mysqli_stmt_affected_rows); -PHP_FUNCTION(mysqli_stmt_close); -PHP_FUNCTION(mysqli_stmt_errno); -PHP_FUNCTION(mysqli_stmt_error); -PHP_FUNCTION(mysqli_stmt_store_result); -PHP_FUNCTION(mysqli_store_result); -PHP_FUNCTION(mysqli_thread_id); -PHP_FUNCTION(mysqli_thread_safe); -PHP_FUNCTION(mysqli_use_result); -PHP_FUNCTION(mysqli_warning_count); - -ZEND_BEGIN_MODULE_GLOBALS(mysqli) - long default_link; - long num_links; - long max_links; - unsigned int default_port; - char *default_host; - char *default_user; - char *default_pw; - char *default_socket; - long error_no; - char *error_msg; -ZEND_END_MODULE_GLOBALS(mysqli) - -#ifdef ZTS -#define MyG(v) TSRMG(mysqli_globals_id, zend_mysqli_globals *, v) -#else -#define MyG(v) (mysqli_globals.v) -#endif - -ZEND_EXTERN_MODULE_GLOBALS(mysqli); - -#endif /* PHP_MYSQLI.H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt deleted file mode 100644 index fca937cf5d..0000000000 --- a/ext/mysqli/tests/001.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -mysqli connect ---FILE-- -<? - $user = "root"; - $passwd = ""; - $dbname = "test"; - $test = ""; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("127.0.0.1", $user, $passwd); - $test .= ($link) ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_connect localhost ***/ - $link = mysqli_connect("localhost", $user, $passwd); - $test .= ($link) ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_connect localhost:port ***/ - $link = mysqli_connect("localhost", $user, $passwd, "", 3306); - $test .= ($link) ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_real_connect ***/ - $link = mysqli_init(); - $test.= (mysqli_real_connect($link, "localhost", $user, $passwd)) - ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_real_connect with db ***/ - $link = mysqli_init(); - $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname)) - ? "1" : "0"; - mysqli_close($link); - - /*** test mysqli_real_connect with port ***/ - $link = mysqli_init(); - $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 3306)) - ? "1":"0"; - mysqli_close($link); - - /*** test mysqli_real_connect compressed ***/ - $link = mysqli_init(); - $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 0, NULL, MYSQLI_CLIENT_COMPRESS)) - ? "1" : "0"; - mysqli_close($link); - - /* todo ssl connections */ - - var_dump($test); -?> ---EXPECT-- -string(7) "1111111" diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt deleted file mode 100644 index bbf5808641..0000000000 --- a/ext/mysqli/tests/002.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -mysqli bind_result 1 ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - $rc = mysqli_query($link,"DROP TABLE IF EXISTS test_fetch_null"); - - $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20))"); - - $rc = mysqli_query($link,"INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); - - $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11); - mysqli_execute($stmt); - - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(11) { - [0]=> - int(1) - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL - [5]=> - NULL - [6]=> - NULL - [7]=> - NULL - [8]=> - NULL - [9]=> - string(4) "foo1" - [10]=> - string(4) "1000" -} diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt deleted file mode 100644 index 6baae8a481..0000000000 --- a/ext/mysqli/tests/003.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -mysqli connect ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); - mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time, - c3 timestamp(14), - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6))"); - - mysqli_query($link,"INSERT INTO test_bind_result VALUES('2002-01-02', - '12:49:00', - '2002-01-02 17:46:59', - 2010, - '2010-07-10', - '2020','1999-12-29')"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - - mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - [2]=> - string(19) "2002-01-02 17:46:59" - [3]=> - int(2010) - [4]=> - string(19) "2010-07-10 00:00:00" - [5]=> - string(0) "" - [6]=> - string(19) "1999-12-29 00:00:00" -} diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt deleted file mode 100644 index 1469bb566f..0000000000 --- a/ext/mysqli/tests/004.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -mysqli fetch char/text ---FILE-- -<?php - include ("connect.inc"); - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); - - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test')"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - string(14) "this is a test" -} diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt deleted file mode 100644 index 5688770fe0..0000000000 --- a/ext/mysqli/tests/005.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -mysqli fetch char/text long ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); - - $a = str_repeat("A1", 32000); - - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test[] = $c1; - $test[] = ($a == $c2) ? "32K String ok" : "32K String failed"; - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - string(13) "32K String ok" -} diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/006.phpt deleted file mode 100644 index 059ce147a7..0000000000 --- a/ext/mysqli/tests/006.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -mysqli fetch long values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned, - c2 int unsigned, - c3 int, - c4 int, - c5 int, - c6 int unsigned, - c7 int)"); - - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - int(0) - [1]=> - int(35999) - [2]=> - NULL - [3]=> - int(-500) - [4]=> - int(-9999999) - [5]=> - int(0) - [6]=> - int(0) -} diff --git a/ext/mysqli/tests/007.phpt b/ext/mysqli/tests/007.phpt deleted file mode 100644 index 89d1959752..0000000000 --- a/ext/mysqli/tests/007.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -mysqli fetch short values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); - - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - int(0) - [1]=> - int(35999) - [2]=> - NULL - [3]=> - int(-500) - [4]=> - int(-32768) - [5]=> - int(30) - [6]=> - int(0) -} diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt deleted file mode 100644 index 92498da44c..0000000000 --- a/ext/mysqli/tests/008.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -mysqli fetch tinyint values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint, - c2 tinyint unsigned, - c3 tinyint not NULL, - c4 tinyint, - c5 tinyint, - c6 tinyint unsigned, - c7 tinyint)"); - - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"); - - $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL; - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - int(-23) - [1]=> - int(255) - [2]=> - int(0) - [3]=> - int(-100) - [4]=> - int(-127) - [5]=> - int(30) - [6]=> - int(0) -} diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt deleted file mode 100644 index 942b443ebb..0000000000 --- a/ext/mysqli/tests/009.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -mysqli fetch bigint values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5, - c2 bigint, - c3 bigint not NULL, - c4 bigint unsigned, - c5 bigint unsigned, - c6 bigint unsigned, - c7 bigint unsigned)"); - - mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7) VALUES (-23,4.0,33333333333333,0,-333333333333,99.9)"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - int(5) - [1]=> - int(-23) - [2]=> - int(4) - [3]=> - string(14) "33333333333333" - [4]=> - int(0) - [5]=> - string(13) "-333333333333" - [6]=> - int(100) -} diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt deleted file mode 100644 index 2986277fb4..0000000000 --- a/ext/mysqli/tests/010.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -mysqli fetch float values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 float(3), - c2 float, - c3 float unsigned, - c4 float, - c5 float, - c6 float, - c7 float(10) unsigned)"); - - - mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999, - sin(0.6), 1.00000000000001, 888888888888888)"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - float(3.1415927410126) - [1]=> - float(-9.9999999747524E-7) - [2]=> - float(0) - [3]=> - float(999999995904) - [4]=> - float(0.56464248895645) - [5]=> - float(1) - [6]=> - float(888888914608130) -} diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt deleted file mode 100644 index 5735e2f1dd..0000000000 --- a/ext/mysqli/tests/011.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -mysqli fetch mixed values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); - - mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(50))"); - - mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999, - 2345.6,5678.89563, - 'foobar','mysql rulez')"); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(8) { - [0]=> - int(19) - [1]=> - int(2999) - [2]=> - int(3999) - [3]=> - int(4999999) - [4]=> - float(2345.6000976563) - [5]=> - float(5678.89563) - [6]=> - string(6) "foobar" - [7]=> - string(11) "mysql rulez" -} diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt deleted file mode 100644 index 38ef311d59..0000000000 --- a/ext/mysqli/tests/012.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -mysqli fetch mixed values 2 ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); - - mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(10))"); - - mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(8) { - [0]=> - int(120) - [1]=> - int(2999) - [2]=> - int(3999) - [3]=> - int(54) - [4]=> - float(2.5999999046326) - [5]=> - float(58.89) - [6]=> - string(3) "206" - [7]=> - string(3) "6.7" -} diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/013.phpt deleted file mode 100644 index dafc9bba9b..0000000000 --- a/ext/mysqli/tests/013.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -mysqli fetch mixed / mysql_query ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); - - mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 decimal(4,2), c6 double, - c7 varbinary(10), - c8 varchar(10))"); - - mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')"); - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - - $c = array(0,0,0,0,0,0,0,0); - mysqli_bind_result($stmt, &$c[0], &$c[1], &$c[2], &$c[3], &$c[4], &$c[5], &$c[6], &$c[7]); - mysqli_execute($stmt); - mysqli_fetch($stmt); - mysqli_fetch($stmt); - mysqli_stmt_close($stmt); - - $result = mysqli_query($link, "select * from test_bind_result"); - $d = mysqli_fetch_row($result); - mysqli_free_result($result); - - $test = ""; - for ($i=0; $i < count($c); $i++) - $test .= ($c[0] == $d[0]) ? "1" : "0"; - - var_dump($test); - - mysqli_close($link); -?> ---EXPECT-- -string(8) "11111111" diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt deleted file mode 100644 index 8a72c42c7f..0000000000 --- a/ext/mysqli/tests/014.phpt +++ /dev/null @@ -1,66 +0,0 @@ ---TEST-- -mysqli autocommit/commit/rollback ---SKIPIF-- -<?php - include "connect.inc"; - $link = mysqli_connect("localhost", $user, $passwd); - $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'"); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - mysqli_close($link); - - if ($row[1] == "DISABLED" || $row[1] == "NO") { - printf ("skip innodb support is not installed or enabled."); - } -?> ---FILE-- -<?php - include "connect.inc"; - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_autocommit($link, TRUE); - - mysqli_query($link,"DROP TABLE IF EXISTS ac_01"); - - mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10)) type=InnoDB"); - - mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')"); - mysqli_autocommit($link, FALSE); - mysqli_query($link, "DELETE FROM ac_01"); - mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"); - - mysqli_rollback($link); - - $result = mysqli_query($link, "SELECT * FROM ac_01"); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - - var_dump($row); - - mysqli_query($link, "DELETE FROM ac_01"); - mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"); - mysqli_commit($link); - - $result = mysqli_query($link, "SELECT * FROM ac_01"); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - - var_dump($row); - - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(1) "1" - [1]=> - string(6) "foobar" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(4) "egon" -} diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/015.phpt deleted file mode 100644 index 96864e8854..0000000000 --- a/ext/mysqli/tests/015.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -mysqli autocommit/commit/rollback with myisam ---SKIPIF-- -<?php - include "connect.inc"; - $link = mysqli_connect("localhost", $user, $passwd); - $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'"); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - mysqli_close($link); - - if ($row[1] == "NO") { - printf ("skip innodb support not installed."); - } -?> ---FILE-- -<?php - include "connect.inc"; - - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_autocommit($link, TRUE); - - mysqli_query($link,"DROP TABLE IF EXISTS ac_01"); - - mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10))"); - - mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')"); - mysqli_autocommit($link, FALSE); - - mysqli_query($link, "DELETE FROM ac_01"); - mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"); - - mysqli_rollback($link); - - $result = mysqli_query($link, "SELECT * FROM ac_01"); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - - var_dump($row); - - mysqli_query($link, "DELETE FROM ac_01"); - mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"); - mysqli_commit($link); - - $result = mysqli_query($link, "SELECT * FROM ac_01"); - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - - var_dump($row); - - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(1) "2" - [1]=> - string(4) "egon" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(4) "egon" -} diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/016.phpt deleted file mode 100644 index 7d84c29655..0000000000 --- a/ext/mysqli/tests/016.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -mysqli fetch user variable ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "SET @dummy='foobar'"); - - $stmt = mysqli_prepare($link, "SELECT @dummy"); - mysqli_bind_result($stmt, &$dummy); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - var_dump($dummy); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -string(6) "foobar" diff --git a/ext/mysqli/tests/017.phpt b/ext/mysqli/tests/017.phpt deleted file mode 100644 index e7aaf746cf..0000000000 --- a/ext/mysqli/tests/017.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -mysqli fetch functions ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - $stmt = mysqli_prepare($link, "SELECT current_user(), database()"); - mysqli_bind_result($stmt, &$c0, &$c1); - mysqli_execute($stmt); - - mysqli_fetch($stmt); - - $test = array($c0, $c1); - - var_dump($test); - - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(14) "root@localhost" - [1]=> - string(4) "test" -} diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt deleted file mode 100644 index 8fb0d44dc5..0000000000 --- a/ext/mysqli/tests/018.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -mysqli fetch system variables ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "SET AUTOCOMMIT=0"); - - $stmt = mysqli_prepare($link, "SELECT @@autocommit"); - mysqli_bind_result($stmt, &$c0); - mysqli_execute($stmt); - - mysqli_fetch($stmt); - - var_dump($c0); - - mysqli_close($link); -?> ---EXPECT-- -int(0) diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt deleted file mode 100644 index 0e13f7520a..0000000000 --- a/ext/mysqli/tests/019.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -mysqli fetch (bind_param + bind_result) ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - $rc = mysqli_query($link,"DROP TABLE IF EXISTS insert_read"); - - $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20))"); - - $stmt= mysqli_prepare($link,"INSERT INTO insert_read(col1,col10, col11) VALUES(?,?,?)"); - mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT, &$c2, MYSQLI_BIND_STRING, &$c3, MYSQLI_BIND_STRING); - - $c1 = 1; - $c2 = "foo"; - $c3 = "foobar"; - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11); - mysqli_execute($stmt); - - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(11) { - [0]=> - int(1) - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL - [5]=> - NULL - [6]=> - NULL - [7]=> - NULL - [8]=> - NULL - [9]=> - string(3) "foo" - [10]=> - string(6) "foobar" -} diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt deleted file mode 100644 index 53827d0be3..0000000000 --- a/ext/mysqli/tests/020.phpt +++ /dev/null @@ -1,70 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result date ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); - mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time, - c3 timestamp(14), - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6))"); - - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)"); - mysqli_bind_param($stmt, &$d1, MYSQLI_BIND_STRING, - &$d2, MYSQLI_BIND_STRING, - &$d3, MYSQLI_BIND_STRING, - &$d4, MYSQLI_BIND_STRING, - &$d5, MYSQLI_BIND_STRING, - &$d6, MYSQLI_BIND_STRING, - &$d7, MYSQLI_BIND_STRING); - - $d1 = '2002-01-02'; - $d2 = '12:49:00'; - $d3 = '2002-01-02 17:46:59'; - $d4 = 2010; - $d5 ='2010-07-10'; - $d6 = '2020'; - $d7 = '1999-12-29'; - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); - - mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - [2]=> - string(19) "2002-01-02 17:46:59" - [3]=> - int(2010) - [4]=> - string(19) "2010-07-10 00:00:00" - [5]=> - string(0) "" - [6]=> - string(19) "1999-12-29 00:00:00" -} diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt deleted file mode 100644 index deabef6933..0000000000 --- a/ext/mysqli/tests/021.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -mysqli bind_param+bind_result char/text ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); - - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); - mysqli_bind_param($stmt, &$q1, MYSQLI_BIND_STRING, &$q2, MYSQLI_BIND_STRING); - $q1 = "1234567890"; - $q2 = "this is a test"; - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - string(14) "this is a test" -} diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt deleted file mode 100644 index efd2fef8bd..0000000000 --- a/ext/mysqli/tests/022.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result char/text long ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)"); - - - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); - mysqli_bind_param($stmt, &$a1, MYSQLI_BIND_STRING, &$a2, MYSQLI_BIND_STRING); - - $a1 = "1234567890"; - $a2 = str_repeat("A1", 32000); - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test[] = $c1; - $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed"; - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - string(13) "32K String ok" -} diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt deleted file mode 100644 index fcbd4b2cfc..0000000000 --- a/ext/mysqli/tests/023.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -mysqli bind_param/bind_prepare fetch long values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned, - c2 int unsigned, - c3 int, - c4 int, - c5 int, - c6 int unsigned, - c7 int)"); - - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); - mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT, - &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT, - &$c7, MYSQLI_BIND_INT); - $c1 = -23; - $c2 = 35999; - $c3 = NULL; - $c4 = -500; - $c5 = -9999999; - $c6 = -0; - $c7 = 0; - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - int(0) - [1]=> - int(35999) - [2]=> - NULL - [3]=> - int(-500) - [4]=> - int(-9999999) - [5]=> - int(0) - [6]=> - int(0) -} diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt deleted file mode 100644 index e31064a02a..0000000000 --- a/ext/mysqli/tests/024.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result short values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); - - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); - mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT, - &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT, - &$c7, MYSQLI_BIND_INT); - - $c1 = -23; - $c2 = 35999; - $c3 = NULL; - $c4 = -500; - $c5 = -9999999; - $c6 = -0; - $c7 = 0; - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - int(0) - [1]=> - int(35999) - [2]=> - NULL - [3]=> - int(-500) - [4]=> - int(-32768) - [5]=> - int(0) - [6]=> - int(0) -} diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt deleted file mode 100644 index f32ef143f2..0000000000 --- a/ext/mysqli/tests/025.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result tinyint values ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint, - c2 tinyint unsigned, - c3 tinyint not NULL, - c4 tinyint, - c5 tinyint, - c6 tinyint unsigned, - c7 tinyint)"); - - $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)"); - mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_INT,&$c2, MYSQLI_BIND_INT,&$c3, MYSQLI_BIND_INT,&$c4, MYSQLI_BIND_INT, - &$c5, MYSQLI_BIND_INT,&$c6, MYSQLI_BIND_INT,&$c7, MYSQLI_BIND_INT); - - $c1 = -23; - $c2 = 300; - $c3 = 0; - $c4 = -100; - $c5 = -127; - $c6 = 30; - $c7 = 0; - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"); - - $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL; - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); - - var_dump($test); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(7) { - [0]=> - int(-23) - [1]=> - int(255) - [2]=> - int(0) - [3]=> - int(-100) - [4]=> - int(-127) - [5]=> - int(30) - [6]=> - int(0) -} diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt deleted file mode 100644 index ef1b66862d..0000000000 --- a/ext/mysqli/tests/026.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result with send_long_data ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)"); - - $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); - mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_STRING, &$c2, MYSQLI_BIND_SEND_DATA); - - $c1 = "Hello World"; - - mysqli_send_long_data($stmt, 2, "This is the first sentence."); - mysqli_send_long_data($stmt, 2, " And this is the second sentence."); - mysqli_send_long_data($stmt, 2, " And finally this is the last sentence."); - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); - mysqli_bind_result($stmt, &$d1, &$d2); - mysqli_execute($stmt); - mysqli_fetch($stmt); - - $test = array($d1,$d2); - - var_dump($test); - - mysqli_stmt_close($stmt); - - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(10) "Hello Worl" - [1]=> - string(99) "This is the first sentence. And this is the second sentence. And finally this is the last sentence." -} diff --git a/ext/mysqli/tests/027.phpt b/ext/mysqli/tests/027.phpt deleted file mode 100644 index ae3657487d..0000000000 --- a/ext/mysqli/tests/027.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -function test: mysqli_stat ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - $status = mysqli_stat($link); - - $x = explode(' ', $status); - - var_dump(count($x)); - - mysqli_close($link); -?> ---EXPECT-- -int(10) diff --git a/ext/mysqli/tests/028.phpt b/ext/mysqli/tests/028.phpt deleted file mode 100644 index 2954d28f3c..0000000000 --- a/ext/mysqli/tests/028.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -function test: mysqli_character_set_name ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - $cset = mysqli_character_set_name($link); - - var_dump($cset); - - mysqli_close($link); -?> ---EXPECT-- -string(6) "latin1" diff --git a/ext/mysqli/tests/029.phpt b/ext/mysqli/tests/029.phpt deleted file mode 100644 index 7680b228e9..0000000000 --- a/ext/mysqli/tests/029.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -function test: mysqli_affected_rows ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "drop table if exists general_test"); - mysqli_query($link, "create table general_test (a int)"); - mysqli_query($link, "insert into general_test values (1),(2),(3)"); - - $afc = mysqli_affected_rows($link); - - var_dump($afc); - - mysqli_close($link); -?> ---EXPECT-- -int(3) diff --git a/ext/mysqli/tests/030.phpt b/ext/mysqli/tests/030.phpt deleted file mode 100644 index da87218627..0000000000 --- a/ext/mysqli/tests/030.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -function test: mysqli_errno ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - $errno = mysqli_errno($link); - var_dump($errno); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "select * from non_exisiting_table"); - $errno = mysqli_errno($link); - - var_dump($errno); - - mysqli_close($link); -?> ---EXPECT-- -int(0) -int(1146) diff --git a/ext/mysqli/tests/031.phpt b/ext/mysqli/tests/031.phpt deleted file mode 100644 index 61bfb5bb32..0000000000 --- a/ext/mysqli/tests/031.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -function test: mysqli_error ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - $error = mysqli_error($link); - var_dump($error); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "select * from non_exisiting_table"); - $error = mysqli_error($link); - - var_dump($error); - - mysqli_close($link); -?> ---EXPECT-- -string(0) "" -string(46) "Table 'test.non_exisiting_table' doesn't exist" diff --git a/ext/mysqli/tests/032.phpt b/ext/mysqli/tests/032.phpt deleted file mode 100644 index 02564834d8..0000000000 --- a/ext/mysqli/tests/032.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -function test: mysqli_info ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "drop table if exists general_test"); - mysqli_query($link, "create table general_test (a int)"); - mysqli_query($link, "insert into general_test values (1),(2),(3)"); - - $afc = mysqli_info($link); - - var_dump($afc); - - mysqli_close($link); -?> ---EXPECT-- -string(38) "Records: 3 Duplicates: 0 Warnings: 0" diff --git a/ext/mysqli/tests/033.phpt b/ext/mysqli/tests/033.phpt deleted file mode 100644 index e3d8d159d0..0000000000 --- a/ext/mysqli/tests/033.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -function test: mysqli_get_host_info ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - $hinfo = mysqli_get_host_info($link); - - var_dump($hinfo); - - mysqli_close($link); -?> ---EXPECT-- -string(25) "Localhost via UNIX socket" diff --git a/ext/mysqli/tests/034.phpt b/ext/mysqli/tests/034.phpt deleted file mode 100644 index e347586a36..0000000000 --- a/ext/mysqli/tests/034.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -function test: mysqli_get_proto_info ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - $pinfo = mysqli_get_proto_info($link); - - var_dump($pinfo); - - mysqli_close($link); -?> ---EXPECT-- -int(10) diff --git a/ext/mysqli/tests/035.phpt b/ext/mysqli/tests/035.phpt deleted file mode 100644 index 34af7c0a56..0000000000 --- a/ext/mysqli/tests/035.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -function test: mysqli_get_server_info ---FILE-- -<?php - $user = "root"; - $passwd = ""; - - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - $sinfo = substr(mysqli_get_server_info($link),0,1); - - var_dump($sinfo); - - mysqli_close($link); -?> ---EXPECT-- -string(1) "4" diff --git a/ext/mysqli/tests/036.phpt b/ext/mysqli/tests/036.phpt deleted file mode 100644 index 080c6e32e4..0000000000 --- a/ext/mysqli/tests/036.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -function test: mysqli_insert_id() ---FILE-- -<?php - - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "DROP TABLE IF EXISTS t036"); - - mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10))"); - - - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')"); - $test[] = mysqli_insert_id($link); - - /* we have to insert more values, cause lexer sets auto_increment to max_int - see mysql bug #54. So we don't check for the value, only for type (which must - be type string) - */ - - mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998"); - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')"); - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')"); - mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')"); - $x = mysqli_insert_id($link); - $test[] = is_string($x); - - var_dump($test); - - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - int(1) - [1]=> - bool(true) -} diff --git a/ext/mysqli/tests/037.phpt b/ext/mysqli/tests/037.phpt deleted file mode 100644 index f8b8a13f1a..0000000000 --- a/ext/mysqli/tests/037.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -function test: mysqli_field_count() ---FILE-- -<?php - - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - - mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10))"); - - mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); - $ir[] = mysqli_field_count($link); - - mysqli_real_query($link, "SELECT * FROM test_result"); - $ir[] = mysqli_field_count($link); - - - var_dump($ir); - - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - int(0) - [1]=> - int(2) -} diff --git a/ext/mysqli/tests/038.phpt b/ext/mysqli/tests/038.phpt deleted file mode 100644 index 858b3e3393..0000000000 --- a/ext/mysqli/tests/038.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -function test: mysqli_num_fields() ---FILE-- -<?php - - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - - mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10))"); - - mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); - - mysqli_real_query($link, "SELECT * FROM test_result"); - if (mysqli_field_count($link)) { - $result = mysqli_store_result($link); - $num = mysqli_num_fields($result); - mysqli_free_result($result); - } - - var_dump($num); - - mysqli_close($link); -?> ---EXPECT-- -int(2) diff --git a/ext/mysqli/tests/039.phpt b/ext/mysqli/tests/039.phpt deleted file mode 100644 index 6ddb37bc5f..0000000000 --- a/ext/mysqli/tests/039.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -function test: mysqli_num_fields() 2 ---FILE-- -<?php - - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_real_query($link, "SHOW VARIABLES"); - - if (mysqli_field_count($link)) { - $result = mysqli_store_result($link); - $num = mysqli_num_fields($result); - mysqli_free_result($result); - } - - var_dump($num); - - mysqli_close($link); -?> ---EXPECT-- -int(2) diff --git a/ext/mysqli/tests/040.phpt b/ext/mysqli/tests/040.phpt deleted file mode 100644 index 477e2a5274..0000000000 --- a/ext/mysqli/tests/040.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -function test: mysqli_num_rows() ---FILE-- -<?php - - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "DROP TABLE IF EXISTS test_result"); - - mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10))"); - - mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')"); - - mysqli_real_query($link, "SELECT * FROM test_result"); - if (mysqli_field_count($link)) { - $result = mysqli_store_result($link); - $num = mysqli_num_rows($result); - mysqli_free_result($result); - } - - var_dump($num); - - mysqli_close($link); -?> ---EXPECT-- -int(1) diff --git a/ext/mysqli/tests/041.phpt b/ext/mysqli/tests/041.phpt deleted file mode 100644 index 6fb8ee7e3f..0000000000 --- a/ext/mysqli/tests/041.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -function test: mysqli_warning_count() ---FILE-- -<?php - - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"); - - mysqli_query($link, "CREATE TABLE test_warnings (a int not null"); - - mysqli_query($link, "INSERT INTO test_warnings VALUES (1),(2),(NULL)"); - $num = mysqli_warning_count($link); - var_dump($num); - - mysqli_close($link); -?> ---EXPECT-- -int(1) diff --git a/ext/mysqli/tests/042.phpt b/ext/mysqli/tests/042.phpt deleted file mode 100644 index 865ee208a6..0000000000 --- a/ext/mysqli/tests/042.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -mysqli_fetch_object ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); - - $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); - mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT, - &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT, - &$c7, MYSQLI_BIND_INT); - - $c1 = -23; - $c2 = 35999; - $c3 = NULL; - $c4 = -500; - $c5 = -9999999; - $c6 = -0; - $c7 = 0; - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $result = mysqli_query($link, "SELECT * FROM test_bind_fetch"); - $test = mysqli_fetch_object($result); - mysqli_free_result($result); - - var_dump($test); - - mysqli_close($link); -?> ---EXPECT-- -object(stdClass)(7) { - ["c1"]=> - string(1) "0" - ["c2"]=> - string(5) "35999" - ["c3"]=> - NULL - ["c4"]=> - string(4) "-500" - ["c5"]=> - string(6) "-32768" - ["c6"]=> - string(1) "0" - ["c7"]=> - string(1) "0" -} diff --git a/ext/mysqli/tests/043.phpt b/ext/mysqli/tests/043.phpt deleted file mode 100644 index 9c02c32c1a..0000000000 --- a/ext/mysqli/tests/043.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -mysqli_bind_param (UPDATE) ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_update"); - mysqli_query($link,"CREATE TABLE test_update(a varchar(10), - b int)"); - - mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)"); - - $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?"); - mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_STRING,&$c2,MYSQLI_BIND_INT, &$c3, MYSQLI_BIND_INT); - - $c1 = "Rasmus"; - $c2 = 1; - $c3 = 2; - - mysqli_execute($stmt); - mysqli_stmt_close($stmt); - - $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update"); - $test = mysqli_fetch_row($result); - mysqli_free_result($result); - - var_dump($test); - - mysqli_close($link); -?> ---EXPECT-- -array(1) { - [0]=> - string(15) "Rasmus is No. 1" -} diff --git a/ext/mysqli/tests/044.phpt b/ext/mysqli/tests/044.phpt deleted file mode 100644 index 5f72f65e38..0000000000 --- a/ext/mysqli/tests/044.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -mysqli_get_server_version ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - $i = mysqli_get_server_version($link); - - $test = $i / $i; - - var_dump($test); - - mysqli_close($link); -?> ---EXPECT-- -int(1) diff --git a/ext/mysqli/tests/045.phpt b/ext/mysqli/tests/045.phpt deleted file mode 100644 index 5ca0f2ae02..0000000000 --- a/ext/mysqli/tests/045.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -mysqli_bind_result (SHOW) ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'"); - - mysqli_execute($stmt); - mysqli_bind_result($stmt, &$c1, &$c2); - mysqli_fetch($stmt); - mysqli_stmt_close($stmt); - $test = array ($c1,$c2); - - var_dump($test); - - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - string(4) "port" - [1]=> - string(4) "3306" -} diff --git a/ext/mysqli/tests/046.phpt b/ext/mysqli/tests/046.phpt deleted file mode 100644 index d4a93ca277..0000000000 --- a/ext/mysqli/tests/046.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -mysqli_stmt_affected_rows (delete) ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); - mysqli_query($link, "CREATE TABLE test_affected (foo int)"); - - mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)"); - - $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?"); - mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT); - - $c1 = 2; - - mysqli_execute($stmt); - $x = mysqli_stmt_affected_rows($stmt); - - mysqli_stmt_close($stmt); - var_dump($x==1); - - mysqli_close($link); -?> ---EXPECT-- -bool(true) diff --git a/ext/mysqli/tests/047.phpt b/ext/mysqli/tests/047.phpt deleted file mode 100644 index 36f043a908..0000000000 --- a/ext/mysqli/tests/047.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -mysqli_prepare_result ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); - mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10))"); - - mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_affected"); - mysqli_execute($stmt); - $result = mysqli_prepare_result($stmt); - - $fields = mysqli_fetch_fields($result); - mysqli_free_result($result); - - var_dump($fields); - - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -array(2) { - [0]=> - object(stdClass)(9) { - ["name"]=> - string(3) "foo" - ["orgname"]=> - string(3) "foo" - ["table"]=> - string(13) "test_affected" - ["orgtable"]=> - string(13) "test_affected" - ["def"]=> - string(0) "" - ["max_length"]=> - int(0) - ["flags"]=> - int(32768) - ["type"]=> - int(3) - ["decimals"]=> - int(0) - } - [1]=> - object(stdClass)(9) { - ["name"]=> - string(3) "bar" - ["orgname"]=> - string(3) "bar" - ["table"]=> - string(13) "test_affected" - ["orgtable"]=> - string(13) "test_affected" - ["def"]=> - string(0) "" - ["max_length"]=> - int(0) - ["flags"]=> - int(0) - ["type"]=> - int(253) - ["decimals"]=> - int(0) - } -} diff --git a/ext/mysqli/tests/048.phpt b/ext/mysqli/tests/048.phpt deleted file mode 100644 index d8baf2041c..0000000000 --- a/ext/mysqli/tests/048.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -mysqli bind_result (OO-Style) ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $mysql = mysqli_connect("localhost", $user, $passwd); - - $mysql->select_db("test"); - $mysql->query("DROP TABLE IF EXISTS test_fetch_null"); - - $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20))"); - - $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); - - $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null"); - $stmt->bind_result(&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11); - $stmt->execute(); - - $stmt->fetch(); - - $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); - - var_dump($test); - - $stmt->close(); - $mysql->close(); -?> ---EXPECT-- -array(11) { - [0]=> - int(1) - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL - [5]=> - NULL - [6]=> - NULL - [7]=> - NULL - [8]=> - NULL - [9]=> - string(4) "foo1" - [10]=> - string(4) "1000" -} diff --git a/ext/mysqli/tests/049.phpt b/ext/mysqli/tests/049.phpt deleted file mode 100644 index 04e705de6e..0000000000 --- a/ext/mysqli/tests/049.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -mysql_fetch_row (OO-Style) ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $mysql = mysqli_connect("localhost", $user, $passwd); - - $mysql->select_db("test"); - $result = $mysql->query("SELECT CURRENT_USER()"); - $row = $result->fetch_row(); - $result->close(); - - var_dump($row); - - $mysql->close(); -?> ---EXPECT-- -array(1) { - [0]=> - string(14) "root@localhost" -} diff --git a/ext/mysqli/tests/050.phpt b/ext/mysqli/tests/050.phpt deleted file mode 100644 index 9ab5d346f8..0000000000 --- a/ext/mysqli/tests/050.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -non freed statement test ---FILE-- -<?php - include "connect.inc"; - - /************************ - * non freed stamement - ************************/ - $link = mysqli_connect("localhost", $user, $passwd); - - $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()"); - mysqli_execute($stmt); - - mysqli_close($link); - printf("Ok\n"); -?> ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/051.phpt b/ext/mysqli/tests/051.phpt deleted file mode 100644 index 746597e925..0000000000 --- a/ext/mysqli/tests/051.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -free statement after close ---FILE-- -<?php - include "connect.inc"; - - /************************ - * free statement after close - ************************/ - $link = mysqli_connect("localhost", $user, $passwd); - - $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()"); - mysqli_execute($stmt1); - - mysqli_close($link); - mysqli_stmt_close($stmt1); - printf("Ok\n"); -?> ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/052.phpt b/ext/mysqli/tests/052.phpt deleted file mode 100644 index 5682478887..0000000000 --- a/ext/mysqli/tests/052.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -call statement after close ---FILE-- -<?php - include "connect.inc"; - - /************************ - * statement call after close - ************************/ - $link = mysqli_connect("localhost", $user, $passwd); - - $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); - - mysqli_close($link); - mysqli_execute($stmt2); - mysqli_stmt_close($stmt2); - printf("Ok\n"); -?> ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/053.phpt b/ext/mysqli/tests/053.phpt deleted file mode 100644 index f542d0f099..0000000000 --- a/ext/mysqli/tests/053.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -not freed resultset ---FILE-- -<?php - include "connect.inc"; - - /************************ - * non freed resultset - ************************/ - $link = mysqli_connect("localhost", $user, $passwd); - - $result = mysqli_query($link, "SELECT CURRENT_USER()"); - mysqli_close($link); - printf("Ok\n"); - -?> ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/054.phpt b/ext/mysqli/tests/054.phpt deleted file mode 100644 index eab207db4d..0000000000 --- a/ext/mysqli/tests/054.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -free resultset after close ---FILE-- -<?php - include "connect.inc"; - - /************************ - * free resultset after close - ************************/ - $link = mysqli_connect("localhost", $user, $passwd); - - $result1 = mysqli_query($link, "SELECT CURRENT_USER()"); - mysqli_close($link); - mysqli_free_result($result1); - printf("Ok\n"); -?> ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/055.phpt b/ext/mysqli/tests/055.phpt deleted file mode 100644 index e777bcfc99..0000000000 --- a/ext/mysqli/tests/055.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -free nothing ---FILE-- -<?php - include "connect.inc"; - - /************************ - * don't free anything - ************************/ - $link = mysqli_connect("localhost", $user, $passwd); - - $result2 = mysqli_query($link, "SELECT CURRENT_USER()"); - $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); - printf("Ok\n"); -?> ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/056.phpt b/ext/mysqli/tests/056.phpt deleted file mode 100644 index cee7df1e5f..0000000000 --- a/ext/mysqli/tests/056.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -extend mysqli ---FILE-- -<?php - include "connect.inc"; - - class foobar extends mysqli { - function test () { - return ("I like MySQL 4.1"); - } - } - - $foo = new foobar(); - $foo->connect("localhost", $user, $passwd); - $foo->close(); - printf("%s\n", $foo->test()); -?> ---EXPECT-- -I like MySQL 4.1 diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt deleted file mode 100644 index a7333a0d93..0000000000 --- a/ext/mysqli/tests/057.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -mysqli_prepare_result ---FILE-- -<?php - include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); - - mysqli_select_db($link, "test"); - - mysqli_query($link,"DROP TABLE IF EXISTS test_store_result"); - mysqli_query($link,"CREATE TABLE test_store_result (a int)"); - - mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)"); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); - mysqli_execute($stmt); - - /* this should produce an out of sync error */ - if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) { - mysqli_free_result($result); - printf ("Query ok\n"); - } - mysqli_stmt_close($stmt); - - $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); - mysqli_execute($stmt); - $result1 = mysqli_prepare_result($stmt); - mysqli_stmt_store_result($stmt); - - printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt)); - - /* this should show an error, cause results are not buffered */ - if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) { - $row = mysqli_fetch_row($result); - mysqli_free_result($result); - } - - - var_dump($row); - - mysqli_free_result($result1); - mysqli_stmt_close($stmt); - mysqli_close($link); -?> ---EXPECT-- -Rows: 3 -array(1) { - [0]=> - string(1) "1" -} diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc deleted file mode 100644 index aa1d30a17e..0000000000 --- a/ext/mysqli/tests/connect.inc +++ /dev/null @@ -1,10 +0,0 @@ -<?php - - /* default values are localhost, root and empty password - Change the values if you use another configuration */ - - $host = "localhost"; - $user = "root"; - $passwd = ""; - -?> |