[Sputnik-list] LuaSQL Versium Plugin
Jim Whitehead II
jnwhiteh at gmail.com
Mon Mar 3 21:26:44 GMT+2 2008
I've written the following plugin for versium that interfaces via
LuaSQL. I've tested with both SQLite3 and MySQL but wanted to send
out a quick message letting everyone know the progress I've made. I
plan to split the adapters up into their own plugins, so I can
optimize each of them independently. I plan to focus on MySQL, since
it will be running my site and I can naturally gain the most from it.
Usage in sputnik.lua/sputnik.cgi:
-- for SQLite3
-- driver = "sqlite3",
-- connect = {"/home/user/sputnik/wiki-data.db"},
-- for MYSql
driver = "mysql",
connect = {"databasename", "username", "password"},
It's very "proof of concept" code, but it definitely works. It uses
the following table scheme that I threw together (could obviously be
optimized). These tables are not created automatically for you, but
once I decide on the format, they will be.
CREATE TABLE node_history(node text, version integer, timestamp text,
author text, comment text);
CREATE TABLE node_index(node text, version integer);
CREATE TABLE nodes(node text, version integer, data text);
As you can see its a direct translation of the information stored in
the simple versium repo. Some basic thought and design will help to
optimize the entire thing.
In theory this _should_ work with any of the LuaSQL drivers as long as
you specify the right driver and connection parameters. Simply
install the correct rock from the CVS repository, and go go go! I've
noticed quite a speed increase using even the unoptimized MySQL.
- Jim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: db.lua
Type: application/octet-stream
Size: 10354 bytes
Desc: not available
Url : http://lists.luaforge.net/pipermail/sputnik-list/attachments/20080303/85c7c943/db.obj
More information about the Sputnik-list
mailing list