#include <rmdb.h>
Definition at line 770 of file rmdb.h.
Public Member Functions | |
| void | Connect () |
| void | Disconnect () |
Private Member Functions | |
| bool | Init () |
| bool | Drop () |
| void | DefineExtFunctions () |
| void | ExistExtFunctions () |
| void | Check () |
| rm_DB () | |
| ~rm_DB () | |
Private Attributes | |
| bool | connected |
| log_CLASSID_m | |
Friends | |
| class | rm_Operator |
| rm_DB::rm_DB | ( | ) | [private] |
Definition at line 296 of file librmdb.exx.
References log_FUNC_m.
00296 { 00297 00298 log_FUNC_m(rm_DB); 00299 } //rm_DB::rm_DB ()
| rm_DB::~rm_DB | ( | ) | [private] |
Definition at line 303 of file librmdb.exx.
References log_FUNC_m.
00303 { 00304 log_FUNC_m(~rm_DB); 00305 } //rm_DB::~rm_DB ()
| void rm_DB::Connect | ( | ) |
Definition at line 248 of file librmdb.exx.
References Check(), dbg_LOW, errorDesc(), evt_ERROR, g_dbName(), log_DBG_m, log_FUNC_m, log_WriteEvent(), and SQL_NOERROR.
Referenced by rm_DBThread::Resume(), and rm_Operator::rm_Operator().
00248 { 00249 log_FUNC_m(Connect); 00250 00251 log_DBG_m(dbg_LOW, "g_dbName:" << g_dbName); 00252 00253 EXEC SQL 00254 CONNECT DB;/* USER 'sysdba' PASSWORD 'masterkey';*/ 00255 00256 if (SQLCODE != SQL_NOERROR) { 00257 string sqlErrDesc = errorDesc(SQLCODE,"Can not Connect DB"); 00258 log_WriteEvent(evt_ERROR, "Database can't be accessed. Is DB Server running?"); 00259 throw ivd_DBException( SQLCODE ,sqlErrDesc, true); 00260 00261 //throw ivd_Error( ie_RMDB_CONNECTPROBLEM ,"Can not connect to DB", true); 00262 }; 00263 log_DBG_m(dbg_LOW, "CONNECTED"); 00264 Check(); 00265 00266 00267 }//rm_DB::Connect()


| void rm_DB::Disconnect | ( | ) |
Definition at line 271 of file librmdb.exx.
References connected, dbg_LOW, errorDesc(), ie_RMDB_CONNECTPROBLEM, ivd_Error, log_DBG_m, log_FUNC_m, and SQL_NOERROR.
Referenced by rm_DBThread::Suspend(), and rm_Operator::~rm_Operator().
00271 { 00272 log_FUNC_m(Disconnect); 00273 00274 if (DB) { /* Is the Database. connected?*/ 00275 00276 EXEC SQL 00277 DISCONNECT DB; 00278 00279 if (SQLCODE != SQL_NOERROR) { 00280 00281 string sqlErrDesc = errorDesc(SQLCODE,"Can not disconnect DB"); 00282 throw ivd_DBException( SQLCODE ,sqlErrDesc, true); 00283 00284 //throw ivd_Error( ie_RMDB_CONNECTPROBLEM ,"Can not disconnect DB", true); 00285 }; 00286 connected = false; 00287 log_DBG_m(dbg_LOW, "DISCONNECT"); 00288 } 00289 else { 00290 throw ivd_Error( ie_RMDB_CONNECTPROBLEM ,"Database NOT Connected. Cannot disconnect", true); 00291 } 00292 }//rm_DB::Disconnect()


| bool rm_DB::Init | ( | ) | [private] |
| bool rm_DB::Drop | ( | ) | [private] |
| void rm_DB::DefineExtFunctions | ( | ) | [private] |
Definition at line 399 of file librmdb.exx.
References dbg_NORM, errorDesc(), ExistExtFunctions(), log_DBG_m, log_FUNC_m, and SQL_CHECK_M.
00399 { 00400 log_FUNC_m(DefineExtFunctions); 00401 00402 try { 00403 ExistExtFunctions(); 00404 log_DBG_m(dbg_NORM,"External function exists"); 00405 } catch (ivd_Error) { 00406 EXEC SQL DECLARE EXTERNAL FUNCTION bin_and 00407 INTEGER, INTEGER 00408 RETURNS INTEGER BY VALUE 00409 ENTRY_POINT 'IB_UDF_bin_and' MODULE_NAME 'ib_udf'; 00410 00411 string sqlErrDesc = errorDesc(SQLCODE, "define external function bin_and"); 00412 SQL_CHECK_M( sqlErrDesc ); 00413 }; 00414 } //rm_DB::DefineExtFunctions

| void rm_DB::ExistExtFunctions | ( | ) | [private] |
Definition at line 384 of file librmdb.exx.
References dbg_LOW, ie_RMDB_ERROR, ivd_Error, log_DBG_m, log_FUNC_m, and SQL_NOERROR.
Referenced by DefineExtFunctions().
00384 { 00385 00386 log_FUNC_m(ExistExtFunctions); 00387 EXEC SQL SELECT RDB$FUNCTION_NAME FROM RDB$FUNCTIONS WHERE RDB$FUNCTION_NAME = 'BIN_AND'; 00388 00389 if (SQLCODE != SQL_NOERROR) { 00390 throw ivd_Error(ie_RMDB_ERROR, "Missing External Function BIN_AND:" + SQLCODE); 00391 } 00392 else { 00393 log_DBG_m(dbg_LOW, "Found External Function BIN_AND"); 00394 }; 00395 } //rm_DB::ExistExtFunctions()

| void rm_DB::Check | ( | ) | [private] |
Definition at line 339 of file librmdb.exx.
References dbg_NORM, log_DBG_m, log_FUNC_m, and TableExists().
Referenced by Connect().
00339 { 00340 log_FUNC_m(Check); 00341 00342 //ExistExtFunctions(); 00343 TableExists("LIBRARY"); 00344 TableExists("DRIVE"); 00345 TableExists("DRIVEHOST"); 00346 TableExists("DISKSUBSYS"); 00347 TableExists("MEDIAPOOL"); 00348 TableExists("SLOT"); 00349 TableExists("MEDIA"); 00350 TableExists("MEDIAVOL"); 00351 TableExists("PARTITION"); 00352 TableExists("JOBID"); 00353 00354 log_DBG_m(dbg_NORM,"Check Tables success"); 00355 /* user check NYI 00356 Int32_t userCount = 0; 00357 char userName[100]; 00358 strcpy( userName, g_cmn.si.m_userName.c_str()); 00359 00360 unsigned int i = 0; 00361 while ( userName[i] != '\0' ){ 00362 userName[i] = toupper(userName[i]); 00363 i++; 00364 } 00365 00366 EXEC SQL 00367 SELECT COUNT (*) 00368 INTO :userCount 00369 FROM RDB$USER_PRIVILEGES 00370 WHERE RDB$USER = :userName; 00371 00372 if ( userCount == 0 ) { 00373 ostringstream str; 00374 str << "No grant permission for user " << userName; 00375 log_DBG_m(dbg_LOW, str.str() << " count:" << userCount); 00376 throw ivd_Error(ie_RMDB_ERROR, str.str()); 00377 } 00378 */ 00379 }


friend class rm_Operator [friend] |
bool rm_DB::connected [private] |
rm_DB::log_CLASSID_m [private] |
1.5.6