~drizzle-trunk/drizzle/development

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