summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/util-sql.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-06-19 15:50:29 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-06-19 15:50:29 +0200
commitd11a1200ed28c6e0058990a621d7404f821ac7fd (patch)
treea433002a97225266abf1f925beb0ed699dbee41c /tex/context/base/mkiv/util-sql.lua
parent008292817580eba8a0f0cf83d8e2d08df8fc8c3f (diff)
downloadcontext-d11a1200ed28c6e0058990a621d7404f821ac7fd.tar.gz
2017-06-19 15:35:00
Diffstat (limited to 'tex/context/base/mkiv/util-sql.lua')
-rw-r--r--tex/context/base/mkiv/util-sql.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/util-sql.lua b/tex/context/base/mkiv/util-sql.lua
index 0eff25130..d01a2267c 100644
--- a/tex/context/base/mkiv/util-sql.lua
+++ b/tex/context/base/mkiv/util-sql.lua
@@ -110,10 +110,14 @@ local defaults = { __index =
}
setmetatableindex(sql.methods,function(t,k)
- report_state("start loading method %a",k)
- require("util-sql-imp-"..k)
- report_state("loading method %a done",k)
- return rawget(t,k)
+ if type(k) == "string" then
+ report_state("start loading method %a",k)
+ require("util-sql-imp-"..k)
+ report_state("loading method %a done",k)
+ return rawget(t,k)
+ else
+ report_state("invalid method %a",tostring(k))
+ end
end)
-- converters
@@ -332,6 +336,10 @@ function sql.usedatabase(presets,datatable)
if not method then
usedmethod = sql.methods.client
method = usedmethod and sqlmethods[usedmethod]
+ if not method then
+ report_state("invalid method")
+ return
+ end
end
local base = presets.database or "test"
local basename = format("`%s`.`%s`",base,name)