8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

18.9 EXAMPLE 存储引擎18.9 The EXAMPLE Storage Engine

EXAMPLE 存储引擎是一个不执行任何操作的占位引擎。其目的是作为 MySQL 源代码中的示例,展示如何开始编写新的存储引擎。因此,它主要对开发人员有兴趣。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.

如果你从源代码构建 MySQL,要启用 EXAMPLE 存储引擎,需要使用 CMake 并带上 -DWITH_EXAMPLE_STORAGE_ENGINE 选项。To enable the EXAMPLE storage engine if you build MySQL from source, invoke CMake with the -DWITH_EXAMPLE_STORAGE_ENGINE option.

要查看 EXAMPLE 引擎的源码,请查看 MySQL 源码发行版中的 storage/example 目录。To examine the source for the EXAMPLE engine, look in the storage/example directory of a MySQL source distribution.

当你创建一个 EXAMPLE 表时,不会创建任何文件。无法向表中存储数据。检索操作返回空结果。When you create an EXAMPLE table, no 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 ROW(1), ROW(2), ROW(3);
ERROR 1031 (HY000): Table storage engine for 'test' doesn't »
                    have this option

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

EXAMPLE 存储引擎不支持索引。The EXAMPLE storage engine does not support indexing.

EXAMPLE 存储引擎不支持分区。The EXAMPLE storage engine does not support partitioning.