1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2010 Brian Aker
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
21 |
#include "config.h" |
|
22 |
||
1429.1.1
by Brian Aker
Shift show commands to their own dictionary. |
23 |
#include "plugin/show_dictionary/dictionary.h" |
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
24 |
|
25 |
using namespace std; |
|
26 |
using namespace drizzled; |
|
27 |
||
1320.1.17
by Brian Aker
New code for a show temporary tables; |
28 |
ShowTemporaryTables::ShowTemporaryTables() : |
29 |
drizzled::plugin::TableFunction("DATA_DICTIONARY", "SHOW_TEMPORARY_TABLES") |
|
30 |
{
|
|
31 |
add_field("TABLE_SCHEMA"); |
|
32 |
add_field("TABLE_NAME"); |
|
1643.3.10
by Brian Aker
Column support, clean up of IS/DD for NULL type. |
33 |
add_field("RECORDS", plugin::TableFunction::NUMBER, 0, false); |
34 |
add_field("RECORD_LENGTH", plugin::TableFunction::NUMBER, 0, false); |
|
1320.1.17
by Brian Aker
New code for a show temporary tables; |
35 |
add_field("ENGINE"); |
36 |
}
|
|
37 |
||
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
38 |
ShowTemporaryTables::Generator::Generator(Field **arg) : |
1604
by Brian Aker
REmove current_session for heap, show temp |
39 |
plugin::TableFunction::Generator(arg), |
40 |
session(getSession()) |
|
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
41 |
{
|
1604
by Brian Aker
REmove current_session for heap, show temp |
42 |
table= session.temporary_tables; |
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
43 |
}
|
44 |
||
45 |
bool ShowTemporaryTables::Generator::populate() |
|
46 |
{
|
|
1429.1.2
by Brian Aker
Update for show temporary tables; |
47 |
while (table) |
48 |
{
|
|
1532.1.15
by Brian Aker
Partial encapsulation of TableShare from Table. |
49 |
if (not isWild(table->getShare()->getTableName())) |
1429.1.2
by Brian Aker
Update for show temporary tables; |
50 |
{
|
51 |
break; |
|
52 |
}
|
|
1608
by Brian Aker
This encapsulates prev/next. |
53 |
table= table->getNext(); |
1429.1.2
by Brian Aker
Update for show temporary tables; |
54 |
}
|
55 |
||
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
56 |
if (not table) |
57 |
return false; |
|
58 |
||
59 |
fill(); |
|
60 |
||
1608
by Brian Aker
This encapsulates prev/next. |
61 |
table= table->getNext(); |
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
62 |
|
63 |
return true; |
|
64 |
}
|
|
65 |
||
66 |
void ShowTemporaryTables::Generator::fill() |
|
67 |
{
|
|
68 |
/* TABLE_SCHEMA */
|
|
1532.1.15
by Brian Aker
Partial encapsulation of TableShare from Table. |
69 |
push(table->getShare()->getSchemaName()); |
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
70 |
|
71 |
/* TABLE_NAME */
|
|
1532.1.15
by Brian Aker
Partial encapsulation of TableShare from Table. |
72 |
push(table->getShare()->getTableName()); |
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
73 |
|
1320.1.17
by Brian Aker
New code for a show temporary tables; |
74 |
/* RECORDS */
|
1320.1.18
by Brian Aker
Overhaul of SHOW TABLE STATUS. |
75 |
push(static_cast<uint64_t>(table->getCursor().records())); |
1320.1.17
by Brian Aker
New code for a show temporary tables; |
76 |
|
77 |
/* RECORD_LENGTH */
|
|
78 |
push(static_cast<uint64_t>(table->getRecordLength())); |
|
79 |
||
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
80 |
/* ENGINE */
|
1320.1.17
by Brian Aker
New code for a show temporary tables; |
81 |
push(table->getEngine()->getName()); |
1320.1.16
by Brian Aker
First pass through creating a DD for showing what temporary tables you |
82 |
}
|