Commit 5e85c850 authored by unknown's avatar unknown

DbUtil.hpp, DbUtil.cpp, NdbRepStress.cpp:

  More code improvments


storage/ndb/test/include/DbUtil.hpp:
  More code improvments
storage/ndb/test/src/DbUtil.cpp:
  More code improvments
storage/ndb/test/ndbapi/acrt/NdbRepStress.cpp:
  More code improvments
parent 0f5cf864
......@@ -90,9 +90,10 @@ public:
int connect();
int selectDb();
int selectDb(const char * m_db);
int doQuery(char * stm);
int doQuery(const char * stm);
int selectDb(const char *);
int createDb(BaseString&);
int doQuery(BaseString&);
int doQuery(const char *);
int getErrorNumber();
unsigned long selectCountTable(const char * table);
......
......@@ -99,6 +99,7 @@ DbUtil::databaseLogin(const char* system, const char* usr,
mysql_get_server_info(mysql),
(unsigned long) mysql_get_server_version(mysql));
#endif
this->selectDb();
}
/* Database Connect */
......@@ -132,7 +133,7 @@ DbUtil::connect()
mysql_close(mysql);
return DBU_FAILED;
}
this->selectDb();
m_connected = true;
return DBU_OK;
}
......@@ -243,15 +244,32 @@ DbUtil::selectDb(const char * m_db)
}
}
int
DbUtil::createDb(BaseString& m_db)
{
BaseString stm;
{
if(mysql_select_db(this->getMysql(), m_db.c_str()) == DBU_OK)
{
stm.assfmt("DROP DATABASE %s", m_db.c_str());
if(this->doQuery(m_db.c_str()) == DBU_FAILED)
return DBU_FAILED;
}
stm.assfmt("CREATE DATABASE %s", m_db.c_str());
if(this->doQuery(m_db.c_str()) == DBU_FAILED)
return DBU_FAILED;
return DBU_OK;
}
}
/* Run Simple Queries */
int
DbUtil::doQuery(char * stm)
DbUtil::doQuery(BaseString& str)
{
if(mysql_query(this->getMysql(), stm))
if(mysql_query(this->getMysql(), str.c_str()))
{
this->printError(stm);
this->printError(str.c_str());
return DBU_FAILED;
}
return DBU_OK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment