OpenASIP 2.2
Loading...
Searching...
No Matches
SQLiteConnection.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2014 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 SQLiteConnection.hh
26 *
27 * Class definition of SQLiteConnection 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_CONNECTION_HH
35#define TTA_SQLITE_CONNECTION_HH
36
37#include <string>
38#include "sqlite3.h"
39
40#include "FileSystem.hh"
42#include "Exception.hh"
43
44/**
45 * Implementation of RelationalDBConnection interface for SQLite library.
46 */
48public:
49 SQLiteConnection(sqlite3* connection);
50 virtual ~SQLiteConnection();
51
52 virtual int updateQuery(const std::string& queryString);
53 virtual void DDLQuery(const std::string& queryString);
55 const std::string& queryString, bool init = true);
56
57 virtual void beginTransaction();
58 virtual void rollback();
59 virtual void commit();
60
61 virtual RowID lastInsertRowID();
62
63 virtual bool tableExistsInDB(const std::string& tableName);
64
65 virtual int rowCountInTable(const std::string& tableName);
66
67 void throwIfSQLiteError(int result);
68
69 void finalizeQuery(sqlite3_stmt* statement);
70
71 virtual int version();
72 virtual void updateVersion(int version);
73
74private:
75 sqlite3_stmt* compileQuery(const std::string& queryString);
76
77 /// SQLite connection handle is saved to this
78 sqlite3* connection_;
79
81};
82
83#endif
84
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
virtual bool tableExistsInDB(const std::string &tableName)
virtual void commit()
virtual RowID lastInsertRowID()
virtual void rollback()
virtual ~SQLiteConnection()
void finalizeQuery(sqlite3_stmt *statement)
sqlite3_stmt * compileQuery(const std::string &queryString)
sqlite3 * connection_
SQLite connection handle is saved to this.
virtual void DDLQuery(const std::string &queryString)
void throwIfSQLiteError(int result)
virtual void beginTransaction()
virtual int rowCountInTable(const std::string &tableName)
virtual int updateQuery(const std::string &queryString)
virtual int version()
virtual void updateVersion(int version)
virtual RelationalDBQueryResult * query(const std::string &queryString, bool init=true)