Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.6Mb
PDF (A4) - 35.6Mb
PDF (RPM) - 34.7Mb
EPUB - 8.7Mb
HTML Download (TGZ) - 8.5Mb
HTML Download (Zip) - 8.5Mb
HTML Download (RPM) - 7.3Mb
Eclipse Doc Plugin (TGZ) - 9.3Mb
Eclipse Doc Plugin (Zip) - 11.5Mb
Man Pages (TGZ) - 203.5Kb
Man Pages (Zip) - 310.2Kb
Info (Gzip) - 3.3Mb
Info (Zip) - 3.3Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  /  Alternative Storage Engines  /  The EXAMPLE Storage Engine

16.9 The EXAMPLE Storage Engine

The EXAMPLE storage engine is a stub engine that does nothing. Its purpose is to serve as an example in the MySQL source code that illustrates how to begin writing new storage engines. As such, it is primarily of interest to developers.

To enable the EXAMPLE storage engine if you build MySQL from source, invoke CMake with the -DWITH_EXAMPLE_STORAGE_ENGINE option.

To examine the source for the EXAMPLE engine, look in the storage/example directory of a MySQL source distribution.

When you create an EXAMPLE table, the server creates a table format file in the database directory. The file begins with the table name and has an .frm extension. No other files are created. No data can be stored into the table. Retrievals return an empty result.

mysql> CREATE TABLE test (i INT) ENGINE = EXAMPLE;
Query OK, 0 rows affected (0.78 sec)

mysql> INSERT INTO test VALUES(1),(2),(3);
ERROR 1031 (HY000): Table storage engine for 'test' doesn't ┬╗
                    have this option

mysql> SELECT * FROM test;
Empty set (0.31 sec)

The EXAMPLE storage engine does not support indexing.


User Comments
  Posted by vishnu rao on June 2, 2012
here are the steps to enable the engine using CMake
(i did this for enabling the engine with percona)

1)do cmake with the -DWITH_EXAMPLE_STORAGE_ENGINE
Command:
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DWITH_EMBEDDED_SERVER=OFF -DWITH_EXAMPLE_STORAGE_ENGINE=ON

2) make & make install
3) login with `mysql -uroot`
4) show variables like '%plugin_dir%';
5) make sure the library 'ha_example.so' is present under the plugin directory
6)then say "INSTALL PLUGIN example SONAME 'ha_example.so';"

since its a dynamic library it must be installed into the server using the INSTALL PLUGIN statement or the --plugin-load option before it can be used.

------
Vishnu Rao.
------

Sign Up Login You must be logged in to post a comment.