OpenASIP 2.2
Loading...
Searching...
No Matches
SQLiteQueryResult.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file SQLiteQueryResult.hh
26 *
27 * Class definition of SQLiteQueryResult class.
28 *
29 * @author Pekka Jääskeläinen 2004 (pekka.jaaskelainen-no.spam-tut.fi)
30 *
31 * @note rating: red
32 */
33
34#ifndef TTA_SQLITE_QUERY_RESULT_HH
35#define TTA_SQLITE_QUERY_RESULT_HH
36
37#include <vector>
38#include <string>
39#include <cstddef>
40#include "sqlite3.h"
41
42#include "SQLiteConnection.hh"
44#include "DataObject.hh"
45
46/**
47 * Implementation of RelationalDBQueryResult interface for SQLite.
48 *
49 */
51public:
53 sqlite3_stmt* statement,
54 SQLiteConnection* connection,
55 bool init = true);
56 virtual ~SQLiteQueryResult();
57
58 virtual int columns() const;
59 virtual std::string columnName(std::size_t columnIndex) const;
60 virtual const DataObject& data(std::size_t columnIndex) const;
61 virtual const DataObject& data(const std::string& name) const;
62 virtual bool hasNext();
63 virtual bool next();
64 virtual void bindInt(unsigned int position, int value);
65 virtual void bindString(unsigned int position, const std::string& value);
66 virtual void reset();
67
68private:
69 /// the compiled SQLite statement handle
70 sqlite3_stmt* statement_;
71 /// sqlite connection handle
73 /// column names
74 std::vector<std::string> columnNames_;
75 /// data of the current row
76 std::vector<DataObject> currentData_;
77 /// data of the next row
78 std::vector<DataObject> nextData_;
79 /// has next() been called for this query
81};
82
83#endif
virtual const DataObject & data(std::size_t columnIndex) const
std::vector< std::string > columnNames_
column names
sqlite3_stmt * statement_
the compiled SQLite statement handle
virtual void bindString(unsigned int position, const std::string &value)
virtual std::string columnName(std::size_t columnIndex) const
bool dataInitialized_
has next() been called for this query
virtual int columns() const
virtual void bindInt(unsigned int position, int value)
std::vector< DataObject > nextData_
data of the next row
SQLiteConnection * connection_
sqlite connection handle
std::vector< DataObject > currentData_
data of the current row