fintp_base
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DbWatcher.h
Go to the documentation of this file.
1 /*
2 * FinTP - Financial Transactions Processing Application
3 * Copyright (C) 2013 Business Information Systems (Allevo) S.R.L.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>
17 * or contact Allevo at : 031281 Bucuresti, 23C Calea Vitan, Romania,
18 * phone +40212554577, office@allevo.ro <mailto:office@allevo.ro>, www.allevo.ro.
19 */
20 
21 #ifndef DBWATCHER_H
22 #define DBWATCHER_H
23 
24 #include <string>
25 #include <pthread.h>
26 
27 #include "DllMain.h"
28 #include "../AbstractWatcher.h"
29 #include "../InstrumentedObject.h"
30 
31 #include "DatabaseProvider.h"
32 #include "ConnectionString.h"
33 
34 using namespace std;
35 
36 namespace FinTP
37 {
39  {
40  public :
41 
43  {
44  ReturnDataSet = 1,
45  ReturnCursorXml = 2
46  };
47 
48  explicit DbWatcher( void ( *callback )( const NotificationObject* ), const bool fullObjectNotif = false );
49  explicit DbWatcher( NotificationPool* notificationPool, const bool fullObjectNotif = false );
50  DbWatcher( NotificationPool* notificationPool, const ConnectionString& connectionString, bool fullObjectNotif = false );
51  ~DbWatcher();
52 
53  //set connection string for the watch table
54  void setConnectionString( const ConnectionString& connectionString );
55  void setFullObjectNotification( const bool newValue ) { m_FullObjectNotif = newValue; }
56 
57  //set/get SP (stored procedure) name associated
58  //where SP = execute query to verify if any records available in the watch table
59  void setSelectSPName( const string& spName );
60  string getSelectSPName() const;
61 
62  //void setMaxUncommitedTrns( const int maxUncommit ) { m_MaxUncommitedTrns = maxUncommit; }
63 
64  void setProvider( const string& provider );
65  DatabaseProvider::PROVIDER_TYPE getProvider() const;
66 
67  void setWatchOptions( int options ) { m_WatchOptions = options; }
68  void setDatabaseToXMLTrimm ( const bool trimmOption ) { m_DatabaseToXmlTrimmOption = trimmOption; }
69 
70  protected :
71 
72  void internalScan();
73 
74  private :
75 
76  //int m_UncommitedTrns, m_MaxUncommitedTrns;
79  string m_SelectSPName;
80  DatabaseProvider::PROVIDER_TYPE m_DatabaseProvider;
81  ConnectionString m_ConnectionString;
83  };
84 }
85 
86 #endif