Ignore:
Timestamp:
08/05/04 16:13:48 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/msql
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msql/MSQLServer.cc

    r4513 r4514  
    460460}
    461461
     462Bool_t MSQLServer::IsConnected() const
     463{
     464    return fType==kIsServer ? fServ->IsConnected() : kFALSE;
     465}
     466
     467const 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
    462479void MSQLServer::Init(const char *connection, const char *user, const char *password) /*FOLD00*/
    463480{
     481    fType = kIsZombie;
     482
    464483    fServ = TSQLServer::Connect(connection, user, password);
    465484    if (fServ)
     
    469488    }
    470489    else
    471         fType = kIsZombie;
     490        SetBit(kZombie);
    472491
    473492    fList.SetOwner();
     
    479498}
    480499
    481 MSQLServer::MSQLServer(const char *u) /*FOLD00*/
     500MSQLServer::MSQLServer(const char *u) : fType(kIsZombie) /*FOLD00*/
    482501{
    483502    TString url(u);
     
    488507
    489508    if (pos1<0 || pos2<0 || pos3<0 || pos1>pos2 || pos2>pos3)
    490         return;
     509    {
     510        SetBit(kZombie);
     511        return;
     512    }
    491513
    492514    const TString user = url(pos1, pos2-pos1-1);
     
    496518
    497519    Init(url, user, pasw);
    498 
    499520}
    500521
     
    502523{
    503524    Close();
    504     cout << "Delete: " << GetName() << endl;
     525    if (gDebug>0)
     526        cout << "Delete: " << GetName() << endl;
    505527}
    506528
  • trunk/MagicSoft/Mars/msql/MSQLServer.h

    r3328 r4514  
    5757    const char *GetNameColumn()   const { return Form("%s/%s/%s", (const char*)fDataBase, (const char*)fTable, (const char*)fColumn); }
    5858
    59     const char *GetName() const
    60     {
    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 
    7059    void Init(const char *connection, const char *user, const char *password);
    7160
    7261public:
    7362    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)
    7564    {
    7665        fList.SetOwner();
     
    9382    MSQLServer(const char *connection, const char *user, const char *password);
    9483    MSQLServer(const char *link);
     84    ~MSQLServer();
    9585
    96     ~MSQLServer();
     86    const char *GetName() const;
    9787
    9888    void Print(Option_t *o) const;
     
    117107    Int_t       Shutdown();
    118108    const char *ServerInfo();
     109    Bool_t      IsConnected() const;
    119110
    120111    TString     GetEntry(const char *where, const char *col=0, const char *table=0) const;
Note: See TracChangeset for help on using the changeset viewer.