wormhole: table discovery

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) unsigned,
  `fld2` smallint(6) unsigned,
  `fld3` varbinary(64)
) ENGINE=WORMHOLE DEFAULT CHARSET=latin1
1 row in set (0.01 sec)

The types are numbers for now, I'll export all the field defs in a next push.

Summary

The table definition is in control of the lua-script. No need for a extra CREATE TABLE statement to declare the existence of the table.

With this basic framework we can now rewrite our previous examples and generate tables on the fly.