Congratulations for being a 2008 GSoC mentoring organization.
My name is Calin Dobos and I am interested in the MySQL/Lua integration
I have read the wiki and I am still a bit confused about some aspects of
embedding. Most important, the goal.
Embedding the lua VM into the mySQL command line would create a
Lua interpreter. Which is pretty much the same thing as the official lua
interpreter, in which we could "require mysql". A Google search for "mysql
returns a list of some projects that may have some of the functionality
(I admit, I haven't really checked them yet). Bridging two separate clients
wouldn't be so straightforward (intermediate files, maybe pipes). But the
interpreter with a mysql module might do just fine by itself. Loops,
arrays,they're already there. We don't need a MySQL command line just to
So, taking this nihilistic approach, it comes down to creating a
On the other side, we shall not forget that embedding is not just about
scripts, but about handling the state of the program and making the best of
afterwards. If we are to embed lua into the command line, it needs to have
really neat features.
My quick approach at this time would be keeping the client and VM in
layers, connected by simple calls like:
> run script_name
> exec direct lua commands
> store lua_variable sql_command
> show lua_variable
,which are to be added to the client.
Access the other way round could be either provided by simple wrapper
of the C API,like mysql.store_result(),mysql.query() or some
The connection should be shared between the VM and the client.
The store command would normally create a table(which is what makes Lua so
powerful in the first place).But I'm not sure what the impact 3 tables of
rows each would have on performance (I never tried that).
Another idea would be to create a "virtual" lua table,which would associate
lua_variable with the select command,so every time the table is used,the
is actually invoked (more like a macro). I guess this kind of object could
provide access by index (like a normal table).Also, I think we could easily
it a View. :)
A great thing about embedding Lua is that it offers general file IO. One
easily write a script that exports the database into some exotic file
say , script to analyze some data and then selectively insert it into the
appropriate table. But then again, this is not something a scripting
couldn't do by itself. However, a good reason that I do found for embedding
having startup/exit scripts, which could perform some repetitive or
tasks automatically, but still leave the familiar command line to the user.
These are some of my ideas at this time. I may be extremely wrong.
Computer Science, UAIC, Romania