2011-06-30 17:46:53 +02:00
|
|
|
/* Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc.
|
2011-06-30 17:31:31 +02:00
|
|
|
Use is subject to license terms.
|
2007-07-24 08:35:43 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2019-05-11 20:29:06 +02:00
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
2007-07-24 08:35:43 +02:00
|
|
|
|
2007-07-24 19:50:28 +02:00
|
|
|
#include <my_global.h>
|
|
|
|
#include <my_sys.h>
|
2007-07-24 08:35:43 +02:00
|
|
|
#include <mysql.h>
|
2007-07-24 19:50:28 +02:00
|
|
|
#include <m_string.h>
|
2007-07-24 08:35:43 +02:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
int main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
MYSQL conn;
|
2013-12-02 21:22:43 +01:00
|
|
|
int OK __attribute__((unused));
|
2007-07-24 08:35:43 +02:00
|
|
|
|
|
|
|
const char* query4= "INSERT INTO federated.t1 SET Value=54";
|
|
|
|
const char* query5= "INSERT INTO federated.t1 SET Value=55";
|
|
|
|
|
2007-07-24 19:50:28 +02:00
|
|
|
MY_INIT(argv[0]);
|
|
|
|
|
Fix for bug #32221: bug25714, mytest, mysql_client_test complaints and
crashes.
MySQL distributions contain a number of programs that are used only by
the MySQL test suite internally, i.e. they are not indended to be
invoked directly by a user. As a result, such programs are not
documented, do not have any built-in help or proper error reporting,
which may confuse users.
This patch fixes the problem with the following changes:
- mytest, libmysqltest and all references to them were removed from the
distribution since they are not used anymore
- bug25714 now displays an error message when run with incorrect
arguments or with the --help option
- mysql_client_test now does not call abort() in case of errors,
instead it does a clean exit() with a proper error status.
BitKeeper/deleted/.del-mytest.c:
Delete: libmysql/mytest.c
BitKeeper/deleted/.del-myTest-package.dsp:
Delete: VC++Files/libmysqltest/myTest-package.dsp
BitKeeper/deleted/.del-myTest-package_ia64.dsp:
Delete: VC++Files/libmysqltest/myTest-package_ia64.dsp
BitKeeper/deleted/.del-myTest.dsp~4a8c480769193952:
Delete: VC++Files/libmysqltest/myTest.dsp
BitKeeper/deleted/.del-myTest.vcproj:
Delete: VC++Files/libmysqltest/myTest.vcproj
BitKeeper/deleted/.del-myTest_ia64.dsp:
Delete: VC++Files/libmysqltest/myTest_ia64.dsp
BitKeeper/deleted/.del-mytest.c~9a99338689e5de8:
Delete: VC++Files/libmysqltest/mytest.c
BitKeeper/deleted/.del-mytest.dsw~2324698861155335:
Delete: VC++Files/libmysqltest/mytest.dsw
VC++Files/copy_mysql_files.bat:
Removed references to libmysqltest.
libmysql/CMakeLists.txt:
Removed rules for myTest.
libmysql/Makefile.am:
Removed mytest.c from EXTRA_DIST.
tests/bug25714.c:
Display a meaningful error message when run incorrectly or with the --help option.
tests/mysql_client_test.c:
In case of error, don't cause abnormal program termination, do a clean exit() with an error status.
2007-11-19 16:59:25 +01:00
|
|
|
if (argc != 2 || !strcmp(argv[1], "--help"))
|
|
|
|
{
|
|
|
|
fprintf(stderr, "This program is a part of the MySQL test suite. "
|
|
|
|
"It is not intended to be executed directly by a user.\n");
|
2007-07-24 08:35:43 +02:00
|
|
|
return -1;
|
Fix for bug #32221: bug25714, mytest, mysql_client_test complaints and
crashes.
MySQL distributions contain a number of programs that are used only by
the MySQL test suite internally, i.e. they are not indended to be
invoked directly by a user. As a result, such programs are not
documented, do not have any built-in help or proper error reporting,
which may confuse users.
This patch fixes the problem with the following changes:
- mytest, libmysqltest and all references to them were removed from the
distribution since they are not used anymore
- bug25714 now displays an error message when run with incorrect
arguments or with the --help option
- mysql_client_test now does not call abort() in case of errors,
instead it does a clean exit() with a proper error status.
BitKeeper/deleted/.del-mytest.c:
Delete: libmysql/mytest.c
BitKeeper/deleted/.del-myTest-package.dsp:
Delete: VC++Files/libmysqltest/myTest-package.dsp
BitKeeper/deleted/.del-myTest-package_ia64.dsp:
Delete: VC++Files/libmysqltest/myTest-package_ia64.dsp
BitKeeper/deleted/.del-myTest.dsp~4a8c480769193952:
Delete: VC++Files/libmysqltest/myTest.dsp
BitKeeper/deleted/.del-myTest.vcproj:
Delete: VC++Files/libmysqltest/myTest.vcproj
BitKeeper/deleted/.del-myTest_ia64.dsp:
Delete: VC++Files/libmysqltest/myTest_ia64.dsp
BitKeeper/deleted/.del-mytest.c~9a99338689e5de8:
Delete: VC++Files/libmysqltest/mytest.c
BitKeeper/deleted/.del-mytest.dsw~2324698861155335:
Delete: VC++Files/libmysqltest/mytest.dsw
VC++Files/copy_mysql_files.bat:
Removed references to libmysqltest.
libmysql/CMakeLists.txt:
Removed rules for myTest.
libmysql/Makefile.am:
Removed mytest.c from EXTRA_DIST.
tests/bug25714.c:
Display a meaningful error message when run incorrectly or with the --help option.
tests/mysql_client_test.c:
In case of error, don't cause abnormal program termination, do a clean exit() with an error status.
2007-11-19 16:59:25 +01:00
|
|
|
}
|
2007-07-24 08:35:43 +02:00
|
|
|
|
|
|
|
mysql_init(&conn);
|
|
|
|
if (!mysql_real_connect(
|
|
|
|
&conn,
|
|
|
|
"127.0.0.1",
|
|
|
|
"root",
|
|
|
|
"",
|
|
|
|
"test",
|
|
|
|
atoi(argv[1]),
|
|
|
|
NULL,
|
|
|
|
CLIENT_FOUND_ROWS))
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Failed to connect to database: Error: %s\n",
|
|
|
|
mysql_error(&conn));
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
printf("%s\n", mysql_error(&conn));
|
|
|
|
}
|
|
|
|
|
2009-02-10 23:47:54 +01:00
|
|
|
OK = mysql_real_query (&conn, query4, (uint) strlen(query4));
|
2007-07-24 08:35:43 +02:00
|
|
|
|
|
|
|
assert(0 == OK);
|
|
|
|
|
|
|
|
printf("%ld inserted\n",
|
|
|
|
(long) mysql_insert_id(&conn));
|
|
|
|
|
2009-02-10 23:47:54 +01:00
|
|
|
OK = mysql_real_query (&conn, query5, (uint) strlen(query5));
|
2007-07-24 08:35:43 +02:00
|
|
|
|
|
|
|
assert(0 == OK);
|
|
|
|
|
|
|
|
printf("%ld inserted\n",
|
|
|
|
(long) mysql_insert_id(&conn));
|
|
|
|
|
|
|
|
mysql_close(&conn);
|
2015-11-29 16:51:23 +01:00
|
|
|
mysql_server_end();
|
2007-07-24 19:50:28 +02:00
|
|
|
my_end(0);
|
2007-07-24 08:35:43 +02:00
|
|
|
|
|
|
|
return 0;
|
2007-08-13 15:11:25 +02:00
|
|
|
}
|
|
|
|
|