All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DBSqLite.h
Go to the documentation of this file.
1 /*
2  * DBSqLite.h
3  *
4  * This file is part of the HausmiSEP project
5  *
6  * Copyright (C) 2012, 2013 Marco Alvarado (malvcr@gmail.com)
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __DBSqLite_H
23 #define __DBSqLite_H
24 
25 #include <HSEPData/DBBase.h>
26 #include <HSEPData/ErrorCode.h>
27 
28 using namespace HSEPData;
29 
41 namespace HSEPDataSqLite {
42 
46  class SqLiteResultSet : public DBResultSet {
47  void* aResultSet;
48  public:
50  virtual ~SqLiteResultSet();
51  virtual int forEach(CycleBase& pCycle);
52  virtual int forEach(ExecuteFunctionType pFunction);
53 
54  string getString(string& pNameRef);
55  string getString(int pPosition);
56 
57  size_t size();
58 
59  bool isLast();
60 
61  void getMetadata(DBMetadata& pMetadataRef);
62 
63  friend class SqLiteStatement;
64  }; // SqLiteResultSet class
65 
69  class SqLiteStatement : public DBStatement {
70 
71  void* aStatement;
73  bool createIt(void* pConnection,string& pQueryRef);
74  protected:
75  DBResultSet* executeQueryPtr();
76  DBResultSet* executeQueryPtr(DBParameters& pParametersRef);
77  public:
79  virtual ~SqLiteStatement();
80  friend class SqLiteEnvironment;
81 
82  }; // SqLiteStatement
83 
88  void* aConnection;
89  bool aOpened;
90  public:
93 
94  ErrorCode connect(string& pConnectionStringRef,string& pUserRef,string& pPasswordRef);
95  ErrorCode setSchema(string& pNewSchemaRef);
96  DBStatement* createStatementPtr(string& pQueryRef);
97 
98  }; // SqLiteEnvironment class
99 
100 } // HSEPDataSqLite namespace
101 
102 #endif // __DBSqLite_H