Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Trust
b830fea185 [Feature] LUA SQL Support (Linux)
Copy the luasql_ext.lua from global/lib/lua/5.1/ and place that in the root game folder with your eqemu_config.json and edit the database information to mirror your connection requirements.

Example lua use:

```lua
local mysql = require("luasql_ext");

for id, level, locked_out in mysql.rows(con,string.format("SELECT DISTINCT c.`id`, c.`level` FROM group_id g INNER JOIN character_data c ON c.id = g.character_id WHERE g.group_id = %s", group:GetID())) do
			if tonumber(level) <= dia_min_level then dia_min_level = tonumber(level) end
			if tonumber(level) >= dia_max_level then dia_max_level = tonumber(level) end
			dia_total_level = dia_total_level + tonumber(level);
			dia_member_count = dia_member_count + 1;
		end

```

```lua
local mysql = require("luasql_ext");

		for id,name in mysql.rows(con,"SELECT id from npc_types WHERE id >= 211000 and id < 212000 and disable_instance = 1") do
			disable_instance[id] = tonumber(id);
		end
```
2024-11-04 21:06:51 -05:00
9 changed files with 512 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,41 @@
--MySQL connection information to use in conjunction with luamysql
--This can be dropped in the eqemu server root directory and will be automatically referenced
--this information can be pulled from the eqemu_config.xml file in the eqemu server root
-- load driver
local driver = require("luasql_mysql");
--declare table
local luasql_ext = {};
--set database information
local database_name = "local_dev";
local user = "root";
local password = "eqemu";
local ip_addr = "localhost";
local port = "3306";
function luasql_ext.env(e)
-- create environment object
env = assert (driver.mysql());
return env;
end
function luasql_ext.con(e)
-- connect to data source
con = assert (env:connect(database_name,user,password,ip_addr,port));
return con;
end
function luasql_ext.rows(connection,statement)
env = assert (driver.mysql());
local con = connection or assert (env:connect(database_name,user,password,ip_addr,port));
local cur = assert (con:execute(statement));
con:close();
env:close();
return function()
return cur:fetch()
end
end
return luasql_ext;

Binary file not shown.

View file

@ -0,0 +1,123 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Licen&ccedil;a LuaSQL</title>
<link rel="stylesheet" href="doc.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"><a href="http://www.keplerproject.org">
<img alt="LuaSQL logo" src="luasql.png"/>
</a></div>
<div id="product_name"><big><strong>LuaSQL</strong></big></div>
<div id="product_description">Conectividade de banco de dados para a linguagem de programa&ccedil;&atilde;o Lua</div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>LuaSQL</h1>
<ul>
<li><a href="index.html">Home</a>
<ul>
<li><a href="index.html#overview">Vis&atilde;o Geral</a></li>
<li><a href="index.html#status">Status</a></li>
<li><a href="index.html#download">Download</a></li>
<li><a href="index.html#credits">Cr&eacute;ditos</a></li>
<li><a href="index.html#contact">Contato</a></li>
</ul>
</li>
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#introduction">Introdu&ccedil;&atilde;o</a></li>
<li><a href="manual.html#compiling">Compilando</a></li>
<li><a href="manual.html#installation">Instala&ccedil;&atilde;o</a></li>
<li><a href="manual.html#errors">Tratamento de erros</a></li>
<li><a href="manual.html#drivers">Drivers</a></li>
<li><a href="manual.html#environment_object">Ambiente</a></li>
<li><a href="manual.html#connection_object">Conex&atilde;o</a></li>
<li><a href="manual.html#cursor_object">Cursor</a></li>
<li><a href="manual.html#postgres_extensions">PostgreSQL</a></li>
<li><a href="manual.html#mysql_extensions">MySQL</a></li>
<li><a href="manual.html#oracle_extensions">Oracle</a></li>
<li><a href="manual.html#sqlite3_extensions">SQLite3</a></li>
</ul>
</li>
<li><a href="examples.html">Exemplos</a></li>
<li><a href="history.html">Hist&oacute;rico</a></li>
<li><a href="http://github.com/keplerproject/luasql">Projeto</a>
<ul>
<li><a href="http://github.com/keplerproject/luasql/issues">Bug Tracker</a></li>
</ul>
</li>
<li><strong>Licen&ccedil;a</strong></li>
</ul>
</div> <!-- id="navigation" -->
<div id="content">
<h2>License</h2>
<p>LuaSQL is free software:
it can be used for both academic and commercial purposes at absolutely no cost.
There are no royalties or GNU-like "copyleft" restrictions.
LuaSQL qualifies as
<a href="http://www.opensource.org/docs/definition.html">Open Source</a>
software.
Its licenses are compatible with
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.
LuaSQL is not in the public domain and the
<a href="http://www.keplerproject.org">Kepler Project</a>
keep its copyright.
The legal details are below.</p>
<p>The spirit of the license is that
you are free to use LuaSQL for any purpose at no cost without having to ask us.
The only requirement is that if you do use LuaSQL,
then you should give us credit by including the appropriate copyright notice
somewhere in your product or its documentation.</p>
<p>The LuaSQL library is designed and implemented by the
<a href="http://www.keplerproject.org">Kepler Project</a> team.
The implementation is not derived from licensed software.</p>
<hr/>
<p>Copyright &copy; 2003-2006 The Kepler Project.</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</p>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
<p><small>
$Id: license.html,v 1.6 2008/06/11 00:26:13 jasonsantos Exp $
</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View file

