tinySQL  0.1
A self-contained database management system
err_type.h
1 #ifndef ERR_TYPE_H
2 #define ERR_TYPE_H
3 
4 #include <set>
9 enum db_err_t{
10  DB_SUCCESS = 0,
11  DB_FAILED,
12  DB_TABLE_ALREADY_EXIST,
13  DB_TABLE_NOT_EXIST,
14  DB_INDEX_ALREADY_EXIST,
15  DB_INDEX_NOT_FOUND,
16  DB_COLUMN_NAME_NOT_EXIST,
17  DB_KEY_NOT_FOUND,
18  DB_FILE_NOT_FOUND,
19  DB_ALL_PAGES_PINNED,
20  DB_TYPE_ERR,
21  DB_OPERANDS_MISMATCH,
22  DB_TUPLE_TYPE_CONFLICT,
23  DB_PRIMARY_KEY_CONFLICT,
24  DB_UNIQUE_CONFLICT,
25  DB_ATTRIBUTE_NOT_EXIST,
26  DB_BPTREE_EMPTY
27 };
28 
29 const std::map<db_err_t, std::string> ERR_STR_MAP {
30  {DB_FAILED, "DB_FAILED"},
31  {DB_TABLE_ALREADY_EXIST, "DB_TABLE_ALREADY_EXIST"},
32  {DB_TABLE_NOT_EXIST, "DB_TABLE_NOT_EXIST"},
33  {DB_INDEX_ALREADY_EXIST, "DB_INDEX_ALREADY_EXIST"},
34  {DB_INDEX_NOT_FOUND, "DB_INDEX_NOT_FOUND"},
35  {DB_COLUMN_NAME_NOT_EXIST, "DB_COLUMN_NAME_NOT_EXIST"},
36  {DB_KEY_NOT_FOUND, "DB_KEY_NOT_FOUND"},
37  {DB_FILE_NOT_FOUND, "DB_FILE_NOT_FOUND"},
38  {DB_ALL_PAGES_PINNED, "DB_ALL_PAGES_PINNED"},
39  {DB_TYPE_ERR, "DB_TYPE_ERR"},
40  {DB_OPERANDS_MISMATCH, "DB_OPERANDS_MISMATCH"},
41  {DB_TUPLE_TYPE_CONFLICT, "DB_TUPLE_TYPE_CONFLICT"},
42  {DB_PRIMARY_KEY_CONFLICT, "DB_PRIMARY_KEY_CONFLICT"},
43  {DB_UNIQUE_CONFLICT, "DB_UNIQUE_CONFLICT"},
44  {DB_ATTRIBUTE_NOT_EXIST, "DB_UNIQUE_CONFLICT"},
45  {DB_BPTREE_EMPTY, "DB_BPTREE_EMPTY"}
46 };
47 
48 #endif