1/* Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc.
2 Use is subject to license terms.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
17#include <my_global.h>
18#include <my_sys.h>
19#include <mysql.h>
20#include <m_string.h>
21#include <assert.h>
22
23int main (int argc, char **argv)
24{
25 MYSQL conn;
26 int OK __attribute__((unused));
27
28 const char* query4= "INSERT INTO federated.t1 SET Value=54";
29 const char* query5= "INSERT INTO federated.t1 SET Value=55";
30
31 MY_INIT(argv[0]);
32
33 if (argc != 2 || !strcmp(argv[1], "--help"))
34 {
35 fprintf(stderr, "This program is a part of the MySQL test suite. "
36 "It is not intended to be executed directly by a user.\n");
37 return -1;
38 }
39
40 mysql_init(&conn);
41 if (!mysql_real_connect(
42 &conn,
43 "127.0.0.1",
44 "root",
45 "",
46 "test",
47 atoi(argv[1]),
48 NULL,
49 CLIENT_FOUND_ROWS))
50 {
51 fprintf(stderr, "Failed to connect to database: Error: %s\n",
52 mysql_error(&conn));
53 return 1;
54 } else {
55 printf("%s\n", mysql_error(&conn));
56 }
57
58 OK = mysql_real_query (&conn, query4, (uint) strlen(query4));
59
60 assert(0 == OK);
61
62 printf("%ld inserted\n",
63 (long) mysql_insert_id(&conn));
64
65 OK = mysql_real_query (&conn, query5, (uint) strlen(query5));
66
67 assert(0 == OK);
68
69 printf("%ld inserted\n",
70 (long) mysql_insert_id(&conn));
71
72 mysql_close(&conn);
73 mysql_server_end();
74 my_end(0);
75
76 return 0;
77}
78
79