summaryrefslogtreecommitdiff
path: root/storage/ndb/test/odbc/client/main.cpp
blob: b202b6de111b1b936640f2eb2128b96ee07d4e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* Copyright (C) 2003 MySQL AB

   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; either version 2 of the License, or
   (at your option) any later version.

   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

 /**
 * @file main.cpp
 */

#include <common.hpp>

/**
 * main ODBC Tests
 *
 * Tests main ODBC functions.
 */

#include <common.hpp>

int check = NDBT_OK;
static char* myConnectString;

char* connectString()
{
  return myConnectString;
}

int main(int argc, char** argv)
{

  if (argc != 3) {
    return NDBT_ProgramExit(NDBT_WRONGARGS);
  }
  myConnectString = argv[1];

  if ( strcmp(argv[2], "help") == 0 )
    {
      ndbout << "Number of Testing Program   " << "  Name of Testing Program" << endl;
      ndbout << "      1                       SQLGetDataTest()" << endl;
      ndbout << "      2                       SQLTablesTest()" << endl;
      ndbout << "      3                       SQLGetFunctionsTest()" << endl;
      ndbout << "      4                       SQLGetInfoTest()" << endl;
      ndbout << "      5                       SQLGetTypeInfoTest()" << endl;
      ndbout << "      6                       SQLDisconnectTest()" << endl;
      ndbout << "      7                       SQLFetchTest()" << endl;
      ndbout << "      8                       SQLRowCountTest()" << endl;
      ndbout << "      9                       SQLGetCursorNameTest()" << endl;
      ndbout << "      10                      SQLCancelTest()" << endl;
      ndbout << "      11                      SQLTransactTest()" << endl;
      ndbout << "      12                      SQLSetCursorNameTest()" << endl;
      ndbout << "      13                      SQLNumResultColsTest()" << endl;
      ndbout << "      14                      SQLDescribeColTest()" << endl;
      ndbout << "      15                      SQLExecDirectTest()" << endl;
      ndbout << "      16                      SQLColAttributeTest3()" << endl;
      ndbout << "      17                      SQLColAttributeTest2()" << endl;
      ndbout << "      18                      SQLColAttributeTest1()" << endl;
      ndbout << "      19                      SQLColAttributeTest()" << endl;
      ndbout << "      20                      SQLBindColTest()" << endl;
      ndbout << "      21                      SQLGetDiagRecSimpleTest()" << endl;
      ndbout << "      22                      SQLConnectTest()" << endl;
      ndbout << "      23                      SQLPrepareTest()" << endl;
    }
  else
    {

      ndbout << endl << "Executing Files Name = " << argv[0] << endl;
      ndbout << "The Number of testing program = " << argv[2] << endl;

      int i = atoi(argv[2]);
      switch (i) {
      case 1:
	if (check == NDBT_OK) check = SQLGetDataTest();
	break;
      case 2:
	if (check == NDBT_OK) check = SQLTablesTest();
	break;
      case 3:
	if (check == NDBT_OK) check = SQLGetFunctionsTest();
	break;
      case 4:
	if (check == NDBT_OK) check = SQLGetInfoTest();
	break;
      case 5:
	if (check == NDBT_OK) check = SQLGetTypeInfoTest();
	break;
      case 6:
	if (check == NDBT_OK) check = SQLDisconnectTest();
	break;
      case 7:
	if (check == NDBT_OK) check = SQLFetchTest();
	break;
      case 8:
	if (check == NDBT_OK) check = SQLRowCountTest();
	break;
      case 9:
	if (check == NDBT_OK) check = SQLGetCursorNameTest();
	break;
      case 10:
	if (check == NDBT_OK) check = SQLCancelTest();
	break;
      case 11:
	if (check == NDBT_OK) check = SQLTransactTest();
	break;
      case 12:
	if (check == NDBT_OK) check = SQLSetCursorNameTest();
	break;
      case 13:
	if (check == NDBT_OK) check = SQLNumResultColsTest();
	break;
      case 14:
	if (check == NDBT_OK) check = SQLDescribeColTest();
	break;
      case 15:
	if (check == NDBT_OK) check = SQLExecDirectTest();
	break;
      case 16:
	if (check == NDBT_OK) check = SQLColAttributeTest3();
	break;
      case 17:
	if (check == NDBT_OK) check = SQLColAttributeTest2();
	break;
      case 18:
	if (check == NDBT_OK) check = SQLColAttributeTest1();
	break;
      case 19:
	if (check == NDBT_OK) check = SQLColAttributeTest();
	break;
      case 20:
	if (check == NDBT_OK) check = SQLBindColTest();
	break;
      case 21:
	if (check == NDBT_OK) check = SQLGetDiagRecSimpleTest();
	break;
      case 22:
	if (check == NDBT_OK) check = SQLConnectTest();
	break;
      case 23:
	if (check == NDBT_OK) check = SQLPrepareTest();
	break;
      }
    }

  return NDBT_ProgramExit(check);
}