mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2024-12-26 01:18:22 +01: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()
|
||||
if not sqlite then
|
||||
sqlite = require("sqlitedb")
|
||||
sqlite.getdb = function(s)
|
||||
return sqlite._getdb(__api__.dbpath.."/"..s..".db")
|
||||
sqlite.getdb = function(name)
|
||||
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
|
||||
return sqlite
|
||||
|
Loading…
Reference in New Issue
Block a user