#include "hdbfileio.h"

HDbFileIo


class description - source file - inheritance tree (.pdf)

class HDbFileIo : public TObject

Inheritance Chart:
TObject
<-
HDbFileIo
    private:
void addTempTable(HDbTable* table) void checkCommit() Int_t checkTable(TString&) void confirmCommit() TString getActDate() Int_t getValues(TString&, Int_t) Bool_t openInput(const char*) Bool_t openOutput(const char*, const char*) void removeTempTable(HDbTable* table) Bool_t write(ostream&) public:
HDbFileIo() HDbFileIo(const HDbFileIo&) ~HDbFileIo() static TClass* Class() void clear() void closeDbConn() void closeFile() void commit() Bool_t connectDb(TString, TString dbName = db-hades) Bool_t dbIsOpen() void dropTemporaryTable(const char*) void dropTemporaryTables() Bool_t fileIsOpen() Bool_t fileIsWritable() Bool_t getAutoCommit() Bool_t getAutoNull() const char* getColumnDelimiter() const HDbTable* getCurTable() const char* getDateMask() const const char* getNullValue() const HDbTable* getTempTable(const char*) const char getTextDelimiter() const virtual TClass* IsA() const Bool_t makeInsert(const char*, const char*) Bool_t makeUpdate(const char*, const char*) Bool_t openFile(const char*, const char*) HDbFileIo& operator=(const HDbFileIo&) Bool_t printResult() Bool_t readFile(Int_t nLineStart = 1, Int_t nLineEnd = 999999) void rollback() void setAutoCommit(Bool_t b) void setAutoNull(Bool_t b = kTRUE) void setColumnDelimiter(const char* s = " ") Bool_t setDateMask(const char* mask = "DD-MON-YYYY HH24:MI:SS") void setNullValue(const char* s = "null") Bool_t setRun(const char* daqFile) Bool_t setSearchDate(const char* time = "sysdate") HDbTable* setTableName(const char*) void setTextDelimiter(const char s) void showExistingTable() virtual void ShowMembers(TMemberInspector& insp, char* parent) void showSettings() void showTemporaryTables() virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) Bool_t writeFile()

Data Members

    private:
HDbConn* dbConn Pointer to the Oracle connection class HDbFileUtil* dbUtil Pointer to the Oracle utility class ifstream* fin Pointer to an input filestream ofstream* fout Pointer to an output filestream TString defTableName Default table name (generated from filename) TList* tempTables List of temporary tables created in the current session HDbTable* refTable Pointer to an existing table HDbTable* curTable Pointer to a table form for I/O TString colDelim Delimiter between columns in the file TString textDelim Enclosing delimiter for text in a single column TString nullValue Identifier for a null value in a column Int_t maxBufLen Maximum length of the I/O buffer (4000 bytes) Int_t maxStmLen Maximum length of the insert statement (about 8000 bytes) Bool_t autoCommit Flag (if kTRUE, a transaction is committed automatically) Bool_t autoNull Flag (if kTRUE, null values are added automatically) TString actDateMask Actual date format Bool_t needsCommit Flag (is kTRUE, when inserts/updates where not yet committed)

Class Description

 HDbFileIo

 Oracle I/O class to load data from a client-side file into an Oracle table
 or to write data from an Oracle table to a client-side file
 (uses the Oracle C/C++ precompiler)

 Description  of the program:
      http://www-hades.gsi.de/persons/ilse/orafileio.htm



HDbFileIo()
 Constructor creates the Oracle connection class, but does not open a connection

~HDbFileIo()
 Destructor closes the Oracle connection and a file not yet closed

Bool_t connectDb(TString userName, TString dbName)
 Opens an Oracle connection (e.g.with:  "hades","db-hades")

void closeDbConn()
 Closes the Oracle connection
 Asks for committing all not yet saved transactions

Bool_t openFile(const char* fName,const char* ioMode)
 Closes an open file and opens the new file
 Possible I/O modes are "in", "out", "app"

void closeFile()
 Closes the file

Bool_t fileIsOpen()
 Returns kTRUE in case the file is open

Bool_t fileIsWritable()
 Returns kTRUE in case the file is writable

