OpenASIP  2.0
RelationalDBConnection.cc
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 RelationalDBConnection.cc
26  *
27  * Empty implementation of the interface, just to be able to add Doxygen
28  * comments for methods.
29  *
30  * @author Pekka Jääskeläinen 2004 (pekka.jaaskelainen-no.spam-tut.fi)
31  *
32  * @note rating: red
33  */
34 
36 
37 /**
38  * Destructor.
39  */
41 }
42 
43 /**
44  * Performs a query that changes the database (UPDATE/INSERT/DELETE).
45  *
46  * Does not autocommit the changes in case the update is in the middle of
47  * transaction.
48  *
49  * @param queryString The query string.
50  * @return Number of rows affected by the change.
51  * @exception RelationalDBException In case a database error occured.
52  */
53 int
55  return 0;
56 }
57 
58 /**
59  * Performs a SQL Data Definition Language query, that is a query that may
60  * change the structure of the database (CREATE TABLE, etc.).
61  *
62  * Does not autocommit the changes in case the update is in the middle of
63  * transaction.
64  *
65  * @param queryString The query string.
66  * @exception RelationalDBException In case a database error occured.
67  */
68 void
69 RelationalDBConnection::DDLQuery(const std::string&) {}
70 
71 /**
72  * Performs a data retrieval query (SELECT).
73  *
74  * @param queryString The query string.
75  * @return A handle to the query result set. Caller owns the instance. Deleting
76  * the instance should free all resources connected to the query.
77  * @exception RelationalDBException In case a database error occured.
78  */
80 RelationalDBConnection::query(const std::string&, bool /*init*/) {
81  return NULL;
82 }
83 
84 /**
85  * Starts a new database transaction.
86  *
87  * Also ends the possible previous transaction successfully (commit).
88  *
89  * @exception RelationalDBException In case a database error occured.
90  */
91 void
93 
94 /**
95  * Ends the current database transaction unsuccessfully and rollbacks all
96  * the changes the queries in the transaction would have done.
97  *
98  * @exception RelationalDBException In case a database error occured.
99  */
100 void
102 
103 /**
104  * Ends the current database transaction successfully and commits all
105  * the changes in the transaction to the database.
106  *
107  * @exception RelationalDBException In case a database error occured.
108  */
109 void
111 
112 /**
113  * Checks if database has given table by name.
114  *
115  * @param tableName Name of the table
116  * @return True if db has the table. Otherwise false.
117  * @exception RelationalDBException In case a database error occurred or
118  * call was made in the middle of an active
119  * transaction.
120  */
121 bool
123  return false;
124 }
125 
126 /**
127  * Return number of entries in the given table.
128  *
129  * @param tableName Name of the table.
130  * @return Number of entries in table.
131  * @exception RelationalDBException In case a database error occurred,
132  * call was made in the middle of an active transaction or the table does not
133  * exists.
134  */
135 int
137  return false;
138 }
139 
140 /**
141 * Return database version number.
142 *
143 * @return Database version.
144 */
145 int
147  return 0;
148 }
149 
150 /**
151 * Set database version number.
152 *
153 * @param version New database version.
154 */
155 void
157  (void)version;
158 }
RelationalDBConnection::rollback
virtual void rollback()=0
Definition: RelationalDBConnection.cc:101
RelationalDBConnection::updateQuery
virtual int updateQuery(const std::string &queryString)=0
Definition: RelationalDBConnection.cc:54
RelationalDBConnection::commit
virtual void commit()=0
Definition: RelationalDBConnection.cc:110
RelationalDBConnection::~RelationalDBConnection
virtual ~RelationalDBConnection()
Definition: RelationalDBConnection.cc:40
RelationalDBConnection::version
virtual int version()=0
Definition: RelationalDBConnection.cc:146
RelationalDBConnection::updateVersion
virtual void updateVersion(int version)=0
Definition: RelationalDBConnection.cc:156
RelationalDBQueryResult
Definition: RelationalDBQueryResult.hh:46
RelationalDBConnection::query
virtual RelationalDBQueryResult * query(const std::string &queryString, bool init=true)=0
Definition: RelationalDBConnection.cc:80
RelationalDBConnection::beginTransaction
virtual void beginTransaction()=0
Definition: RelationalDBConnection.cc:92
RelationalDBConnection.hh
RelationalDBConnection::rowCountInTable
virtual int rowCountInTable(const std::string &tableName)=0
Definition: RelationalDBConnection.cc:136
RelationalDBConnection::DDLQuery
virtual void DDLQuery(const std::string &queryString)=0
Definition: RelationalDBConnection.cc:69
RelationalDBConnection::tableExistsInDB
virtual bool tableExistsInDB(const std::string &tableName)=0
Definition: RelationalDBConnection.cc:122