18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#include <plugin/data_engine/dictionary.h>
21
#include <plugin/data_engine/function.h>
22
22
#include <drizzled/charset.h>
24
24
using namespace std;
25
25
using namespace drizzled;
27
SchemataTool::SchemataTool() :
30
add_field("CATALOG_NAME", message::Table::Field::VARCHAR, 512);
31
add_field("SCHEMA_NAME", message::Table::Field::VARCHAR, 64);
32
add_field("DEFAULT_CHARACTER_SET_NAME", message::Table::Field::VARCHAR, 64);
33
add_field("DEFAULT_COLLATION_NAME", message::Table::Field::VARCHAR, 64);
34
add_field("SQL_PATH", message::Table::Field::VARCHAR, 512);
37
SchemataTool::Generator::Generator()
39
plugin::StorageEngine::getSchemaNames(set_of_names);
41
it= set_of_names.begin();
44
bool SchemataTool::Generator::populate(Field ** fields)
46
if (it == set_of_names.end())
27
SchemasTool::SchemasTool() :
30
add_field("SCHEMA_NAME");
31
add_field("DEFAULT_COLLATION_NAME");
34
SchemasTool::Generator::Generator(Field **arg) :
36
is_schema_primed(false),
37
is_schema_parsed(false)
41
bool SchemasTool::Generator::nextSchema()
49
plugin::StorageEngine::getSchemaNames(schema_names);
50
schema_iterator= schema_names.begin();
51
is_schema_primed= true;
54
if (schema_iterator == schema_names.end())
49
bool rc= fill(fields);
56
bool SchemataTool::Generator::fill(Field ** fields)
58
const CHARSET_INFO * const scs= system_charset_info;
59
message::Schema schema;
60
Field **field= fields;
63
parsed= plugin::StorageEngine::getSchemaDefinition(schema_name(), schema);
66
(*field)->store("default", sizeof("default"), scs);
71
(*field)->store(schema_name().c_str(), schema_name().length(), scs);
74
for (; *field ; field++)
75
(*field)->store("<error>", sizeof("<error>"), scs);
81
(*field)->store(schema.name().c_str(), schema.name().length(), scs);
84
/* DEFAULT_CHARACTER_SET_NAME */
85
(*field)->store("utf8", sizeof("utf8"), scs);
88
/* DEFAULT_COLLATION_NAME */
89
(*field)->store(schema.collation().c_str(), schema.collation().length(), scs);
92
for (; *field ; field++)
94
(*field)->store("<not implemented>", sizeof("<not implemented>"), scs);
100
SchemataNamesTool::SchemataNamesTool() :
101
SchemataTool("SCHEMATA_NAMES")
103
add_field("SCHEMA_NAME", message::Table::Field::VARCHAR, 64);
106
bool SchemataNamesTool::Generator::fill(Field ** fields)
108
const CHARSET_INFO * const scs= system_charset_info;
109
Field **field= fields;
111
(*field)->store(schema_name().c_str(), schema_name().length(), scs);
116
SchemataInfoTool::SchemataInfoTool() :
117
SchemataTool("SCHEMATA_INFO")
119
add_field("SCHEMA_NAME", message::Table::Field::VARCHAR, 64);
120
add_field("DEFAULT_COLLATION_NAME", message::Table::Field::VARCHAR, 64);
123
bool SchemataInfoTool::Generator::fill(Field ** fields)
125
const CHARSET_INFO * const scs= system_charset_info;
126
message::Schema schema;
127
Field **field= fields;
130
parsed= plugin::StorageEngine::getSchemaDefinition(schema_name(), schema);
134
(*field)->store(schema_name().c_str(), schema_name().length(), scs);
137
for (; *field ; field++)
138
(*field)->store("<error>", sizeof("<error>"), scs);
144
(*field)->store(schema.name().c_str(), schema.name().length(), scs);
147
/* DEFAULT_COLLATION_NAME */
148
(*field)->store(schema.collation().c_str(), schema.collation().length(), scs);
58
is_schema_parsed= plugin::StorageEngine::getSchemaDefinition(*schema_iterator, schema);
65
bool SchemasTool::Generator::populate(Field **)
77
A lack of a parsed schema file means we are using defaults.
79
void SchemasTool::Generator::fill()
84
/* DEFAULT_COLLATION_NAME */
86
push(schema.collation());