HDbTable* setTableName(const char* tableName)
 Sets the name of the Oracle table.
 Checks if a table with this name exists already.
 Returns a pointer to a table.
 For an existing table this form contains all columns of this table. If the
 table does not exist the list of columns is empty. This table can be used
 to define the columns for an insert/update.
 (You can call the HDbTable::clear() function to remove all columns from the
 list. Then all or only some columns can be added again in the order needed
 for the file I/O.)

void setColumnDelimiter(const char* s)
 Sets the delimiter beween columns (default value: " ")

Bool_t setDateMask(const char* mask)
 Sets a date mask in Oracle

Bool_t setSearchDate(const char* time)
 Sets the search date in Oracle used to select data from views which
 require a date specified before retrieving results.
 The default value is the actual time on the server.

Bool_t setRun(const char* daqFile)
 Sets the run in Oracle used to select data from views which require
 a run specified before retrieving results.

HDbTable* getTempTable(const char* tableName)
 Returns a pointer to a temporary table created inside the current
 Oracle session

void showTemporaryTables()
 Shows all temporary tables created inside the current Oracle session

void dropTemporaryTable(const char* tableName)
 Drops a temporary table created inside the current Oracle session.
 Each Drop must be confirmed.

void dropTemporaryTables()
 Drops all temporary tables created inside the current Oracle session.
 Each Drop must be confirmed.

void commit(void)
 Commits Oracle transactions

void rollback(void)
 Rolls back Oracle transactions

void showExistingTable()
 Shows the table definition of the existing table

void clear()
 Deletes the actual table objects curTable and refTable

void showSettings()
 Shows the actual parameter settings for the I/O

Bool_t readFile(Int_t nLineStart, Int_t nLineEnd)
 Reads a file starting at line nLineStart( default 1) and stopping after
 line nLineEnd (default 999999) or EOF and inserts the data into an Oracle
 table. Inserts into an existing table must be confirmed.
 When the name of the table was not set before, a default table name is
 generated from the filename. The creation of a temporary table must be
 confirmed.
 The file is not closed automatically.

Bool_t makeInsert(const char* colNames, const char* colValues)
 Inserts one row in the actual table
 colNames:  comma separated list of columns;
            use "*" for an insert with values for all columns
 colValues: comma separated list of values for the columns

Bool_t makeUpdate(const char* setVal, const char* condition)
 Updates one or more rows in a temporary table
 setVal   : SET part of an update statement (col1=val1, col2=val2, ...)
 condition: Condition for the columns to be updated
            WARNING: An empty condition will update all columns!

Bool_t writeFile()
 Writes the data from an Oracle table into a file

Bool_t printResult()
 Prints the data from an Oracle table on the screen

Bool_t openInput(const char* fileName)
 Opens a file for input and generates the default table name

Bool_t openOutput(const char* fileName, const char* oMode)
 Opens a file for output

Int_t checkTable(TString& line)
 Sets the default table name and table definition if necessary. Checks if
 the table exists and creates it otherwise. A newly created table is added
 in the list of temporary tables.

void addTempTable(HDbTable* table)
 Adds a temporary table to the list of temporary tables

void removeTempTable(HDbTable* table)
 Removes a table from the list of temporary tables and deletes it.
 Deletes also the actual tables when they have identical names.

Int_t getValues(TString& str, Int_t nColumns)
 Gets the column values from a line read from file

Bool_t write(ostream& pout)
 Writes the table content to a file or to stdout

TString getActDate()
 Returns the actual date and time

void checkCommit()
 Calls commit() when flag autoCommit is kTRUE

void confirmCommit()
 Ask to confirm uncommitted transactions



Inline Functions


             Bool_t dbIsOpen()
               void setTextDelimiter(const char s)
               void setNullValue(const char* s = "null")
               void setAutoCommit(Bool_t b)
               void setAutoNull(Bool_t b = kTRUE)
          HDbTable* getCurTable()
        const char* getColumnDelimiter() const
         const char getTextDelimiter() const
        const char* getNullValue() const
             Bool_t getAutoCommit()
             Bool_t getAutoNull()
        const char* getDateMask() const
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)
          HDbFileIo HDbFileIo(const HDbFileIo&)
         HDbFileIo& operator=(const HDbFileIo&)


Last update: 15/09/2000


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.