mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2025-04-16 11:46:44 +02:00
sqlite module: infer database path from parameter
All checks were successful
gitea-sync/antd-lua-plugin/pipeline/head This commit looks good
All checks were successful
gitea-sync/antd-lua-plugin/pipeline/head This commit looks good
More detail on issue #4
This commit is contained in:
parent
b69d98d205
commit
243e778ac7
11
APIs/std.lua
11
APIs/std.lua
@ -4,8 +4,15 @@ array = modules.array()
|
|||||||
modules.sqlite = function()
|
modules.sqlite = function()
|
||||||
if not sqlite then
|
if not sqlite then
|
||||||
sqlite = require("sqlitedb")
|
sqlite = require("sqlitedb")
|
||||||
sqlite.getdb = function(s)
|
sqlite.getdb = function(name)
|
||||||
return sqlite._getdb(__api__.dbpath.."/"..s..".db")
|
if name:find("%.db$") then
|
||||||
|
return sqlite._getdb(name)
|
||||||
|
elseif name:find("/") then
|
||||||
|
LOG_ERROR("Invalid database name %s", name)
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
return sqlite._getdb(__api__.dbpath.."/"..name..".db")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return sqlite
|
return sqlite
|
||||||
|
Loading…
x
Reference in New Issue
Block a user