O'Reilly logo

MySQL 5.1 Plugin Development by Andrew Hutchings, Sergei Golubchik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required