Comparison

plugins/mod_storage_sql.lua @ 6283:7cf6d3a2c855

mod_storage_{none,internal,sql}: Return error for unsupported (everything but keyval) store types
author Kim Alvefur <zash@zash.se>
date Fri, 20 Jun 2014 16:22:23 +0200
parent 6165:6a184b16b717
child 6951:99de8f30d99e
comparison
equal deleted inserted replaced
6282:bce801e40484 6283:7cf6d3a2c855
378 end 378 end
379 379
380 local driver = {}; 380 local driver = {};
381 381
382 function driver:open(store, typ) 382 function driver:open(store, typ)
383 if not typ then -- default key-value store 383 if typ and typ ~= "keyval" then
384 return setmetatable({ store = store }, keyval_store); 384 return nil, "unsupported-store";
385 end 385 end
386 return nil, "unsupported-store"; 386 return setmetatable({ store = store }, keyval_store);
387 end 387 end
388 388
389 function driver:stores(username) 389 function driver:stores(username)
390 local sql = "SELECT DISTINCT `store` FROM `prosody` WHERE `host`=? AND `user`" .. 390 local sql = "SELECT DISTINCT `store` FROM `prosody` WHERE `host`=? AND `user`" ..
391 (username == true and "!=?" or "=?"); 391 (username == true and "!=?" or "=?");