00001 #ifndef DBIASCIIDBIMPORTER_H 00002 #define DBIASCIIDBIMPORTER_H 00003 00004 /** 00005 * 00006 00007 * \class TDbiAsciiDbImporter 00008 * 00009 * 00010 * \brief 00011 * <b>Concept</b> A utility to prepare an ASCII database from a 00012 * a collection of ASCII files. 00013 * 00014 * 00015 * <b>Purpose</b> To prepare a temporary (process specific) ASCII database. 00016 * 00017 * 00018 * <b>Acknowledgments</b> The code is essentially a translation of 00019 * RDBC/TSQLImporter by Valeriy Onuchin 21/03/2001 00020 * 00021 * Contact: A.Finch@lancaster.ac.uk 00022 * 00023 * 00024 * 00025 */ 00026 00027 #include <list> 00028 #include <string> 00029 00030 #include "TDbiExceptionLog.hxx" 00031 00032 class TDbiAsciiTablePreparer; 00033 class TSQLServer; 00034 class TString; 00035 00036 00037 class TDbiAsciiDbImporter 00038 { 00039 public: 00040 TDbiAsciiDbImporter(); 00041 TDbiAsciiDbImporter(const TString& url,TSQLServer* server); 00042 virtual ~TDbiAsciiDbImporter(); 00043 00044 const TDbiExceptionLog& GetExceptionLog() const { return fExceptionLog; } 00045 Int_t Import(const TString& url,TSQLServer* server); 00046 const std::list<std::string>& GetImportedTableNames() const { return fImportedTableNames; } 00047 Bool_t IsValid() const; 00048 00049 00050 private: 00051 void LoadCatalog(const TString& url); 00052 void LoadTable(const TString& url); 00053 00054 00055 /// Status of import procedure, fStatus < 400 status is OK 00056 Int_t fStatus; 00057 00058 /// Log of exceptions generated. 00059 TDbiExceptionLog fExceptionLog; 00060 00061 /// List of imported table names 00062 std::list<std::string> fImportedTableNames; 00063 00064 00065 /// Where to import data. Not owned. 00066 TSQLServer* fServer; 00067 00068 /// Helper class used to prepare a single table. May be null 00069 TDbiAsciiTablePreparer* fTablePreparer; 00070 00071 00072 ClassDef(TDbiAsciiDbImporter,0)// class used to create a temporary ASCII database 00073 }; 00074 00075 00076 00077 #endif // DBIASCIIDBIMPORTER_H 00078