AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
postgresqlResultSet.hpp
1 /*
2  ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3  Copyright (C) 2012 Vincent Lachenal
4 
5  This file is part of ANCH Framework.
6 
7  ANCH Framework is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  ANCH Framework is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifdef ANCH_SQL_POSTGRESQL
21 #ifndef _ANCH_SQL_PG_RESULT_SET_H_
22 #define _ANCH_SQL_PG_RESULT_SET_H_
23 
24 #include "sql/resultSet.hpp"
25 
26 #include "libpq-fe.h"
27 
28 
29 namespace anch {
30  namespace sql {
31 
42 
43  // Attributes +
44  private:
46  PGconn* _conn;
47 
49  PGresult* _result;
50 
52  int _currentRow;
53 
55  int _nbRows;
56 
58  int _nbFields;
59  // Attributes -
60 
61  // Constructors +
62  public:
68  PostgreSQLResultSet(PGconn* conn);
69  // Constructors -
70 
71  // Destructor +
72  public:
76  virtual ~PostgreSQLResultSet();
77  // Destructor -
78 
79  // Methods +
80  public:
88  virtual bool next() throw(SqlException);
89 
90  protected:
99  virtual bool getValue(std::size_t idx, std::string& out) throw(SqlException);
100  // Methods -
101 
102  };
103 
104  }
105 }
106 
107 #endif // _ANCH_SQL_PG_RESULT_SET_H_
108 #endif // ANCH_SQL_POSTGRESQL
PostgreSQL result set implementation.
Definition: postgresqlResultSet.hpp:41
virtual bool next()
Definition: postgresqlResultSet.cpp:68
PostgreSQLResultSet(PGconn *conn)
Definition: postgresqlResultSet.cpp:29
virtual bool getValue(std::size_t idx, std::string &out)
Definition: postgresqlResultSet.cpp:53
SQL exception.
Definition: sqlException.hpp:39
SQL result representation.
Definition: resultSet.hpp:44
AnCH framework base namespace.
Definition: base64.hpp:28
virtual ~PostgreSQLResultSet()
Definition: postgresqlResultSet.cpp:41