diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-04 15:04:09 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-04 15:04:09 +0200 |
commit | c209ed36b6aaaa992df8976789c8ba8112f8e5c5 (patch) | |
tree | 750f886c59728842787e58441d39439819050c27 /tex/context/base/mkiv/util-sql.lua | |
parent | 1ee48eeafd4e46712a29c91ad704b882f00d765f (diff) | |
download | context-c209ed36b6aaaa992df8976789c8ba8112f8e5c5.tar.gz |
2016-09-04 13:51:00
Diffstat (limited to 'tex/context/base/mkiv/util-sql.lua')
-rw-r--r-- | tex/context/base/mkiv/util-sql.lua | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/util-sql.lua b/tex/context/base/mkiv/util-sql.lua index 023c7809a..a0578f086 100644 --- a/tex/context/base/mkiv/util-sql.lua +++ b/tex/context/base/mkiv/util-sql.lua @@ -311,15 +311,30 @@ sql.setserver("mysql") -- helper: +local sqlmethods = sql.methods + function sql.usedatabase(presets,datatable) local name = datatable or presets.datatable if name then - local method = presets.method and sql.methods[presets.method] or sql.methods.client + local usedmethod = presets.method + local method = usedmethod and sqlmethods[usedmethod] + if not method then + usedmethod = currentmethod + method = usedmethod and sqlmethods[usedmethod] + end + if not method then + usedmethod = sql.methods.client + method = usedmethod and sqlmethods[usedmethod] + end local base = presets.database or "test" local basename = format("`%s`.`%s`",base,name) local execute = nil local m_execute = method.execute - if method.usesfiles then + if not m_execute then + execute = function() + report_state("no valid execute handler") + end + elseif method.usesfiles then local queryfile = presets.queryfile or format("%s-temp.sql",name) local resultfile = presets.resultfile or format("%s-temp.dat",name) execute = function(specification) -- variables template @@ -347,6 +362,7 @@ function sql.usedatabase(presets,datatable) end end return { + usedmethod = usedmethod, presets = preset, base = base, name = name, |