annotate Core/SQLite/Connection.cpp @ 0:3959d33612cc

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Jul 2012 14:32:22 +0200
parents
children db4d996ea264
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Palantir - A Lightweight, RESTful DICOM Store
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 #include "Connection.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #include <memory>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include <cassert>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include <sqlite3.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include <string.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace Palantir
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 namespace SQLite
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 Connection::Connection() :
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 db_(NULL),
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 transactionNesting_(0),
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 needsRollback_(false)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 Connection::~Connection()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 Close();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 void Connection::CheckIsOpen() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 if (!db_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 throw PalantirException("SQLite: The database is not opened");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 void Connection::Open(const std::string& path)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 if (db_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 throw PalantirException("SQLite: Connection is already open");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 int err = sqlite3_open(path.c_str(), &db_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 if (err != SQLITE_OK)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 Close();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 db_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 throw PalantirException("SQLite: Unable to open the database");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 // Execute PRAGMAs at this point
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 // http://www.sqlite.org/pragma.html
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 Execute("PRAGMA FOREIGN_KEYS=ON;");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 // Performance tuning
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 Execute("PRAGMA SYNCHRONOUS=NORMAL;");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 Execute("PRAGMA JOURNAL_MODE=WAL;");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 Execute("PRAGMA LOCKING_MODE=EXCLUSIVE;");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 Execute("PRAGMA WAL_AUTOCHECKPOINT=1000;");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 //Execute("PRAGMA TEMP_STORE=memory");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 void Connection::OpenInMemory()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 Open(":memory:");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 void Connection::Close()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 ClearCache();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 if (db_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 sqlite3_close(db_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 db_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 void Connection::ClearCache()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 for (CachedStatements::iterator
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 it = cachedStatements_.begin();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 it != cachedStatements_.end(); it++)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 delete it->second;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 cachedStatements_.clear();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 StatementReference& Connection::GetCachedStatement(const StatementId& id,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 const char* sql)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 CachedStatements::iterator i = cachedStatements_.find(id);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 if (i != cachedStatements_.end())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 if (i->second->GetReferenceCount() >= 1)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 throw PalantirException("SQLite: This cached statement is already being referred to");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 return *i->second;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 StatementReference* statement = new StatementReference(db_, sql);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 cachedStatements_[id] = statement;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 return *statement;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 bool Connection::Execute(const char* sql)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 CheckIsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 int error = sqlite3_exec(db_, sql, NULL, NULL, NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 if (error == SQLITE_ERROR)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 throw PalantirException("SQLite Execute error: " + std::string(sqlite3_errmsg(db_)));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 return error == SQLITE_OK;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 int Connection::ExecuteAndReturnErrorCode(const char* sql)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 CheckIsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 return sqlite3_exec(db_, sql, NULL, NULL, NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 // Info querying -------------------------------------------------------------
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 bool Connection::IsSQLValid(const char* sql)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 sqlite3_stmt* stmt = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 if (sqlite3_prepare_v2(db_, sql, -1, &stmt, NULL) != SQLITE_OK)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 return false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 sqlite3_finalize(stmt);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 return true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 bool Connection::DoesTableOrIndexExist(const char* name,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 const char* type) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 // Our SQL is non-mutating, so this cast is OK.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 Statement statement(const_cast<Connection&>(*this),
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 "SELECT name FROM sqlite_master WHERE type=? AND name=?");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 statement.BindString(0, type);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 statement.BindString(1, name);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 return statement.Step(); // Table exists if any row was returned.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 bool Connection::DoesTableExist(const char* table_name) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 return DoesTableOrIndexExist(table_name, "table");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 bool Connection::DoesIndexExist(const char* index_name) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 return DoesTableOrIndexExist(index_name, "index");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 bool Connection::DoesColumnExist(const char* table_name, const char* column_name) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 std::string sql("PRAGMA TABLE_INFO(");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 sql.append(table_name);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 sql.append(")");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 // Our SQL is non-mutating, so this cast is OK.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 Statement statement(const_cast<Connection&>(*this), sql.c_str());
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 while (statement.Step()) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 if (!statement.ColumnString(1).compare(column_name))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 return true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 return false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 int64_t Connection::GetLastInsertRowId() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 return sqlite3_last_insert_rowid(db_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 int Connection::GetLastChangeCount() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 return sqlite3_changes(db_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 int Connection::GetErrorCode() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 return sqlite3_errcode(db_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 int Connection::GetLastErrno() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 int err = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 if (SQLITE_OK != sqlite3_file_control(db_, NULL, SQLITE_LAST_ERRNO, &err))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 return -2;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 return err;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 const char* Connection::GetErrorMessage() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 return sqlite3_errmsg(db_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 bool Connection::BeginTransaction()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 if (needsRollback_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 assert(transactionNesting_ > 0);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 // When we're going to rollback, fail on this begin and don't actually
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 // mark us as entering the nested transaction.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 return false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 bool success = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 if (!transactionNesting_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 needsRollback_ = false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 Statement begin(*this, SQLITE_FROM_HERE, "BEGIN TRANSACTION");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 if (!begin.Run())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 return false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 transactionNesting_++;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 return success;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 void Connection::RollbackTransaction()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 if (!transactionNesting_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 throw PalantirException("Rolling back a nonexistent transaction");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 transactionNesting_--;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 if (transactionNesting_ > 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 // Mark the outermost transaction as needing rollback.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 needsRollback_ = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 return;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 DoRollback();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 bool Connection::CommitTransaction()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 if (!transactionNesting_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 throw PalantirException("Committing a nonexistent transaction");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 transactionNesting_--;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 if (transactionNesting_ > 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 // Mark any nested transactions as failing after we've already got one.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 return !needsRollback_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 if (needsRollback_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 DoRollback();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 return false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 Statement commit(*this, SQLITE_FROM_HERE, "COMMIT");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 return commit.Run();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 void Connection::DoRollback()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 Statement rollback(*this, SQLITE_FROM_HERE, "ROLLBACK");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 rollback.Run();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 needsRollback_ = false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 static void ScalarFunctionCaller(sqlite3_context* rawContext,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 int argc,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 sqlite3_value** argv)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 FunctionContext context(rawContext, argc, argv);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 void* payload = sqlite3_user_data(rawContext);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 assert(payload != NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 IScalarFunction& func = *(IScalarFunction*) payload;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 func.Compute(context);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 static void ScalarFunctionDestroyer(void* payload)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 assert(payload != NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 delete (IScalarFunction*) payload;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 IScalarFunction* Connection::Register(IScalarFunction* func)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 int err = sqlite3_create_function_v2(db_,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 func->GetName(),
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 func->GetCardinality(),
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 SQLITE_UTF8,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 func,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 ScalarFunctionCaller,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 NULL,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 NULL,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 ScalarFunctionDestroyer);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 if (err != SQLITE_OK)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 delete func;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 throw PalantirException("SQLite: Unable to register a function");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 return func;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 }