Cuberite Forum
SQL DB support for Lua - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: SQL DB support for Lua (/thread-1411.html)



SQL DB support for Lua - xoft - 03-18-2014

I'm still considering ways to add real SQL DB connectivity to MCServer without affecting the compilation setup burden. In the mini-research I have done, probably the best possible course of action would be to make MCServer depend on ODBC, then use the LuaSQL.ODBC library for the Lua bindings.

Could we pull this one off? There's a few points to consider:
- How easy is it to set up the development environment to have access to ODBC?
- How easy is it to set up LuaSQL.ODBC library to compile into MCS?
- Is ODBC supported on all platforms that MCS can compile on? (I'm looking at you, Android)
- Is ODBC enough to handle all the DB needs that the plugins may have?
- ...?

From what I've seen on my Windows boxes, ODBC support libraries / headers come installed directly with MSVC / Windows SDKs; there's no extra cost here. On *nix there's UnixODBC which should be available on most platforms using a simple pkg-mgr call. I've seen several online versions of FindODBC.cmake file that search for the ODBC libs / headers, so this should be possible pretty easily. Thoughts?


RE: SQL DB support for Lua - worktycho - 03-18-2014

I would say this should be optional/plugin only since our aim is a high performance system and most DBMS's are pretty heavy weight.


RE: SQL DB support for Lua - xoft - 03-18-2014

Oh yes, it's only for the plugins, but on the other hand, most serious plugins need some form of DB connectivity, so we should provide it out of the box, rather than requiring the installation of third-party garbage like LuaRocks.


RE: SQL DB support for Lua - worktycho - 03-18-2014

Yes they need permanent storage but a full blown DBMS? What plug-ins need more than sqllite provides?


RE: SQL DB support for Lua - xoft - 03-18-2014

It's not so much about the storage as about the connectivity. If you take a regular MC server, they have a website where they put stuff, they have a shop where you can buy VIP status or in-game items etc. These need to have the same DB backend as the plugins so that they can communicate together.


RE: SQL DB support for Lua - worktycho - 03-18-2014

That makes sense. So ideally we'd want a binding that transparently redirects to sqlite or a DBMS depending on config. However that would be a lot of work so we would just expose the DBMS bindings to the plugins.


RE: SQL DB support for Lua - bearbin - 03-18-2014

Why share a DB why you could REST API?


RE: SQL DB support for Lua - xoft - 03-18-2014

Once MCS has Lua sockets, REST API is the next natural step forwards. But still a real DB is needed anyway.

This thread has wandered off-topic. What about my original questions? Is there anything I'm missing in the mini-analysis? Anyone have practical experience with multi-platform ODBC development?