Changeset

5734:49f1fed6e25e

mod_storage_sql2: Keep available store types in a table
author Kim Alvefur <zash@zash.se>
date Wed, 10 Jul 2013 13:18:10 +0200
parents 5733:aeeced7b0149
children 5735:24f4e73645fe
files plugins/mod_storage_sql2.lua
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql2.lua	Wed Jul 10 12:08:44 2013 +0200
+++ b/plugins/mod_storage_sql2.lua	Wed Jul 10 13:18:10 2013 +0200
@@ -217,11 +217,16 @@
 	return iterator(result);
 end
 
+local stores = {
+	keyval = keyval_store;
+};
+
 local driver = {};
 
 function driver:open(store, typ)
-	if not typ then -- default key-value store
-		return setmetatable({ store = store }, keyval_store);
+	local store_mt = stores[typ or "keyval"];
+	if store_mt then
+		return setmetatable({ store = store }, store_mt);
 	end
 	return nil, "unsupported-store";
 end