mirror of
https://github.com/MinetestForFun/mysql_base.git
synced 2025-06-29 15:00:33 +02:00
Compare commits
1 Commits
master
...
67804c69f1
Author | SHA1 | Date | |
---|---|---|---|
67804c69f1 |
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "mysql"]
|
[submodule "mysql"]
|
||||||
path = mysql
|
path = mysql
|
||||||
url = https://github.com/luapower/mysql.git
|
url = https://sys4.fr/gitea/sys4/mysql.git
|
||||||
|
19
.luacheckrc
19
.luacheckrc
@ -1,19 +0,0 @@
|
|||||||
unused_args = false
|
|
||||||
allow_defined_top = true
|
|
||||||
max_line_length = 999
|
|
||||||
|
|
||||||
globals ={
|
|
||||||
"minetest",
|
|
||||||
}
|
|
||||||
|
|
||||||
read_globals = {
|
|
||||||
string = {fields = {"split", "trim"}},
|
|
||||||
table = {fields = {"copy", "getn"}},
|
|
||||||
}
|
|
||||||
|
|
||||||
files["init.lua"].ignore = { "modname", "tab" }
|
|
||||||
files["mysql/mysql.lua"].ignore = { "" }
|
|
||||||
files["mysql/mysql_h.lua"].ignore = { "" }
|
|
||||||
files["mysql/mysql_print.lua"].ignore = { "" }
|
|
||||||
files["mysql/mysql_test.lua"].ignore = { "" }
|
|
||||||
-- ^ Ignore everything
|
|
11
.travis.yml
11
.travis.yml
@ -1,11 +0,0 @@
|
|||||||
language: generic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- luarocks
|
|
||||||
before_install:
|
|
||||||
- luarocks install --local luacheck
|
|
||||||
script:
|
|
||||||
- $HOME/.luarocks/bin/luacheck .
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
@ -1,5 +1,4 @@
|
|||||||
# mysql_base
|
# mysql_base
|
||||||
[](https://travis-ci.org/MinetestForFun/mysql_base)
|
|
||||||
|
|
||||||
Base Minetest mod to connect to a MySQL database. Used by other mods to read/write data.
|
Base Minetest mod to connect to a MySQL database. Used by other mods to read/write data.
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
|
|
||||||
local thismod = _G[modname]
|
local thismod = _G[modname]
|
||||||
|
|
||||||
---- Table creation & deletion
|
---- Table creation & deletion
|
||||||
@ -32,7 +33,6 @@ function thismod.create_table_sql(name, params)
|
|||||||
end
|
end
|
||||||
return 'CREATE TABLE ' .. name .. ' (' .. table.concat(lines, ',') .. ')'
|
return 'CREATE TABLE ' .. name .. ' (' .. table.concat(lines, ',') .. ')'
|
||||||
end
|
end
|
||||||
|
|
||||||
function thismod.create_table(name, params)
|
function thismod.create_table(name, params)
|
||||||
thismod.conn:query(thismod.create_table_sql(name, params))
|
thismod.conn:query(thismod.create_table_sql(name, params))
|
||||||
end
|
end
|
||||||
@ -40,7 +40,6 @@ end
|
|||||||
function thismod.drop_table_sql(name)
|
function thismod.drop_table_sql(name)
|
||||||
return 'DROP TABLE ' .. name
|
return 'DROP TABLE ' .. name
|
||||||
end
|
end
|
||||||
|
|
||||||
function thismod.drop_table(name)
|
function thismod.drop_table(name)
|
||||||
thismod.conn:query(thismod.drop_table_sql(name))
|
thismod.conn:query(thismod.drop_table_sql(name))
|
||||||
end
|
end
|
||||||
@ -97,7 +96,6 @@ end
|
|||||||
function thismod.prepare_select_sql(tablename, colnames, where)
|
function thismod.prepare_select_sql(tablename, colnames, where)
|
||||||
return 'SELECT ' .. table.concat(colnames, ',') .. ' FROM ' .. tablename .. ' WHERE ' .. where
|
return 'SELECT ' .. table.concat(colnames, ',') .. ' FROM ' .. tablename .. ' WHERE ' .. where
|
||||||
end
|
end
|
||||||
|
|
||||||
function thismod.prepare_select(tablename, cols, where, wheretypes)
|
function thismod.prepare_select(tablename, cols, where, wheretypes)
|
||||||
local colnames, coltypes = {}, {}
|
local colnames, coltypes = {}, {}
|
||||||
for _, col in ipairs(cols) do
|
for _, col in ipairs(cols) do
|
||||||
|
5
init.lua
5
init.lua
@ -11,14 +11,12 @@ function thismod.mklog(level, modname)
|
|||||||
minetest.log(level, "[" .. modname .. "] " .. str)
|
minetest.log(level, "[" .. modname .. "] " .. str)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local LogI = thismod.mklog('action', modname)
|
local LogI = thismod.mklog('action', modname)
|
||||||
local LogE = thismod.mklog('error', modname)
|
local LogE = thismod.mklog('error', modname)
|
||||||
|
|
||||||
local singleplayer = minetest.is_singleplayer() -- Caching is OK since you can't open a game to
|
local singleplayer = minetest.is_singleplayer() -- Caching is OK since you can't open a game to
|
||||||
-- multiplayer unless you restart it.
|
-- multiplayer unless you restart it.
|
||||||
|
if minetest.setting_get(modname .. '.enable_singleplayer') ~= 'true' and singleplayer then
|
||||||
if minetest.settings:get(modname .. '.enable_singleplayer') ~= 'true' and singleplayer then
|
|
||||||
LogI("Not enabling because of singleplayer game")
|
LogI("Not enabling because of singleplayer game")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -204,7 +202,6 @@ local function ping()
|
|||||||
end
|
end
|
||||||
minetest.after(1800, ping)
|
minetest.after(1800, ping)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.after(10, ping)
|
minetest.after(10, ping)
|
||||||
|
|
||||||
local shutdown_callbacks = {}
|
local shutdown_callbacks = {}
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,2 +0,0 @@
|
|||||||
name = mysql_base
|
|
||||||
description = MySQL connector (requires LuaJIT FFI).
|
|
2
mysql
2
mysql
Submodule mysql updated: 720d2a3955...f3bd1020b2
Reference in New Issue
Block a user