00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <plugin/catalog/module.h>
00024
00025 namespace plugin {
00026 namespace catalog {
00027 namespace tables {
00028
00029 Catalogs::Catalogs() :
00030 drizzled::plugin::TableFunction("DATA_DICTIONARY", "CATALOGS")
00031 {
00032 add_field("CATALOG_NAME", drizzled::plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
00033 add_field("CATALOG_CREATION_TIME");
00034 add_field("CATALOG_UPDATE_TIME");
00035 add_field("CATALOG_UUID", drizzled::plugin::TableFunction::STRING, 36, true);
00036 add_field("CATALOG_VERSION", drizzled::plugin::TableFunction::NUMBER, 0, true);
00037 }
00038
00039 Catalogs::Generator::Generator(drizzled::Field **arg) :
00040 drizzled::plugin::TableFunction::Generator(arg)
00041 {
00042 }
00043
00044 bool Catalogs::Generator::populate()
00045 {
00046 drizzled::message::catalog::shared_ptr tmp;
00047
00048 while ((tmp= catalog_generator))
00049 {
00050
00051 push(tmp->name());
00052
00053
00054 time_t time_arg= tmp->creation_timestamp();
00055 char buffer[40];
00056 struct tm tm_buffer;
00057
00058 localtime_r(&time_arg, &tm_buffer);
00059 strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", &tm_buffer);
00060 push(buffer);
00061
00062
00063 time_arg= tmp->update_timestamp();
00064 localtime_r(&time_arg, &tm_buffer);
00065 strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", &tm_buffer);
00066 push(buffer);
00067
00068
00069 push(tmp->uuid());
00070
00071
00072 push(tmp->version());
00073
00074 return true;
00075 }
00076
00077 return false;
00078 }
00079
00080 }
00081 }
00082 }