BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
test_db.C
Go to the documentation of this file.
1
void
test_db
()
2
{
3
TStopwatch
timer;
4
timer.
Start
();
5
gDebug
= 0;
6
7
UniConnection
* connDb =
UniConnection::Open
();
8
if
(connDb ==
nullptr
)
9
return
;
10
11
TSQLServer
* uni_db = connDb->
GetSQLServer
();
12
13
cout <<
"Host: "
<< uni_db->
GetHost
() <<
". DB: "
<< uni_db->
GetDB
() <<
". Type: "
<< uni_db->
GetDBMS
() <<
"."
14
<< endl;
15
16
int
iParameterID = 1;
17
TSQLStatement
* stmt = uni_db->
Statement
(
TString::Format
(
"select parameter_name "
18
"from parameter_ "
19
"where parameter_id = %d"
,
20
iParameterID));
21
22
stmt->
Process
();
23
// store result of statement in buffer
24
stmt->
StoreResult
();
25
26
// extract rows one after another
27
if
(!stmt->
NextResultRow
()) {
28
cout <<
"ERROR: parameter with number 1 wasn't found!"
<< endl;
29
delete
stmt;
30
return
;
31
}
32
33
TString
parameter_name = stmt->
GetString
(0);
34
delete
stmt;
35
delete
connDb;
36
37
timer.
Stop
();
38
Double_t
rtime = timer.
RealTime
(), ctime = timer.
CpuTime
();
39
printf(
"RealTime=%f seconds, CpuTime=%f seconds\n"
, rtime, ctime);
40
41
cout <<
"Test was successfull"
<< endl;
42
}
gDebug
Int_t gDebug
Double_t
double Double_t
TSQLServer
TSQLServer::GetDB
const char * GetDB() const
TSQLServer::GetHost
const char * GetHost() const
TSQLServer::GetDBMS
const char * GetDBMS() const
TSQLServer::Statement
virtual TSQLStatement * Statement(const char *, Int_t=100)
TSQLStatement
TSQLStatement::GetString
virtual const char * GetString(Int_t)
TSQLStatement::NextResultRow
virtual Bool_t NextResultRow()=0
TSQLStatement::Process
virtual Bool_t Process()=0
TSQLStatement::StoreResult
virtual Bool_t StoreResult()=0
TStopwatch
TStopwatch::RealTime
Double_t RealTime()
TStopwatch::Start
void Start(Bool_t reset=kTRUE)
TStopwatch::CpuTime
Double_t CpuTime()
TStopwatch::Stop
void Stop()
TString
TString::Format
static TString Format(const char *fmt,...)
UniConnection
Definition
UniConnection.h:27
UniConnection::Open
static UniConnection * Open()
Definition
UniConnection.cxx:56
UniConnection::GetSQLServer
TSQLServer * GetSQLServer()
Definition
UniConnection.h:43
test_db
void test_db()
Definition
test_db.C:1
install
database
uni_db
macros
test_db.C
Generated on
for BmnRoot by
1.17.0