Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

StDbFastSqlWriter.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * 00003 * $Id: StDbFastSqlWriter.h,v 1.4 2004/01/15 00:02:25 fisyak Exp $ 00004 * 00005 * Author: R. Jeff Porter 00006 *************************************************************************** 00007 * 00008 * Description: implement typeAcceptor for WRITING XML files of DB-tables 00009 * 00010 *************************************************************************** 00011 * 00012 * $Log: StDbFastSqlWriter.h,v $ 00013 * Revision 1.4 2004/01/15 00:02:25 fisyak 00014 * Replace ostringstream => StString, add option for alpha 00015 * 00016 * Revision 1.3 2003/09/16 22:44:17 porter 00017 * got rid of all ostrstream objects; replaced with StString+string. 00018 * modified rules.make and added file stdb_streams.h for standalone compilation 00019 * 00020 * Revision 1.2 2003/09/02 17:57:49 perev 00021 * gcc 3.2 updates + WarnOff 00022 * 00023 * Revision 1.1 2003/04/11 22:47:36 porter 00024 * Added a fast multi-row write model specifically needed by the daqEventTag 00025 * writer. Speed increased from about 100Hz to ~3000Hz. It is only invoked if 00026 * the table is marked as Non-Indexed (daqTags & scalers). For non-indexed tables 00027 * which include binary stored data (we don't have any yet), the fast writer has 00028 * to invoke a slower buffer so that the rates are a bit slower (~500Hz at 50 rows/insert). 00029 * 00030 * Revision 1.6 2001/10/24 04:05:20 porter 00031 * added long long type to I/O and got rid of obsolete dataIndex table 00032 * 00033 * Revision 1.5 2000/01/10 20:37:55 porter 00034 * expanded functionality based on planned additions or feedback from Online work. 00035 * update includes: 00036 * 1. basis for real transaction model with roll-back 00037 * 2. limited SQL access via the manager for run-log & tagDb 00038 * 3. balance obtained between enumerated & string access to databases 00039 * 4. 3-levels of diagnostic output: Quiet, Normal, Verbose 00040 * 5. restructured Node model for better XML support 00041 * 00042 * Revision 1.4 1999/12/03 17:03:24 porter 00043 * added multi-row support for the Xml reader & writer 00044 * 00045 * Revision 1.3 1999/09/30 02:06:12 porter 00046 * add StDbTime to better handle timestamps, modify SQL content (mysqlAccessor) 00047 * allow multiple rows (StDbTable), & Added the comment sections at top of 00048 * each header and src file 00049 * 00050 **************************************************************************/ 00051 #ifndef STDBXMLWRITER_HH 00052 #define STDBXMLWRITER_HH 00053 00054 #include <stdlib.h> 00055 #include <string.h> 00056 #include "tableAcceptor.hh" 00057 #include "stdb_streams.h" 00058 00059 class StString; 00060 class StDbTable; 00061 00062 class StDbFastSqlWriter : public tableAcceptor { 00063 00064 protected: 00065 00066 StString* os; 00067 00068 public: 00069 00070 StDbFastSqlWriter(): os(0) {}; 00071 StDbFastSqlWriter(StString& ofs){ os=&ofs;}; 00072 virtual ~StDbFastSqlWriter(){}; 00073 00074 virtual void streamHeader(const char* name) {/* no-op */ }; 00075 virtual void streamTableName(const char* name){/* no-op */ }; 00076 virtual void streamEndTableName(){/* no-op */ }; 00077 virtual void streamAccessor(){/* no-op */ }; 00078 virtual void endAccessor(){/* no-op */ }; 00079 virtual void streamRow(int row){/* no-op */ }; 00080 virtual void streamEndRow(){/* no-op */ }; 00081 virtual void streamTail(){/* no-op */ }; 00082 virtual void ioTable(StDbTable* table); 00083 00084 virtual void pass(char* name, short& i, int& len) ; 00085 virtual void pass(char* name, int& i, int& len); 00086 virtual void pass(char* name, long& i, int& len); 00087 virtual void pass(char* name, unsigned short& i, int& len) ; 00088 virtual void pass(char* name, unsigned int& i, int& len) ; 00089 virtual void pass(char* name, unsigned long& i, int& len) ; 00090 virtual void pass(char* name, long long& i, int& len) ; 00091 00092 virtual void pass(char* name, float& i, int& len); 00093 virtual void pass(char* name, double& i, int& len); 00094 virtual void pass(char* name, char*& i, int& len); 00095 virtual void pass(char* name, unsigned char& i, int& len) ; 00096 virtual void pass(char* name, unsigned char*& i, int& len) ; 00097 virtual void pass(char* name, short*& i, int& len) ; 00098 virtual void pass(char* name, int*& i, int& len); 00099 virtual void pass(char* name, long*& i, int& len); 00100 virtual void pass(char* name, unsigned short*& i, int& len) ; 00101 virtual void pass(char* name, unsigned int*& i, int& len) ; 00102 virtual void pass(char* name, unsigned long*& i, int& len) ; 00103 virtual void pass(char* name, long long*& i, int& len) ; 00104 virtual void pass(char* name, float*& i, int& len); 00105 virtual void pass(char* name, double*& i, int& len); 00106 00107 //ClassDef(StDbFastSqlWriter,1) 00108 00109 }; 00110 00111 inline void StDbFastSqlWriter::pass(char* name, short& i, int& len){ *os<<","<<i; }; 00112 inline void StDbFastSqlWriter::pass(char* name, int& i, int& len){ *os<<","<<i; }; 00113 inline void StDbFastSqlWriter::pass(char* name, long& i, int& len){ *os<<","<<i; }; 00114 inline void StDbFastSqlWriter::pass(char* name, long long& i, int& len){ *os<<","<<i; }; 00115 inline void StDbFastSqlWriter::pass(char* name, unsigned short& i, int& len){ *os<<","<<i; }; 00116 inline void StDbFastSqlWriter::pass(char* name, unsigned char& i, int& len){ *os<<(int)i; }; 00117 inline void StDbFastSqlWriter::pass(char* name, unsigned int& i, int& len){ *os<<","<<i; }; 00118 inline void StDbFastSqlWriter::pass(char* name, unsigned long& i, int& len){ *os<<","<<i; }; 00119 //inline void StDbFastSqlWriter::pass(char* name, unsigned long long& i, int& len){ *os<<","<<i; }; 00120 inline void StDbFastSqlWriter::pass(char* name, float& i, int& len){ *os<<","<<i; }; 00121 inline void StDbFastSqlWriter::pass(char* name, double& i, int& len){ *os<<","<<i; }; 00122 inline void StDbFastSqlWriter::pass(char* name, char*& i, int& len){ 00123 *os<<",'"<<i<<"'"; }; 00124 00125 00126 00127 #endif 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137

Generated on Thu Aug 24 14:45:26 2006 for Doxygen by doxygen 1.3.7