Changeset 4514 for trunk/MagicSoft/Mars/msql
- Timestamp:
- 08/05/04 16:13:48 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/msql
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msql/MSQLServer.cc
r4513 r4514 460 460 } 461 461 462 Bool_t MSQLServer::IsConnected() const 463 { 464 return fType==kIsServer ? fServ->IsConnected() : kFALSE; 465 } 466 467 const char *MSQLServer::GetName() const 468 { 469 switch (fType) 470 { 471 case kIsServer: return Form("%s://%s:%d", fServ->GetDBMS(), fServ->GetHost(), fServ->GetPort()); 472 case kIsDataBase: return GetNameDataBase(); 473 case kIsTable: return GetNameTable(); 474 case kIsColumn: return GetNameColumn(); 475 default: return "n/a"; 476 } 477 } 478 462 479 void MSQLServer::Init(const char *connection, const char *user, const char *password) /*FOLD00*/ 463 480 { 481 fType = kIsZombie; 482 464 483 fServ = TSQLServer::Connect(connection, user, password); 465 484 if (fServ) … … 469 488 } 470 489 else 471 fType = kIsZombie;490 SetBit(kZombie); 472 491 473 492 fList.SetOwner(); … … 479 498 } 480 499 481 MSQLServer::MSQLServer(const char *u) /*FOLD00*/500 MSQLServer::MSQLServer(const char *u) : fType(kIsZombie) /*FOLD00*/ 482 501 { 483 502 TString url(u); … … 488 507 489 508 if (pos1<0 || pos2<0 || pos3<0 || pos1>pos2 || pos2>pos3) 490 return; 509 { 510 SetBit(kZombie); 511 return; 512 } 491 513 492 514 const TString user = url(pos1, pos2-pos1-1); … … 496 518 497 519 Init(url, user, pasw); 498 499 520 } 500 521 … … 502 523 { 503 524 Close(); 504 cout << "Delete: " << GetName() << endl; 525 if (gDebug>0) 526 cout << "Delete: " << GetName() << endl; 505 527 } 506 528 -
trunk/MagicSoft/Mars/msql/MSQLServer.h
r3328 r4514 57 57 const char *GetNameColumn() const { return Form("%s/%s/%s", (const char*)fDataBase, (const char*)fTable, (const char*)fColumn); } 58 58 59 const char *GetName() const60 {61 switch (fType)62 {63 case kIsDataBase: return GetNameDataBase();64 case kIsTable: return GetNameTable();65 case kIsColumn: return GetNameColumn();66 default: return "n/a";67 }68 }69 70 59 void Init(const char *connection, const char *user, const char *password); 71 60 72 61 public: 73 62 MSQLServer(TSQLServer *serv, const char *dbname=0, const char *tname=0, const char *col=0) 74 : fServ(serv), fDataBase(dbname), fTable(tname), fColumn(col) 63 : fServ(serv), fDataBase(dbname), fTable(tname), fColumn(col), fType(kIsZombie) 75 64 { 76 65 fList.SetOwner(); … … 93 82 MSQLServer(const char *connection, const char *user, const char *password); 94 83 MSQLServer(const char *link); 84 ~MSQLServer(); 95 85 96 ~MSQLServer();86 const char *GetName() const; 97 87 98 88 void Print(Option_t *o) const; … … 117 107 Int_t Shutdown(); 118 108 const char *ServerInfo(); 109 Bool_t IsConnected() const; 119 110 120 111 TString GetEntry(const char *where, const char *col=0, const char *table=0) const;
Note:
See TracChangeset
for help on using the changeset viewer.