Luiza  v03-01
SociSelect.h
1 // -*- mode: c++; mode: auto-fill; mode: flyspell-prog; -*-
2 
3 #ifndef SociSelect_h
4 #define SociSelect_h 1
5 
6 #include "soci.h"
7 #include "postgresql/soci-postgresql.h"
8 
9 #include "luiza/DataSourceProcessor.h"
10 
11 
12 using namespace gloria;
13 
14 namespace luiza {
15 
16 
18 
76 
77  public:
78 
79  virtual SociSelect* newProcessor();
80 
81 
82  SociSelect() ;
83 
87  virtual void init() ;
88 
90 
92  virtual void startAnalysis( GloriaDataContainer* data ) ;
93 
96  virtual void processData( GloriaDataContainer* data ) ;
97 
98 
99  virtual void check( GloriaDataContainer* data ) ;
100 
101 
103 
104  virtual void concludeAnalysis( GloriaDataContainer* data ) ;
105 
108  virtual void end() ;
109 
110 
111  protected:
112 
114  std::vector< std::string > _connectString;
115 
117  std::string _connection;
118 
120  std::vector< std::string > _selectString ;
121 
123  std::string _select;
124 
127 
128 
130  std::string _indexCollection ;
131 
133  std::string _indexColumn ;
134 
137 
138 
140  std::string _tableCollectionName ;
141 
144 
145 
147  int _nLoops ;
148 
150  int _nTables ;
151 
153  int _nSQL ;
154 
155 
156  void printEndMessage() const ;
157 
160 
162  std::vector<soci::data_type> _sqlTypes;
163 
165  std::vector<std::string> _sqlNames;
166 
168  soci::session *_sociSession;
169 
171  soci::statement *_sociStatement;
172 
174  soci::row *_sociRow;
175 
177  bool _useIndex;
178 
181 
183  int _sqlRow;
184  } ;
185 
186  } // end namespace luiza
187 #endif
bool _permanentCollection
Flag for collections, which should not be deleted after loop is finished.
Definition: SociSelect.h:143
int _sqlRow
Row counter.
Definition: SociSelect.h:183
Processor for reading tables from SQL database with SOCI library.
Definition: SociSelect.h:75
bool _useIndex
Flag for using indexes in query.
Definition: SociSelect.h:177
std::string _indexColumn
Name of the index table column containing select parameter.
Definition: SociSelect.h:133
namespace for data storing and exchange formats
Definition: GloriaAstrometry.h:15
std::string _indexCollection
Name of the table collection containing index table.
Definition: SociSelect.h:130
soci::statement * _sociStatement
SOCI query statement pointer.
Definition: SociSelect.h:171
int _nTables
Table counter.
Definition: SociSelect.h:150
int _indexRow
Index counter.
Definition: SociSelect.h:180
int _rowsPerLoop
Number of tables to be read per processing loop (0 for all)
Definition: SociSelect.h:126
Class for storing all data processed in Luiza.
Definition: GloriaDataContainer.h:82
std::string _connection
Connection parameters merged to single string.
Definition: SociSelect.h:117
Base class for processors accessing input data.
Definition: DataSourceProcessor.h:19
std::vector< std::string > _sqlNames
Names of SQL output columns.
Definition: SociSelect.h:165
soci::session * _sociSession
SOCI session pointer.
Definition: SociSelect.h:168
Class for reading and processing fits tables in Luiza.
Definition: GloriaFitsTable.h:109
std::vector< std::string > _selectString
Select statement to be executed as SQL query.
Definition: SociSelect.h:120
GloriaFitsTable * _outputTemplate
Table template created from SQL output.
Definition: SociSelect.h:159
Namespace for Luiza framework.
Definition: CCCollection.h:6
std::string _tableCollectionName
Name of the table collection to which SQL tables should be stored.
Definition: SociSelect.h:140
std::vector< soci::data_type > _sqlTypes
Data types of SQL output columns.
Definition: SociSelect.h:162
int _indexesPerLoop
Number of indexes to be used per processing loop (0 for all)
Definition: SociSelect.h:136
int _nSQL
SQL query counter.
Definition: SociSelect.h:153
std::vector< std::string > _connectString
Connection parameters, as required for SOCI session opening.
Definition: SociSelect.h:114
soci::row * _sociRow
SOCI query output row.
Definition: SociSelect.h:174
int _nLoops
Loop counter.
Definition: SociSelect.h:147
std::string _select
Select statement merged to single string.
Definition: SociSelect.h:123