20 #include <NDBT_Test.hpp>
22 #include <AtrtClient.hpp>
29 if (!atrt.getClusters(clusters))
33 while(clusters.next())
35 ndbout << clusters.column(
"name") << endl;
37 ndbout <<
"removing: " << clusters.column(
"name") << endl;
43 while(clusters.next())
45 ndbout << clusters.column(
"name") << endl;
58 if (!sql.doQuery(
"SELECT * FROM mysql.user", result))
64 ndbout << result.column(
"host") <<
", "
65 << result.column(
"uSer") <<
", "
66 << result.columnAsInt(
"max_updates") <<
", "
73 ndbout << result.column(
"host") << endl;
81 if (sql.doQuery(
"SELECT * FROM mysql.user WHERE name=?", args, result))
90 args.
put(
"0",
"no_such_host");
91 if (!sql.doQuery(
"SELECT * FROM mysql.user WHERE host=?", args, result))
93 ndbout <<
"no rows" << endl;
98 args.
put(
"0",
"localhost");
99 if (!sql.doQuery(
"SELECT host, user FROM mysql.user WHERE host=?",
106 if (!sql.doQuery(
"DROP TABLE IF EXISTS sql_client_test"))
109 if (!sql.doQuery(
"CREATE TABLE sql_client_test"
110 "(a int, b varchar(255), c bigint)"))
113 if (!sql.doQuery(
"INSERT INTO sql_client_test VALUES"
114 "(1, 'hello', 456456456789),"
115 "(2, 'bye', 9000000000)"))
120 if (!sql.doQuery(
"SELECT * FROM sql_client_test", result))
131 if (!sql.doQuery(
"SELECT * FROM sql_client_test WHERE a=?", args,result))
138 ndbout <<
"a: " << result.columnAsInt(
"a") << endl
139 <<
"b: " << result.column(
"b") << endl
140 <<
"c: " << result.columnAsLong(
"c") << endl;
141 if (result.columnAsInt(
"a") != 2){
142 ndbout <<
"hepp1" << endl;
146 if (strcmp(result.column(
"b"),
"bye")){
147 ndbout <<
"hepp2" << endl;
151 if (result.columnAsLong(
"c") != 9000000000ULL){
152 ndbout <<
"hepp3" << endl;
158 if (sql.selectCountTable(
"sql_client_test") != 2)
160 ndbout <<
"Got wrong count" << endl;
165 if (!sql.doQuery(
"DROP TABLE sql_client_test"))
173 NDBT_TESTSUITE(testNDBT);
174 TESTCASE(
"AtrtClient",
175 "Test AtrtClient class"){
176 INITIALIZER(runTestAtrtClient);
179 "Test DbUtil class"){
180 INITIALIZER(runTestDbUtil);
182 NDBT_TESTSUITE_END(testNDBT);
184 int main(
int argc,
const char** argv){
186 NDBT_TESTSUITE_INSTANCE(testNDBT);
187 return testNDBT.execute(argc, argv);