[Sputnik-list] Re: LuaSQL Versium Plugin
Jim Whitehead II
jnwhiteh at gmail.com
Tue Mar 4 13:20:17 GMT+2 2008
I ran into some issues with the initial iteration of the plugin,
specifically due to the SQL escaping mechanism that was taken from
lua-users.org. Since any string value gets sent through a gsub, we
were losing the backslash from every escape sequence (so \\ became \).
The most noticable place where this happens is the "Advanced Options"
link on the edit pages.
This new version rectifies that, and adds a few more options (and
MySQL optimisations):
* Tables are created automatically when the store is first loaded with
a given set of parameters
* Constructor takes an optional table prefix that is used when
creating and addressing the tables
Usage:
SPUTNIK_CONFIG.VERSIUM_STORAGE_MODULE = "versium.storage.luasql.mysql"
SPUTNIK_CONFIG.VERSIUM_PARAMS = {
prefix = "somePrefix_",
connect = {"databasename", "username", "password", "host", "port"}
}
Prefix is optional, as are username/password/host/port. I plan to
backport these changes to the generic plugin and we'll get them both
properly released. There are bound to be bugs, so if you get an
opportunity to test things out that would be great.
The file needs to be placed in $SPUTNIK_DIR/share/lua/5.1/versium/storage/luasql
The generic driver will be named luasql.generic, hence my creation of
a subdirectory under storage. I'm not sure how kosher that is, but I
suspect Yuri will let me know where it belongs.
- Jim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mysql.lua
Type: text/x-lua
Size: 11743 bytes
Desc: not available
Url : http://lists.luaforge.net/pipermail/sputnik-list/attachments/20080304/c9c892e9/mysql.bin
More information about the Sputnik-list
mailing list