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/error_dictionary/errors.h>
00024 #include <drizzled/error/sql_state.h>
00025
00026 namespace drizzle_plugin
00027 {
00028
00029 error_dictionary::Errors::Errors() :
00030 drizzled::plugin::TableFunction("DATA_DICTIONARY", "ERRORS")
00031 {
00032 add_field("ERROR_CODE", drizzled::plugin::TableFunction::NUMBER);
00033 add_field("ERROR_NAME");
00034 add_field("ERROR_MESSAGE");
00035 add_field("ERROR_SQL_STATE");
00036 }
00037
00038 error_dictionary::Errors::Generator::Generator(drizzled::Field **arg) :
00039 drizzled::plugin::TableFunction::Generator(arg),
00040 _error_map(drizzled::ErrorMap::get_error_message_map()),
00041 _iter(drizzled::ErrorMap::get_error_message_map().begin())
00042 { }
00043
00044 bool error_dictionary::Errors::Generator::populate()
00045 {
00046 if (_iter == _error_map.end())
00047 return false;
00048
00049 push(uint64_t((*_iter).first));
00050 push((*_iter).second.first);
00051 push((*_iter).second.second);
00052 push(drizzled::error::convert_to_sqlstate((*_iter).first));
00053
00054 ++_iter;
00055
00056 return true;
00057 }
00058
00059 }