Appropriate error codes numbers

This commit is contained in:
alesapin 2019-10-14 13:04:10 +03:00
parent ecde224692
commit 1ce0eb6e63
7 changed files with 11 additions and 7 deletions

View File

@ -459,9 +459,10 @@ namespace ErrorCodes
extern const int DICTIONARY_ACCESS_DENIED = 482; extern const int DICTIONARY_ACCESS_DENIED = 482;
extern const int TOO_MANY_REDIRECTS = 483; extern const int TOO_MANY_REDIRECTS = 483;
extern const int INTERNAL_REDIS_ERROR = 484; extern const int INTERNAL_REDIS_ERROR = 484;
extern const int CANNOT_GET_CREATE_DICTIONARY_QUERY = 500; extern const int CANNOT_GET_CREATE_DICTIONARY_QUERY = 485;
extern const int DICTIONARY_ALREADY_EXISTS = 501; extern const int DICTIONARY_ALREADY_EXISTS = 486;
extern const int UNKNOWN_DICTIONARY = 502; extern const int UNKNOWN_DICTIONARY = 487;
extern const int EMPTY_LIST_OF_ATTRIBUTES_PASSED = 488;
extern const int KEEPER_EXCEPTION = 999; extern const int KEEPER_EXCEPTION = 999;
extern const int POCO_EXCEPTION = 1000; extern const int POCO_EXCEPTION = 1000;

View File

@ -10,7 +10,6 @@ namespace ErrorCodes
{ {
extern const int CANNOT_GET_CREATE_TABLE_QUERY; extern const int CANNOT_GET_CREATE_TABLE_QUERY;
extern const int CANNOT_GET_CREATE_DICTIONARY_QUERY; extern const int CANNOT_GET_CREATE_DICTIONARY_QUERY;
extern const int NOT_IMPLEMENTED;
} }
DatabaseMemory::DatabaseMemory(String name_) DatabaseMemory::DatabaseMemory(String name_)

View File

@ -41,6 +41,7 @@ namespace ErrorCodes
extern const int CANNOT_CREATE_DICTIONARY_FROM_METADATA; extern const int CANNOT_CREATE_DICTIONARY_FROM_METADATA;
extern const int EMPTY_LIST_OF_COLUMNS_PASSED; extern const int EMPTY_LIST_OF_COLUMNS_PASSED;
extern const int CANNOT_PARSE_TEXT; extern const int CANNOT_PARSE_TEXT;
extern const int EMPTY_LIST_OF_ATTRIBUTES_PASSED;
} }
@ -60,7 +61,7 @@ std::pair<String, DictionaryPtr> createDictionaryFromAST(
ast_create_query.database = database_name; ast_create_query.database = database_name;
if (!ast_create_query.dictionary_attributes_list) if (!ast_create_query.dictionary_attributes_list)
throw Exception("Missing definition of dictionary attributes.", ErrorCodes::EMPTY_LIST_OF_COLUMNS_PASSED); throw Exception("Missing definition of dictionary attributes.", ErrorCodes::EMPTY_LIST_OF_ATTRIBUTES_PASSED);
return return
{ {

View File

@ -25,6 +25,7 @@ namespace ErrorCodes
extern const int TABLE_ALREADY_EXISTS; extern const int TABLE_ALREADY_EXISTS;
extern const int UNKNOWN_TABLE; extern const int UNKNOWN_TABLE;
extern const int LOGICAL_ERROR; extern const int LOGICAL_ERROR;
extern const int DICTIONARY_ALREADY_EXISTS;
} }
bool DatabaseWithOwnTablesBase::isTableExist( bool DatabaseWithOwnTablesBase::isTableExist(
@ -138,7 +139,7 @@ void DatabaseWithOwnTablesBase::attachDictionary(const String & dictionary_name,
{ {
std::lock_guard lock(mutex); std::lock_guard lock(mutex);
if (!dictionaries.emplace(dictionary_name, dictionary).second) if (!dictionaries.emplace(dictionary_name, dictionary).second)
throw Exception("Dictionary " + name + "." + dictionary_name + " already exists.", ErrorCodes::TABLE_ALREADY_EXISTS); throw Exception("Dictionary " + name + "." + dictionary_name + " already exists.", ErrorCodes::DICTIONARY_ALREADY_EXISTS);
} }
void DatabaseWithOwnTablesBase::shutdown() void DatabaseWithOwnTablesBase::shutdown()

View File

@ -52,6 +52,7 @@ DictionaryPtr DictionaryFactory::create(
DictionaryPtr DictionaryFactory::create(const std::string & name, const ASTCreateQuery & ast, const Context & context) const DictionaryPtr DictionaryFactory::create(const std::string & name, const ASTCreateQuery & ast, const Context & context) const
{ {
/// Temporary code for testing TODO(alesapin)
(void)(name); (void)(name);
(void)(ast); (void)(ast);
(void)(context); (void)(context);

View File

@ -34,6 +34,7 @@ public:
const std::string & config_prefix, const std::string & config_prefix,
const Context & context) const; const Context & context) const;
/// Temporary method for testing TODO(alesapin)
DictionaryPtr create(const std::string & name, DictionaryPtr create(const std::string & name,
const ASTCreateQuery & ast, const ASTCreateQuery & ast,
const Context & context) const; const Context & context) const;

View File

@ -74,7 +74,7 @@ SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dic
LIFETIME(MIN 1 MAX 10) LIFETIME(MIN 1 MAX 10)
LAYOUT(FLAT()); LAYOUT(FLAT());
SHOW CREATE DICTIONARY memory_db.dict2; -- {serverError 500} SHOW CREATE DICTIONARY memory_db.dict2; -- {serverError 485}
SHOW DICTIONARIES FROM memory_db LIKE 'dict2'; SHOW DICTIONARIES FROM memory_db LIKE 'dict2';