@ -0,0 +1,120 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>LuaSQL License</title>
<link rel="stylesheet" href="doc.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"><a href="http://www.keplerproject.org">
<img alt="LuaSQL logo" src="luasql.png"/>
</a></div>
<div id="product_name"><big><b>LuaSQL</b></big></div>
<div id="product_description">Database connectivity for the Lua programming language</div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>LuaSQL</h1>
<ul>
<li><a href="index.html">Home</a>
<ul>
<li><a href="index.html#overview">Overview</a></li>
<li><a href="index.html#status">Status</a></li>
<li><a href="index.html#download">Download</a></li>
<li><a href="index.html#credits">Credits</a></li>
<li><a href="index.html#contact">Contact us</a></li>
</ul>
</li>
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#introduction">Introduction</a></li>
<li><a href="manual.html#compiling">Compiling</a></li>
<li><a href="manual.html#installation">Installation</a></li>
<li><a href="manual.html#errors">Error handling</a></li>
<li><a href="manual.html#drivers">Drivers</a></li>
<li><a href="manual.html#environment_object">Environment</a></li>
<li><a href="manual.html#connection_object">Connection</a></li>
<li><a href="manual.html#cursor_object">Cursor</a></li>
<li><a href="manual.html#postgres_extensions">PostgreSQL</a></li>
<li><a href="manual.html#mysql_extensions">MySQL</a></li>
<li><a href="manual.html#oracle_extensions">Oracle</a></li>
<li><a href="manual.html#sqlite3_extensions">SQLite3</a></li>
</ul>
</li>
<li><a href="examples.html">Examples</a></li>
<li><a href="history.html">History</a></li>
<li><a href="http://github.com/keplerproject/luasql">Project</a>
<ul>
<li><a href="http://github.com/keplerproject/luasql/issues">Bug Tracker</a></li>
</ul>
</li>
<li><strong>License</strong></li>
</ul>
</div> <!-- id="navigation" -->
<div id="content">
<h2>License</h2>
<p>LuaSQL is free software:
it can be used for both academic and commercial purposes at absolutely no cost.
There are no royalties or GNU-like "copyleft" restrictions.
LuaSQL qualifies as
<a href="http://www.opensource.org/docs/definition.html">Open Source</a>
software.
Its licenses are compatible with
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.
LuaSQL is not in the public domain and the
<a href="http://www.keplerproject.org">Kepler Project</a>
keep its copyright.
The legal details are below.</p>
<p>The spirit of the license is that
you are free to use LuaSQL for any purpose at no cost without having to ask us.
The only requirement is that if you do use LuaSQL,
then you should give us credit by including the appropriate copyright notice
somewhere in your product or its documentation.</p>
<p>The LuaSQL library is designed and implemented by the
<a href="http://www.keplerproject.org">Kepler Project</a> team.
The implementation is not derived from licensed software.</p>
<hr/>
<p>Copyright &copy; 2003-2007 The Kepler Project.</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</p>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
<p><small>$Id: license.html,v 1.17 2008/06/11 00:26:13 jasonsantos Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View file

@ -0,0 +1,120 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>LuaSQL License</title>
<link rel="stylesheet" href="doc.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"><a href="http://www.keplerproject.org">
<img alt="LuaSQL logo" src="luasql.png"/>
</a></div>
<div id="product_name"><big><b>LuaSQL</b></big></div>
<div id="product_description">Database connectivity for the Lua programming language</div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>LuaSQL</h1>
<ul>
<li><a href="index.html">Home</a>
<ul>
<li><a href="index.html#overview">Overview</a></li>
<li><a href="index.html#status">Status</a></li>
<li><a href="index.html#download">Download</a></li>
<li><a href="index.html#credits">Credits</a></li>
<li><a href="index.html#contact">Contact us</a></li>
</ul>
</li>
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#introduction">Introduction</a></li>
<li><a href="manual.html#compiling">Compiling</a></li>
<li><a href="manual.html#installation">Installation</a></li>
<li><a href="manual.html#errors">Error handling</a></li>
<li><a href="manual.html#drivers">Drivers</a></li>
<li><a href="manual.html#environment_object">Environment</a></li>
<li><a href="manual.html#connection_object">Connection</a></li>
<li><a href="manual.html#cursor_object">Cursor</a></li>
<li><a href="manual.html#postgres_extensions">PostgreSQL</a></li>
<li><a href="manual.html#mysql_extensions">MySQL</a></li>
<li><a href="manual.html#oracle_extensions">Oracle</a></li>
<li><a href="manual.html#sqlite3_extensions">SQLite3</a></li>
</ul>
</li>
<li><a href="examples.html">Examples</a></li>
<li><a href="history.html">History</a></li>
<li><a href="http://github.com/keplerproject/luasql">Project</a>
<ul>
<li><a href="http://github.com/keplerproject/luasql/issues">Bug Tracker</a></li>
</ul>
</li>
<li><strong>License</strong></li>
</ul>
</div> <!-- id="navigation" -->
<div id="content">
<h2>License</h2>
<p>LuaSQL is free software:
it can be used for both academic and commercial purposes at absolutely no cost.
There are no royalties or GNU-like "copyleft" restrictions.
LuaSQL qualifies as
<a href="http://www.opensource.org/docs/definition.html">Open Source</a>
software.
Its licenses are compatible with
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.
LuaSQL is not in the public domain and the
<a href="http://www.keplerproject.org">Kepler Project</a>
keep its copyright.
The legal details are below.</p>
<p>The spirit of the license is that
you are free to use LuaSQL for any purpose at no cost without having to ask us.
The only requirement is that if you do use LuaSQL,
then you should give us credit by including the appropriate copyright notice
somewhere in your product or its documentation.</p>
<p>The LuaSQL library is designed and implemented by the
<a href="http://www.keplerproject.org">Kepler Project</a> team.
The implementation is not derived from licensed software.</p>
<hr/>
<p>Copyright &copy; 2003-2016 The Kepler Project.</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</p>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
<p><small>$Id: license.html,v 1.17 2008/06/11 00:26:13 jasonsantos Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View file

