Remove RPL functions. They were always experimental and lead to crashes.

The underlying functions will be removed from libmysql as of MySQL 6.0, so
it's right time to remove them.
This commit is contained in:
Andrey Hristov 2007-12-28 15:38:23 +00:00
parent d107ebec58
commit d265efd570
10 changed files with 1 additions and 485 deletions

View File

@ -61,8 +61,6 @@ elif test "$PHP_MYSQLI" != "no"; then
],[
$MYSQLI_LIBLINE
])
mysqli_extra_sources="$mysqli_extra_sources mysqli_repl.c"
fi
dnl Build extension

View File

@ -26,9 +26,7 @@ if (PHP_MYSQLI != "no") {
CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQLI", PHP_MYSQLI +
"\\include;" + PHP_PHP_BUILD +
"\\include\\mysql;" + PHP_MYSQLI)) {
// No "mysqli_repl.c" when using "mysqlnd"
mysqli_extra_sources = "mysqli_repl.c";
EXTENSION("mysqli", mysqli_source + " " + mysqli_extra_sources);
EXTENSION("mysqli", mysqli_source);
AC_DEFINE('HAVE_MYSQLILIB', 1, 'Have MySQLi library');
} else {
WARNING("mysqli not enabled; libraries and headers not found");

View File

@ -65,18 +65,6 @@ const zend_function_entry mysqli_functions[] = {
PHP_FE(mysqli_data_seek, NULL)
PHP_FE(mysqli_dump_debug_info, NULL)
PHP_FE(mysqli_debug, NULL)
#if !defined(HAVE_MYSQLND)
PHP_FE(mysqli_disable_reads_from_master, NULL)
PHP_FE(mysqli_disable_rpl_parse, NULL)
PHP_FE(mysqli_enable_reads_from_master, NULL)
PHP_FE(mysqli_enable_rpl_parse, NULL)
PHP_FE(mysqli_send_query, NULL)
PHP_FE(mysqli_slave_query, NULL)
PHP_FE(mysqli_master_query, NULL)
PHP_FE(mysqli_rpl_parse_enabled, NULL)
PHP_FE(mysqli_rpl_probe, NULL)
PHP_FE(mysqli_rpl_query_type, NULL)
#endif
#if defined(HAVE_EMBEDDED_MYSQLI)
PHP_FE(mysqli_embedded_server_end, NULL)
PHP_FE(mysqli_embedded_server_start, NULL)
@ -207,17 +195,6 @@ const zend_function_entry mysqli_link_methods[] = {
PHP_FALIAS(connect,mysqli_connect,NULL)
PHP_FALIAS(dump_debug_info,mysqli_dump_debug_info,NULL)
PHP_FALIAS(debug,mysqli_debug,NULL)
#if !defined(HAVE_MYSQLND)
PHP_FALIAS(disable_reads_from_master,mysqli_disable_reads_from_master,NULL)
PHP_FALIAS(disable_rpl_parse,mysqli_disable_rpl_parse,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(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(master_query,mysqli_master_query,NULL)
PHP_FALIAS(slave_query,mysqli_slave_query,NULL)
#endif
#ifdef HAVE_MYSQLI_GET_CHARSET
PHP_FALIAS(get_charset,mysqli_get_charset,NULL)
#endif

View File

@ -1,223 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Georg Richter <georg@php.net> |
| Andrey Hristov <andrey@php.net> |
| Ulf Wendel <uw@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_structs.h"
/* {{{ proto void mysqli_disable_reads_from_master(object 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", MYSQLI_STATUS_VALID);
mysql_disable_reads_from_master(mysql);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto void mysqli_disable_rpl_parse(object 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", MYSQLI_STATUS_VALID);
mysql_disable_rpl_parse(mysql);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto void mysqli_enable_reads_from_master(object 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", MYSQLI_STATUS_VALID);
mysql_enable_reads_from_master(mysql);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto void mysqli_enable_rpl_parse(object 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", MYSQLI_STATUS_VALID);
mysql_enable_rpl_parse(mysql);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool mysqli_master_query(object link, string query)
Enforce execution of a query on the master in a master/slave setup */
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", MYSQLI_STATUS_VALID);
if (mysql_master_query(mysql, query, query_len)) {
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int mysqli_rpl_parse_enabled(object 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", MYSQLI_STATUS_VALID);
RETURN_LONG(mysql_rpl_parse_enabled(mysql));
}
/* }}} */
/* {{{ proto bool mysqli_rpl_probe(object 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", MYSQLI_STATUS_VALID);
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", MYSQLI_STATUS_VALID);
RETURN_LONG(mysql_rpl_query_type(query, query_len));
}
/* }}} */
/* {{{ proto bool mysqli_send_query(object 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", MYSQLI_STATUS_VALID);
if (mysql_send_query(mysql, query, query_len)) {
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool mysqli_slave_query(object link, string query)
Enforce execution of a query on a slave in a master/slave setup */
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", MYSQLI_STATUS_VALID);
if (mysql_slave_query(mysql, query, query_len)) {
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/*
* 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
*/

View File

@ -413,11 +413,7 @@ PHP_FUNCTION(mysqli_connect_errno);
PHP_FUNCTION(mysqli_connect_error);
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_fetch_all);
@ -450,7 +446,6 @@ PHP_FUNCTION(mysqli_init);
PHP_FUNCTION(mysqli_kill);
PHP_FUNCTION(mysqli_set_local_infile_default);
PHP_FUNCTION(mysqli_set_local_infile_handler);
PHP_FUNCTION(mysqli_master_query);
PHP_FUNCTION(mysqli_more_results);
PHP_FUNCTION(mysqli_multi_query);
PHP_FUNCTION(mysqli_next_result);
@ -468,9 +463,6 @@ PHP_FUNCTION(mysqli_real_query);
PHP_FUNCTION(mysqli_real_escape_string);
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_stmt_attr_get);
PHP_FUNCTION(mysqli_stmt_attr_set);
@ -483,10 +475,8 @@ PHP_FUNCTION(mysqli_stmt_prepare);
PHP_FUNCTION(mysqli_stmt_fetch);
PHP_FUNCTION(mysqli_stmt_param_count);
PHP_FUNCTION(mysqli_stmt_send_long_data);
PHP_FUNCTION(mysqli_send_query);
PHP_FUNCTION(mysqli_embedded_server_end);
PHP_FUNCTION(mysqli_embedded_server_start);
PHP_FUNCTION(mysqli_slave_query);
PHP_FUNCTION(mysqli_sqlstate);
PHP_FUNCTION(mysqli_ssl_set);
PHP_FUNCTION(mysqli_stat);

View File

@ -1,41 +0,0 @@
--TEST--
mysqli_disable_rpl_parse()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
if (!function_exists('mysqli_disable_rpl_parse'))
die("skip mysqli_disable_rpl_parse() not available");
?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (NULL !== ($tmp = @mysqli_disable_rpl_parse()))
printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysqli_disable_rpl_parse($link)))
printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (!is_bool($tmp = mysqli_disable_rpl_parse($link)))
printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
mysqli_close($link);
if (NULL !== ($tmp = mysqli_disable_rpl_parse($link)))
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
--EXPECTF--
Warning: mysqli_disable_rpl_parse(): Couldn't fetch mysqli in %s on line %d
done!

View File

@ -1,41 +0,0 @@
--TEST--
mysqli_enable_rpl_parse()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
if (!function_exists('mysqli_enable_rpl_parse'))
die("skip mysqli_enable_rpl_parse() not available");
?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (NULL !== ($tmp = @mysqli_enable_rpl_parse()))
printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysqli_enable_rpl_parse($link)))
printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (!is_bool($tmp = mysqli_enable_rpl_parse($link)))
printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
mysqli_close($link);
if (NULL !== ($tmp = mysqli_enable_rpl_parse($link)))
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
--EXPECTF--
Warning: mysqli_enable_rpl_parse(): Couldn't fetch mysqli in %s on line %d
done!

View File

@ -1,46 +0,0 @@
--TEST--
mysqli_rpl_parse_enabled()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
if (!function_exists('mysqli_rpl_parse_enabled')) {
die("skip mysqli_rpl_parse_enabled() not available");
}
require_once('connect.inc');
if (!$TEST_EXPERIMENTAL)
die("skip - experimental (= unsupported) feature");
?>
--FILE--
<?php
/* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (NULL !== ($tmp = @mysqli_rpl_parse_enabled()))
printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysqli_rpl_parse_enabled($link)))
printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (!is_int($tmp = mysqli_rpl_parse_enabled($link)))
printf("[004] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp);
mysqli_close($link);
if (NULL !== ($tmp = mysqli_rpl_parse_enabled($link)))
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
--EXPECTF--
Warning: mysqli_rpl_parse_enabled(): Couldn't fetch mysqli in %s on line %d
done!

View File

@ -1,46 +0,0 @@
--TEST--
mysqli_rpl_probe()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
if (!function_exists('mysqli_rpl_probe')) {
die("skip mysqli_rpl_probe() not available");
}
require_once('connect.inc');
if (!$TEST_EXPERIMENTAL)
die("skip - experimental (= unsupported) feature");
?>
--FILE--
<?php
/* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (NULL !== ($tmp = @mysqli_rpl_probe()))
printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysqli_rpl_probe($link)))
printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (!is_bool($tmp = mysqli_rpl_probe($link)))
printf("[004] Expecting boolean/any value, got %s/%s\n", gettype($tmp), $tmp);
mysqli_close($link);
if (NULL !== ($tmp = mysqli_rpl_probe($link)))
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
--EXPECTF--
Warning: mysqli_rpl_probe(): Couldn't fetch mysqli in %s on line %d
done!

View File

@ -1,50 +0,0 @@
--TEST--
mysqli_rpl_query_type()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
if (!function_exists('mysqli_rpl_query_type')) {
die("skip mysqli_rpl_query_type() not available");
}
require_once('connect.inc');
if (!$TEST_EXPERIMENTAL)
die("skip - experimental (= unsupported) feature");
?>
--FILE--
<?php
/* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (NULL !== ($tmp = @mysqli_rpl_query_type()))
printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysqli_rpl_query_type($link)))
printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
$query = array();
if (NULL !== ($tmp = @mysqli_rpl_query_type($link, $query)))
printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_int($tmp = mysqli_rpl_query_type($link, 'SELECT 1')))
printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp);
mysqli_close($link);
if (NULL !== ($tmp = mysqli_rpl_query_type($link, 'SELECT 1')))
printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
--EXPECTF--
Warning: mysqli_rpl_query_type(): Couldn't fetch mysqli in %s on line %d
done!