A read-only storage engine
This simple storage engine plugin, called STATIC_TEXT
, supports only read-only tables. It defines two system variables, which we use to change its behavior. The first variable is @@static_text_text
, which specifies the text returned in VARCHAR
fields ("Hello world!" by default) and the second variable is @@static_text_rows
, which specifies the number of rows to return (the default is 3). When a table in this storage engine is queried, any VARCHAR
field will contain the contents of @@static_text_text
and any integer field will contain the current row number:
mysql> install plugin STATIC_TEXT soname 'ha_text.so';
Query OK, 0 rows affected (0.03 sec)
mysql> create table t1 (a int, b varchar(50)) engine=static_text;
Query OK, 0 rows affected (0.37 sec)
mysql> select * from t1;
+------+--------------+
| a | b |
+------+--------------+
| 1 | Hello World! |
| 2 | Hello World! |
| 3 | Hello World! |
+------+--------------+
3 rows in set (0.00 sec)
The number...