|
|
|
@@ -242,52 +242,24 @@ class example_rp_t : public opkele::prequeue_RP { |
242 | have_eqtop = false; |
242 | have_eqtop = false; |
243 | sqlite3_mem_t<char*> S = sqlite3_mprintf( |
243 | sqlite3_mem_t<char*> S = sqlite3_mprintf( |
244 | "DELETE FROM endpoints_queue" |
244 | "DELETE FROM endpoints_queue" |
245 | " WHERE as_id=%ld AND eq_uri=%Q AND eq_local_id=%Q", |
245 | " WHERE as_id=%ld AND eq_uri=%Q AND eq_local_id=%Q", |
246 | htc.get_value().c_str(),as_id, |
246 | htc.get_value().c_str(),as_id, |
247 | eqtop.uri.c_str()); |
247 | eqtop.uri.c_str()); |
248 | db.exec(S); |
248 | db.exec(S); |
249 | } |
249 | } |
250 | |
250 | |
251 | mutable string _cid; |
251 | mutable string _cid; |
252 | mutable string _nid; |
252 | mutable string _nid; |
253 | |
253 | |
254 | void set_claimed_id(const string& cid) { |
| |
255 | assert(as_id>=0); |
| |
256 | sqlite3_mem_t<char*> S = sqlite3_mprintf( |
| |
257 | "UPDATE auth_sessions" |
| |
258 | " SET as_claimed_id=%Q" |
| |
259 | " WHERE hts_id=%Q and as_id=%ld", |
| |
260 | cid.c_str(), |
| |
261 | htc.get_value().c_str(),as_id); |
| |
262 | db.exec(S); |
| |
263 | _cid = cid; |
| |
264 | } |
| |
265 | const string get_claimed_id() const { |
| |
266 | assert(as_id>=0); |
| |
267 | if(_cid.empty()) { |
| |
268 | sqlite3_mem_t<char*> S = sqlite3_mprintf( |
| |
269 | "SELECT as_claimed_id" |
| |
270 | " FROM" |
| |
271 | " auth_sessions" |
| |
272 | " WHERE" |
| |
273 | " hts_id=%Q AND as_id=%ld", |
| |
274 | htc.get_value().c_str(),as_id); |
| |
275 | sqlite3_table_t T; int nr,nc; |
| |
276 | db.get_table(S,T,&nr,&nc); |
| |
277 | assert(nr==1); assert(nc==1); |
| |
278 | _cid = T.get(1,0,nc); |
| |
279 | } |
| |
280 | return _cid; |
| |
281 | } |
| |
282 | void set_normalized_id(const string& nid) { |
254 | void set_normalized_id(const string& nid) { |
283 | assert(as_id>=0); |
255 | assert(as_id>=0); |
284 | sqlite3_mem_t<char*> S = sqlite3_mprintf( |
256 | sqlite3_mem_t<char*> S = sqlite3_mprintf( |
285 | "UPDATE auth_sessions" |
257 | "UPDATE auth_sessions" |
286 | " SET as_normalized_id=%Q" |
258 | " SET as_normalized_id=%Q" |
287 | " WHERE hts_id=%Q and as_id=%ld", |
259 | " WHERE hts_id=%Q and as_id=%ld", |
288 | nid.c_str(), |
260 | nid.c_str(), |
289 | htc.get_value().c_str(),as_id); |
261 | htc.get_value().c_str(),as_id); |
290 | db.exec(S); |
262 | db.exec(S); |
291 | _nid = nid; |
263 | _nid = nid; |
292 | } |
264 | } |
293 | const string get_normalized_id() const { |
265 | const string get_normalized_id() const { |
|