BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
test_db.C
Go to the documentation of this file.
1void test_db(TString strDbHost, TString strDbName, TString strUserName, TString strDbPassword)
2{
3 TString conString = TString::Format("pgsql://%s/%s", strDbHost.Data(), strDbName.Data());
4 TSQLServer* pSQLServer = TSQLServer::Connect(conString, strUserName.Data(), strDbPassword.Data());
5 if (pSQLServer == nullptr) {
6 cout << "ERROR: database connection was not established (" << strDbHost << ") for '" << strUserName << "' user"
7 << endl;
8 return;
9 }
10 cout << "Server info: " << pSQLServer->ServerInfo() << endl;
11 cout << "DB: " << pSQLServer->GetDB() << ". Type: " << pSQLServer->GetDBMS() << "." << endl;
12}
const char * GetDB() const
const char * GetDBMS() const
virtual const char * ServerInfo()=0
static TSQLServer * Connect(const char *db, const char *uid, const char *pw)
const char * Data() const
static TString Format(const char *fmt,...)