OdbcLog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef HAVE_ODBC
00023 #error OdbcLog.h included, but HAVE_ODBC not defined
00024 #endif
00025
00026 #ifdef HAVE_ODBC
00027 #ifndef FIX_ODBCLOG_H
00028 #define FIX_ODBCLOG_H
00029
00030 #ifdef _MSC_VER
00031 #pragma warning( disable : 4503 4355 4786 4290 )
00032 #endif
00033
00034 #include "OdbcConnection.h"
00035 #include "Log.h"
00036 #include "SessionSettings.h"
00037 #include <fstream>
00038 #include <string>
00039
00040 namespace FIX
00041 {
00043 class OdbcLog : public Log
00044 {
00045 public:
00046 OdbcLog( const SessionID& s, const std::string& user, const std::string& password,
00047 const std::string& connectionString );
00048 OdbcLog( const std::string& user, const std::string& password,
00049 const std::string& connectionString );
00050
00051 ~OdbcLog();
00052
00053 void clear();
00054 void backup();
00055 void setIncomingTable( const std::string& incomingTable )
00056 { m_incomingTable = incomingTable; }
00057 void setOutgoingTable( const std::string& outgoingTable )
00058 { m_outgoingTable = outgoingTable; }
00059 void setEventTable( const std::string& eventTable )
00060 { m_eventTable = eventTable; }
00061
00062 void onIncoming( const std::string& value )
00063 { insert( m_incomingTable, value ); }
00064 void onOutgoing( const std::string& value )
00065 { insert( m_outgoingTable, value ); }
00066 void onEvent( const std::string& value )
00067 { insert( m_eventTable, value ); }
00068
00069 private:
00070 void init();
00071 void insert( const std::string& table, const std::string value );
00072
00073 std::string m_incomingTable;
00074 std::string m_outgoingTable;
00075 std::string m_eventTable;
00076 OdbcConnection* m_pConnection;
00077 SessionID* m_pSessionID;
00078 };
00079
00081 class OdbcLogFactory : public LogFactory
00082 {
00083 public:
00084 static const std::string DEFAULT_USER;
00085 static const std::string DEFAULT_PASSWORD;
00086 static const std::string DEFAULT_CONNECTION_STRING;
00087
00088 OdbcLogFactory( const SessionSettings& settings )
00089 : m_settings( settings ), m_useSettings( true ) {}
00090
00091 OdbcLogFactory( const std::string& user, const std::string& password,
00092 const std::string& connectionString );
00093
00094 OdbcLogFactory();
00095
00096 ~OdbcLogFactory();
00097
00098 Log* create();
00099 Log* create( const SessionID& );
00100 void destroy( Log* );
00101 private:
00102 void init( const Dictionary& settings,
00103 std::string& user, std::string& password,
00104 std::string& connectionString );
00105
00106 void initLog( const Dictionary& settings, OdbcLog& log );
00107
00108 SessionSettings m_settings;
00109 std::string m_user;
00110 std::string m_password;
00111 std::string m_connectionString;
00112 bool m_useSettings;
00113 };
00114 }
00115
00116 #endif
00117 #endif