81 #include "StDbServer.hh"
82 #include "StDbTable.h"
83 #include "StDbConfigNode.hh"
86 #define __CLASS__ "StDbServer"
90 StDbServer::StDbServer(): mserverName(0),mhostName(0), munixSocket(0), muserName(0), mpword(0), misDefault(false){};
92 StDbServer::StDbServer(
const char* name,
const char* host,
const char* sock,
int port) : mserverName(0),mhostName(0), munixSocket(0), muserName(0), mpword(0), mportNumber(port), misDefault(false) {
99 StDbServer::StDbServer(
StDbServer& server) : mserverName(0), mhostName(0), munixSocket(0) , muserName(0), mpword(0), misDefault(false) {
101 setServerName(server.printServerName());
102 setHostName(server.printHostName());
103 setUnixSocket(server.printUnixSocket());
104 setPortNumber(server.getPortNumber());
108 StDbServer::~StDbServer(){
109 if(mserverName)
delete [] mserverName;
110 if(mhostName)
delete [] mhostName;
111 if(munixSocket)
delete [] munixSocket;
112 if(muserName)
delete [] muserName;
113 if(mpword)
delete [] mpword;
117 void StDbServer::setHostName(
const char* name) {mhostName=mstringDup(name); }
118 void StDbServer::setUnixSocket(
const char* name){munixSocket=mstringDup(name);}
119 void StDbServer::setServerName(
const char* name){mserverName=mstringDup(name);}
124 StDbServer::setUser(
const char* name,
const char* pword){
125 muserName=mstringDup(name);
126 mpword=mstringDup(pword);
131 char* StDbServer::getHostName()
const {
return mstringDup(mhostName); };
132 char* StDbServer::getUnixSocket()
const {
return mstringDup(munixSocket); }
133 char* StDbServer::getServerName()
const {
return mstringDup(mserverName); }
137 char* StDbServer::mstringDup(
const char* str)
const {
140 if(!str)
return retString;
141 retString =
new char[strlen(str)+1];
142 strcpy(retString,str);