在MySQL5.1中可以自己编写information_schema的插件,用于得到一些服务器的内部信息,
这里提供了一个简单的例子,是显示会话的savepoint的。虽然他说会增加显示临时表的插件,但我实在不想等了,于是也照葫芦画了一个。
mysql_is_temporary.cc
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