---
title: "information_schema的插件"
author: "jedy"
date: "2008-02-21T09:20:00Z"
tags: []
slug: "information-schema"
draft: false
lastmod: "2008-02-21T09:20:00Z"
id: 304656
url: "https://jedy.iteye.com/blog/304656"
---

在MySQL5.1中可以自己编写information\_schema的插件，用于得到一些服务器的内部信息，[这里](http://dev.mysql.com/tech-resources/articles/mysql_i_s_plugins_part2.html)提供了一个简单的例子，是显示会话的savepoint的。虽然他说会增加显示临时表的插件，但我实在不想等了，于是也照葫芦画了一个。

```

mysql >create temporary table a (a int); create temporary table b (b int); select * from information_schema.mysql_temporary;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

+--------------------+----------------------+---------------------+
| TEMPORARY_TABLE_ID | TEMPORARY_TABLE_NAME | TEMPORARY_FILE_PATH |
+--------------------+----------------------+---------------------+
|                  1 | b                    | /tmp/#sql3ad0_1_1   |
|                  2 | a                    | /tmp/#sql3ad0_1_0   |
+--------------------+----------------------+---------------------+
2 rows in set (0.00 sec)
```

[mysql\_is\_temporary.cc](http://jedywu.googlepages.com/mysql_is_temporary.cc)