@ -0,0 +1,35 @@
package = "LuaSQL-MySQL"
version = "2.3.5-1"
source = {
url = "git://github.com/keplerproject/luasql.git",
branch = "v2.3.5",
}
description = {
summary = "Database connectivity for Lua (MySQL driver)",
detailed = [[
LuaSQL is a simple interface from Lua to a DBMS. It enables a
Lua program to connect to databases, execute arbitrary SQL statements
and retrieve results in a row-by-row cursor fashion.
]],
license = "MIT/X11",
homepage = "http://www.keplerproject.org/luasql/"
}
dependencies = {
"lua >= 5.1"
}
external_dependencies = {
MYSQL = {
header = "mysql.h"
}
}
build = {
type = "builtin",
modules = {
["luasql.mysql"] = {
sources = { "src/luasql.c", "src/ls_mysql.c" },
libraries = { "mysqlclient" },
incdirs = { "$(MYSQL_INCDIR)" },
libdirs = { "$(MYSQL_LIBDIR)" }
}
}
}

View file

@ -0,0 +1,36 @@
rock_manifest = {
doc = {
br = {
['examples.html'] = "ddc16a018fa1a65cdce283dca0925356",
['history.html'] = "b5b65b2e94d29163b3553474521d690e",
['index.html'] = "a296a03e6ed1b4290289f22872a824fe",
['license.html'] = "4b1a85bd9cfdbd5e4e6f64f29ad591f8",
['luasql.png'] = "a858d251851675daefb731baacafd1b8",
['manual.html'] = "296c8dc866d5a343bce3419890c59607"
},
fr = {
['doc.css'] = "d0a913514fb190240b3b4033d105cbc0",
['examples.html'] = "ac400f8c25880c355239cc553863bf20",
['history.html'] = "cbab789ae8fe289409f6af05b16e5691",
['index.html'] = "9a2c0bed67d59f2713da8e107f759cb6",
['license.html'] = "66567e98ce30262a987b42bd88db71a8",
['luasql.png'] = "a858d251851675daefb731baacafd1b8",
['manual.html'] = "45ad06d64a62e56047d17e73ce9f608f"
},
us = {
['doc.css'] = "d0a913514fb190240b3b4033d105cbc0",
['examples.html'] = "ac400f8c25880c355239cc553863bf20",
['history.html'] = "a937ce3ca0a070b3b82b8f29db4805c6",
['index.html'] = "90a31f9551bbcde04cb5e54daa2c3ee2",
['license.html'] = "62f494ac81fe39a4f6afcda9a6d7b310",
['luasql.png'] = "a858d251851675daefb731baacafd1b8",
['manual.html'] = "45ad06d64a62e56047d17e73ce9f608f"
}
},
lib = {
luasql = {
['mysql.so'] = "84b855efa7269b46fdc7ea9a4a60e42c"
}
},
['luasql-mysql-2.3.5-1.rockspec'] = "0703ea942b7ad2230423e7560a3e982e"
}

View file

@ -0,0 +1,37 @@
commands = {}
dependencies = {
['luasql-mysql'] = {
['2.3.5-1'] = {
{
constraints = {
{
op = ">=",
version = {
5, 1, string = "5.1"
}
}
},
name = "lua"
}
}
}
}
modules = {
['luasql.mysql'] = {
"luasql-mysql/2.3.5-1"
}
}
repository = {
['luasql-mysql'] = {
['2.3.5-1'] = {
{
arch = "installed",
commands = {},
dependencies = {},
modules = {
['luasql.mysql'] = "luasql/mysql.so"
}
}
}
}
}