18 #include <ndb_global.h>
25 static const char* _dbname =
"TEST_DB";
27 const char *load_default_groups[]= {
"mysql_cluster",0 };
29 static struct my_option my_long_options[] =
31 NDB_STD_OPTS(
"ndb_desc"),
32 {
"database",
'd',
"Name of database table is in",
33 (uchar**) &_dbname, (uchar**) &_dbname, 0,
34 GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
35 { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
38 static void short_usage_sub(
void)
40 ndb_short_usage_sub(NULL);
45 ndb_usage(short_usage_sub, load_default_groups, my_long_options);
48 int main(
int argc,
char** argv){
50 ndb_opt_set_usage_funcs(short_usage_sub, usage);
51 load_defaults(
"my",load_default_groups,&argc,&argv);
53 if ((ho_error=handle_options(&argc, &argv, my_long_options,
54 ndb_std_get_one_option)))
55 return NDBT_ProgramExit(NDBT_WRONGARGS);
58 return NDBT_ProgramExit(NDBT_WRONGARGS);
65 ndbout <<
"Unable to connect to management server." << endl;
66 return NDBT_ProgramExit(NDBT_FAILED);
70 ndbout <<
"Cluster nodes not ready in 30 seconds." << endl;
71 return NDBT_ProgramExit(NDBT_FAILED);
74 Ndb MyNdb(&con, _dbname );
75 if(MyNdb.init() != 0){
76 ERR(MyNdb.getNdbError());
77 return NDBT_ProgramExit(NDBT_FAILED);
81 for(
int i = 0;
i<argc;
i++){
82 ndbout <<
"Dropping table " << argv[
i] <<
"...";
84 if((tmp = MyNdb.getDictionary()->dropTable(argv[
i])) != 0){
85 ndbout << endl << MyNdb.getDictionary()->getNdbError() << endl;
88 ndbout <<
"OK" << endl;
93 return NDBT_ProgramExit(NDBT_FAILED);
96 return NDBT_ProgramExit(NDBT_OK);