mariadb/tests/bug25714.c
Monty c3018b0ff4 Fixes to get all test to run on MacosX Lion 10.7
This includes fixing all utilities to not have any memory leaks,
as safemalloc warnings stopped tests from passing on MacOSX.

- Ensure that all clients takes character-set-dir, as the
  libmysqlclient library will use it.
- mysql-test-run now passes character-set-dir to all external clients.
- Changed dynstr_free() so that it can be called twice (made freeing code easier)
- Changed rpl_global_gtid_slave_state to be allocated dynamicly as it
  includes a mutex that needs to be initizlied/destroyed before my_end() is called.
- Removed rpl_slave_state::init() and rpl_slave_stage::deinit() as
  their job are better handling by constructor and delete.
- Print alias instead of table_name in check_duplicate_key as
  table_name may have been converted to lower case.

Other things:
- Fixed a case in time_to_datetime_with_warn() where we where
  using && instead of & in tests
2015-11-29 17:51:23 +02:00

78 lines
2.2 KiB
C

/* Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
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
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <my_global.h>
#include <my_sys.h>
#include <mysql.h>
#include <m_string.h>
#include <assert.h>
int main (int argc, char **argv)
{
MYSQL conn;
int OK __attribute__((unused));
const char* query4= "INSERT INTO federated.t1 SET Value=54";
const char* query5= "INSERT INTO federated.t1 SET Value=55";
MY_INIT(argv[0]);
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");
return -1;
}
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));
}
OK = mysql_real_query (&conn, query4, (uint) strlen(query4));
assert(0 == OK);
printf("%ld inserted\n",
(long) mysql_insert_id(&conn));
OK = mysql_real_query (&conn, query5, (uint) strlen(query5));
assert(0 == OK);
printf("%ld inserted\n",
(long) mysql_insert_id(&conn));
mysql_close(&conn);
mysql_server_end();
my_end(0);
return 0;
}