OdbcStore.h
Go to the documentation of this file.
1/* -*- C++ -*- */
2
3/****************************************************************************
4** Copyright (c) 2001-2014
5**
6** This file is part of the QuickFIX FIX Engine
7**
8** This file may be distributed under the terms of the quickfixengine.org
9** license as defined by quickfixengine.org and appearing in the file
10** LICENSE included in the packaging of this file.
11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14**
15** See http://www.quickfixengine.org/LICENSE for licensing information.
16**
17** Contact ask@quickfixengine.org if any conditions of this licensing are
18** not clear to you.
19**
20****************************************************************************/
21
22#ifndef HAVE_ODBC
23#error OdbcStore.h included, but HAVE_ODBC not defined
24#endif
25
26#ifdef HAVE_ODBC
27#ifndef FIX_ODBCSTORE_H
28#define FIX_ODBCSTORE_H
29
30#ifdef _MSC_VER
31#pragma warning( disable : 4503 4355 4786 4290 )
32#endif
33
34#include "OdbcConnection.h"
35#include "MessageStore.h"
36#include "SessionSettings.h"
37#include <fstream>
38#include <string>
39
40namespace FIX
41{
43class OdbcStoreFactory : public MessageStoreFactory
44{
45public:
46 static const std::string DEFAULT_USER;
47 static const std::string DEFAULT_PASSWORD;
48 static const std::string DEFAULT_CONNECTION_STRING;
49
50 OdbcStoreFactory( const SessionSettings& settings )
51: m_settings( settings ), m_useSettings( true ), m_useDictionary( false ) {}
52
53 OdbcStoreFactory( const Dictionary& dictionary )
54: m_dictionary( dictionary ), m_useSettings( false ), m_useDictionary( true ) {}
55
56 OdbcStoreFactory( const std::string& user, const std::string& password,
57 const std::string& connectionString )
58: m_user( user ), m_password( password ), m_connectionString( connectionString ),
59 m_useSettings( false ), m_useDictionary( false ) {}
60
61 OdbcStoreFactory()
62: m_user( DEFAULT_USER ), m_password( DEFAULT_PASSWORD ),
63 m_connectionString( DEFAULT_CONNECTION_STRING ), m_useSettings( false ), m_useDictionary( false ) {}
64
65 MessageStore* create( const SessionID& );
66 void destroy( MessageStore* );
67private:
68 MessageStore* create( const SessionID& s, const Dictionary& );
69
70 Dictionary m_dictionary;
71 SessionSettings m_settings;
72 std::string m_user;
73 std::string m_password;
74 std::string m_connectionString;
75 bool m_useSettings;
76 bool m_useDictionary;
77};
81class OdbcStore : public MessageStore
82{
83public:
84 OdbcStore( const SessionID& s, const std::string& user, const std::string& password,
85 const std::string& connectionString );
86 ~OdbcStore();
87
88 bool set( int, const std::string& ) throw ( IOException );
89 void get( int, int, std::vector < std::string > & ) const throw ( IOException );
90
91 int getNextSenderMsgSeqNum() const throw ( IOException );
92 int getNextTargetMsgSeqNum() const throw ( IOException );
93 void setNextSenderMsgSeqNum( int value ) throw ( IOException );
94 void setNextTargetMsgSeqNum( int value ) throw ( IOException );
95 void incrNextSenderMsgSeqNum() throw ( IOException );
96 void incrNextTargetMsgSeqNum() throw ( IOException );
97
98 UtcTimeStamp getCreationTime() const throw ( IOException );
99
100 void reset() throw ( IOException );
101 void refresh() throw ( IOException );
102
103private:
104 void populateCache();
105
106 OdbcConnection* m_pConnection;
107 MemoryStore m_cache;
108 SessionID m_sessionID;
109};
110}
111
112#endif
113#endif

Generated on Mon Mar 4 2024 21:10:02 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001