summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/data/load_dat.lua
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2017-02-16 18:36:34 -0600
committer cracyc <cracyc@users.noreply.github.com>2017-02-16 18:36:34 -0600
commit00b999cbfac8a1fd016a84bfc498f25c9d73c6bf (patch)
tree44a77d4350ec4761e012a65c1c46dbe815686c15 /plugins/data/load_dat.lua
parent73b4115c19e4b6d2536e31ce6fa50f11fa5731b9 (diff)
plugins/data: fix if order (nw)
Diffstat (limited to 'plugins/data/load_dat.lua')
-rw-r--r--plugins/data/load_dat.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/data/load_dat.lua b/plugins/data/load_dat.lua
index fda94d11269..c1cb437d3af 100644
--- a/plugins/data/load_dat.lua
+++ b/plugins/data/load_dat.lua
@@ -49,7 +49,12 @@ function datfile.open(file, vertag, fixupcb)
end
stmt:finalize()
- if not dbver then
+ if not fh and dbver then
+ -- data in database but missing file, just use what we have
+ return read, dbver
+ elseif not fh then
+ return nil
+ elseif not dbver then
db:exec("CREATE TABLE \"" .. file .. [[_idx" (
type VARCHAR NOT NULL,
val VARCHAR NOT NULL,
@@ -57,11 +62,6 @@ function datfile.open(file, vertag, fixupcb)
data INTEGER NOT NULL)]])
db:exec("CREATE TABLE \"" .. file .. "\" (data CLOB NOT NULL)")
db:exec("CREATE INDEX \"typeval_" .. file .. "\" ON \"" .. file .. "_idx\"(type, val)")
- elseif not fh then
- -- data in database but missing file, just use what we have
- return read, dbver
- elseif not fh and not dbver then
- return nil
end
if vertag then