fintp_udal
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DataCommand.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 DATACOMMAND_H
22 #define DATACOMMAND_H
23 
24 #include "DllMainUdal.h"
25 #include "CacheManager.h"
26 #include "DataParameter.h"
27 #include "DataColumn.h"
28 
29 namespace FinTP
30 {
37  {
38  public :
39 
43  typedef enum
44  {
48  SP,
53 
58  CURSOR
59 
60  } COMMAND_TYPE;
61 
62  typedef enum
63  {
66 
68  NONQUERY
69  } QUERY_TYPE;
70 
76  static string ToString( COMMAND_TYPE type );
77 
78  public:
79 
80  DataCommand();
81 
90  DataCommand( const DataCommand::COMMAND_TYPE commandType, const DataCommand::QUERY_TYPE queryType,
91  const string& statementString, const bool cacheable = false, const string& modStatementString = "" );
92  DataCommand( const DataCommand& source );
93 
99  DataCommand& operator=( const DataCommand& source );
100 
104  ~DataCommand();
105 
106  private :
107 
110 
118 
121 
125  CacheManager< unsigned int, DataColumnBase > m_ResultColumns;
126 
127  public :
132  return m_CommandType;
133  }
134 
138  void setCommandType( const DataCommand::COMMAND_TYPE commandType ) {
139  m_CommandType = commandType;
140  }
141 
146  return m_QueryType;
147  }
151  bool isQuery() const {
152  return ( m_QueryType == DataCommand::QUERY );
153  }
154 
158  void setQueryType( const DataCommand::QUERY_TYPE queryType ) {
159  m_QueryType = queryType;
160  }
161 
165  string getModifiedStatementString() const {
166  return m_ModifiedStatementString;
167  }
168 
172  void setModifiedStatementString( const string& modStatementString ) {
173  m_ModifiedStatementString = modStatementString;
174  }
175 
179  string getStatementString() const {
180  return m_StatementString;
181  }
182 
186  bool isCacheable() const {
187  return m_Cacheable;
188  }
189 
193  void setCacheable( const bool cacheable ) {
194  m_Cacheable = cacheable;
195  }
196 
202  const DataColumnBase& getResultColumn( unsigned int index ) const {
203  return m_ResultColumns[ index ];
204  }
205 
209  unsigned int getResultColumnCount() const {
210  return m_ResultColumns.size();
211  }
212 
218  void addResultColumn( const unsigned int index, const DataColumnBase* column )
219  {
220  m_ResultColumns.Add( index, DataColumnBase( column->getDimension(), column->getScale(), column->getName(), column->getType(), column->getBaseType() ) );
221  }
222  };
223 }
224 
225 #endif // DATACOMMAND_H