Changeset 4513 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/05/04 15:03:07 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4511 r4513  
    2121 2004/08/05: Thomas Bretz
    2222
    23    * manalysis/MGeomApply.cc:
     23   * manalysis/MGeomApply.cc, mimage/MCameraSmooth.[h,cc]:
    2424     - removed dependancy on MBlindPixel
     25
     26   * macros/sql/readrbk.C, msql/MSQLServer.cc:
     27     - fixed some memory leaks - the result of TSQLServer::Query
     28       must be deleted
     29
     30   * mbase/MTaskInteractive.cc:
     31     - added some comments
     32
     33   * mmain/MBrowser.cc:
     34     - fixed a bug which caused '/data/MAGIC' not to be shown in
     35       the dir-list
     36
     37   * mmc/MMcEvt.hxx:
     38     - added some more particle ids
     39
    2540
    2641
  • trunk/MagicSoft/Mars/macros/sql/readrbk.C

    r4443 r4513  
    5151    TSQLRow *row;
    5252
    53     TList rows;
     53    Bool_t rc = kFALSE;
    5454    while (row=res->Next())
    5555    {
    5656        if ((*row)[0])
    57             return kTRUE;
     57        {
     58            rc = kTRUE;
     59            break;
     60        }
    5861    }
    5962
    60     return kFALSE;
     63    delete res;
     64
     65    return rc;
    6166}
    6267
     
    146151        query += "\");";
    147152
    148         if (!serv->Query(query))
     153        TSQLResult *res = serv->Query(query);
     154        if (!res)
    149155            cout << "ERROR: " << query << endl << endl;
    150156        else
     157        {
     158            delete res;
    151159            num++;
     160        }
    152161
    153162        entry = "";
  • trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc

    r4452 r4513  
    7272// --------------------------------------------------------------------------
    7373//
     74// Default Constructor. Takes name and title of the interactive task
    7475//
    7576MTaskInteractive::MTaskInteractive(const char *name, const char *title) :
     
    8485}
    8586
     87// --------------------------------------------------------------------------
     88//
     89// Destructor. Free all resources.
     90//
    8691MTaskInteractive::~MTaskInteractive()
    8792{
     
    9196}
    9297
     98// --------------------------------------------------------------------------
     99//
     100// Calls the function and returns its return value.
     101// Called by PreProcess, Process, PostProcess and ReInit.
     102//
    93103inline Int_t MTaskInteractive::Return(Int_t no, void *params)
    94104{
     
    107117}
    108118
     119// --------------------------------------------------------------------------
     120//
     121// Generalized function to set the functions of your interactive task.
     122// Called by SetPreProcess, SetProcess, SetPostProcess and SetReInit
     123//
    109124Bool_t MTaskInteractive::Set(void *fcn, Int_t no, const char *params)
    110125{
     
    138153}
    139154
     155// --------------------------------------------------------------------------
     156//
     157//
     158//
    140159void MTaskInteractive::Free(Int_t no)
    141160{
  • trunk/MagicSoft/Mars/mmain/MBrowser.cc

    r3069 r4513  
    137137
    138138    const TGPicture *pic0 = fList->GetPicture("magic_t.xpm");
    139     if (!pic0)
     139    if (pic0)
    140140    {
     141        dir->GetListBox()->Resize(100, 150);
    141142        TGTreeLBEntry *entry = new TGTreeLBEntry(dir->GetListBox()->GetContainer(),
    142143                                                 new TGString("/data/MAGIC"), pic0, 6000,
     
    144145        TGLayoutHints *laylb = new TGLayoutHints(kLHintsLeft|kLHintsTop, 14, 0, 0, 0);
    145146        dir->AddEntry(entry, laylb);
    146         // Note necessary - deleted in ~TGLBContainer: fList->Add(laylb);
    147         fList->Add(entry);
     147        // Not necessary - deleted in ~TGLBContainer: fList->Add(laylb);
     148        // fList->Add(laylb);
    148149    }
    149150
  • trunk/MagicSoft/Mars/msql/MSQLServer.cc

    r3415 r4513  
    3131//  many features usefull working with relational tables.
    3232//
     33//  Use it like TSQlServer:
     34//    new MSQLServer("mysql://localhost:3306", "hercules", "stdmagicpassword");
     35//    // now start your TBrowser
     36//    new TBrowser;
     37//
    3338////////////////////////////////////////////////////////////////////////
    3439#include "MSQLServer.h"
     
    7277    const TString desc((*row)[1]);
    7378
    74     //cout << "Column Type: " << desc << endl;
     79    delete res;
    7580
    7681    const Bool_t isnum =
     
    119124        num++;
    120125    }
     126
     127    delete res;
    121128
    122129    if (!isnum)
     
    297304    TSQLResult *res = fServ->Query(query);
    298305    if (res)
     306    {
    299307        PrintTable(res);
     308        delete res;
     309    }
    300310    else
    301311        cout << "Query failed: " << query << endl;
     
    519529
    520530    if (res->GetFieldCount()!=1)
     531    {
     532        delete res;
    521533        return (PrintError("GetEntry - Number of columns != 1", query), "");
     534    }
    522535
    523536    if (res->GetRowCount()>1)
     537    {
     538        delete res;
    524539        return (PrintError("GetEntry - Number of rows > 1", query), "");
     540    }
    525541
    526542    if (res->GetRowCount()==0)
     543    {
     544        delete res;
    527545        return "";
     546    }
    528547
    529548    const char *fld = res->Next()->GetField(0);
    530549    if (!fld)
     550    {
     551        delete res;
    531552        return (PrintError("GetEntry - Entry is empty", query), "");
    532 
    533     return TString(fld);
    534 }
     553    }
     554
     555    const TString rc(fld);
     556    delete res;
     557    return rc;
     558}
Note: See TracChangeset for help on using the changeset viewer.