Mercurial > hg > orthanc
comparison OrthancServer/DatabaseWrapper.cpp @ 206:4453a010d0db
flush to disk thread
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Nov 2012 12:03:18 +0100 |
parents | 6ab754744446 |
children | 0200cd330582 |
comparison
equal
deleted
inserted
replaced
205:6ab754744446 | 206:4453a010d0db |
---|---|
128 }; | 128 }; |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 | 132 |
133 void DatabaseWrapper::SetGlobalProperty(const std::string& name, | 133 void DatabaseWrapper::SetGlobalProperty(GlobalProperty property, |
134 const std::string& value) | 134 const std::string& value) |
135 { | 135 { |
136 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT OR REPLACE INTO GlobalProperties VALUES(?, ?)"); | 136 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT OR REPLACE INTO GlobalProperties VALUES(?, ?)"); |
137 s.BindString(0, name); | 137 s.BindInt(0, property); |
138 s.BindString(1, value); | 138 s.BindString(1, value); |
139 s.Run(); | 139 s.Run(); |
140 } | 140 } |
141 | 141 |
142 bool DatabaseWrapper::LookupGlobalProperty(std::string& target, | 142 bool DatabaseWrapper::LookupGlobalProperty(std::string& target, |
143 const std::string& name) | 143 GlobalProperty property) |
144 { | 144 { |
145 SQLite::Statement s(db_, SQLITE_FROM_HERE, | 145 SQLite::Statement s(db_, SQLITE_FROM_HERE, |
146 "SELECT value FROM GlobalProperties WHERE name=?"); | 146 "SELECT value FROM GlobalProperties WHERE property=?"); |
147 s.BindString(0, name); | 147 s.BindInt(0, property); |
148 | 148 |
149 if (!s.Step()) | 149 if (!s.Step()) |
150 { | 150 { |
151 return false; | 151 return false; |
152 } | 152 } |
155 target = s.ColumnString(0); | 155 target = s.ColumnString(0); |
156 return true; | 156 return true; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 std::string DatabaseWrapper::GetGlobalProperty(const std::string& name, | 160 std::string DatabaseWrapper::GetGlobalProperty(GlobalProperty property, |
161 const std::string& defaultValue) | 161 const std::string& defaultValue) |
162 { | 162 { |
163 std::string s; | 163 std::string s; |
164 if (LookupGlobalProperty(s, name)) | 164 if (LookupGlobalProperty(s, property)) |
165 { | 165 { |
166 return s; | 166 return s; |
167 } | 167 } |
168 else | 168 else |
169 { | 169 { |