Hartmut was asking me some time ago how table discovery in the
storage engine interface works. After reading through the code
from ndb, archive and memcache I was a bit disappointed: all of
them are just copying the definition in binary form around.
For the wormhole SE the lua-file has to create table structure on
the fly. You only drop in the .lua into the db-folder and a
SELECT will pick it up automaticly.
We use a small function which returns the table definition:
function discover()
return {
{ name = "fld1", type = 1 },
{ name = "fld2", type = 2 },
{ name = "fld3", type = 15, length = 64 }
}
end
A SHOW CREATE TABLE
against the table shows us:
root@127.0.0.1:test> show create table foobar\G
*************************** 1. row ***************************
Table: foobar
Create Table: CREATE TABLE `foobar` (
`fld1` tinyint(4) …
[Read more]