1/*
2Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
3
4The MySQL Connector/C is licensed under the terms of the GPLv2
5<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
6MySQL Connectors. There are special exceptions to the terms and
7conditions of the GPLv2 as it is applied to this software, see the
8FLOSS License Exception
9<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10
11This program is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published
13by the Free Software Foundation; version 2 of the License.
14
15This program is distributed in the hope that it will be useful, but
16WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18for more details.
19
20You should have received a copy of the GNU General Public License along
21with this program; if not, write to the Free Software Foundation, Inc.,
2251 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24/**
25 Some basic tests of the client API.
26*/
27
28#include "my_test.h"
29
30static int test_conc_173(MYSQL *unused __attribute__((unused)))
31{
32 MYSQL mysql;
33 int arg;
34 int i=0;
35
36 for (;;)
37 {
38 mysql_init(&mysql);
39 mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client");
40 mysql_options(&mysql, MYSQL_OPT_COMPRESS, 0);
41
42 mysql_options(&mysql, MYSQL_OPT_NAMED_PIPE, 0);
43
44 arg = MYSQL_PROTOCOL_SOCKET;
45
46 mysql_options(&mysql, MYSQL_OPT_PROTOCOL, &arg);
47
48 if(!mysql_real_connect(&mysql, hostname, username, password, schema, 0, 0, 0)) {
49 fprintf(stderr, "Failed to connect to database after %d iterations: Error: %s\n", i, mysql_error(&mysql));
50 return 1;
51 }
52 mysql_close(&mysql);
53 }
54 return OK;
55}
56
57struct my_tests_st my_tests[] = {
58 {"test_conc_173", test_conc_173, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
59};
60
61
62int main(int argc, char **argv)
63{
64 if (argc > 1)
65 get_options(argc, argv);
66
67 get_envvars();
68
69 run_tests(my_tests);
70
71 return(exit_status());
72}
73