TDbiAsciiTablePreparer.hxx

Go to the documentation of this file.
00001 #ifndef DBIASCIITABLEPREPARER_H
00002 #define DBIASCIITABLEPREPARER_H
00003 
00004 /**
00005  *
00006  * $Id: TDbiAsciiTablePreparer.hxx,v 1.1 2011/01/18 05:49:19 finch Exp $
00007  *
00008  * \class TDbiAsciiTablePreparer
00009  *
00010  *
00011  * \brief
00012  * <b>Concept</b> A helper class to prepare an ASCII database table file
00013  *         for importing
00014  *
00015  * 
00016  * <b>Purpose</b> To simplifly the construction of a temporary (process specific)
00017  *  ASCII database.
00018  *
00019  * 
00020  * <b>Acknowledgments</b> The code is essentially a translation of
00021  *    RDBC/TSQLImporterClient by Valeriy Onuchin 21/03/2001
00022  *
00023  *
00024  * Contact: A.Finch@lancaster.ac.uk
00025  *
00026  *
00027  */
00028 
00029 
00030 #include "TUrl.h"
00031 #include "TString.h"
00032 
00033 #include "TDbiExceptionLog.hxx"
00034 
00035 
00036 class TDbiAsciiTablePreparer
00037 {
00038 
00039 public:
00040    TDbiAsciiTablePreparer(const TString& url);
00041    virtual ~TDbiAsciiTablePreparer();
00042 
00043    const TDbiExceptionLog& GetExceptionLog() const { return fExceptionLog; }
00044    TString GetLocal() const { return fLocalFile.IsNull() ? 0 : "LOCAL"; }
00045    TString GetTableName() const { return fTableName; }
00046    TString GetColumns() const { return fColumns; }
00047    TString GetLocalFile() const { return fLocalFile; }
00048      Int_t GetSkipLines() const { return fSkipLines; }
00049      Int_t GetStatus() const { return fStatus; }
00050     Bool_t IsValid() const { return ((fStatus >= 200)&&(fStatus < 300)); }
00051 
00052 
00053 private:
00054 
00055    virtual  Int_t Init();
00056    virtual  void  GET(const TString& url);
00057    virtual  void  Clean();
00058 
00059 
00060 /// local file will be deleted (downloaded file)
00061    Bool_t fMustDeleteLocalFile;
00062 
00063 /// Log of exceptions generated.
00064 /// Cleared by Open Close and (implicitly) by CreatePreparedStatement, GetServer
00065   TDbiExceptionLog fExceptionLog;
00066 
00067 /// url
00068    TUrl* fUrl;
00069 
00070 /// local file
00071    TString  fLocalFile;
00072 
00073 /// table name
00074    TString  fTableName;
00075 
00076 /// column names & types
00077    TString  fColumns;
00078 
00079 /// status (corresponds HTTP Status Codes)
00080    Int_t    fStatus;
00081 
00082 /// number of lines to skip
00083    Int_t    fSkipLines;
00084 
00085 ClassDef(TDbiAsciiTablePreparer,0)// Class used to prepare a table for a temporary ASCII database
00086 };
00087 
00088 
00089 //    from /usr/include/apache/httpd.h
00090 #ifndef APACHE_HTTPD_H
00091   #define HTTP_OK                            200
00092   #define HTTP_BAD_REQUEST                   400
00093   #define HTTP_FORBIDDEN                     403
00094   #define HTTP_NOT_FOUND                     404
00095   #define HTTP_NOT_ACCEPTABLE                406
00096 #endif //APACHE_HTTPD_H
00097 
00098 
00099 #endif // DBIASCIITABLEPREPARER_H
00100 

Generated on 11 Aug 2013 for SKDatabase by  doxygen 1.6.1