48
49
uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);
49
50
size_t build_table_filename(std::string &buff, const char *db, const char *table_name, bool is_tmp);
52
52
class TableIdentifier
55
typedef message::Table::TableType Type;
57
61
std::string table_name;
59
63
std::string lower_table_name;
60
64
std::string sql_path;
63
69
TableIdentifier( const std::string &db_arg,
64
70
const std::string &table_name_arg,
65
tmp_table_type tmp_arg= STANDARD_TABLE) :
71
Type tmp_arg= message::Table::STANDARD) :
68
table_name(table_name_arg),
70
lower_table_name(table_name_arg),
74
table_name(table_name_arg)
73
std::transform(lower_table_name.begin(), lower_table_name.end(),
74
lower_table_name.begin(), ::tolower);
76
std::transform(lower_db.begin(), lower_db.end(),
77
lower_db.begin(), ::tolower);
80
sql_path.append(table_name);
84
This is only used in scavenging lost tables. Once the temp schema engine goes in, this should go away.
86
TableIdentifier( const char *path_arg ) :
78
TableIdentifier( const std::string &schema_name_arg,
79
const std::string &table_name_arg,
80
const std::string &path_arg ) :
81
type(message::Table::TEMPORARY),
84
table_name(table_name_arg)
94
sql_path.append(table_name);
99
return type == STANDARD_TABLE ? false : true;
90
if (type == message::Table::TEMPORARY || type == message::Table::INTERNAL)
102
const std::string &getSQLPath()
100
const std::string &getSQLPath();
107
102
const std::string &getPath();
104
void setPath(const std::string &new_path)
109
109
const std::string &getDBName() const
134
136
switch (identifier.type) {
137
case message::Table::STANDARD:
136
138
type_str= "standard";
138
case INTERNAL_TMP_TABLE:
140
case message::Table::INTERNAL:
139
141
type_str= "internal";
143
case message::Table::TEMPORARY:
142
144
type_str= "temporary";
144
case SYSTEM_TMP_TABLE:
146
case message::Table::FUNCTION:
147
type_str= "function";
148
151
output << type_str;
153
output << identifier.path;
151
156
return output; // for multiple << operators.
154
friend bool operator==(const TableIdentifier &left, const TableIdentifier &right)
159
friend bool operator==(TableIdentifier &left, TableIdentifier &right)
156
164
if (left.type == right.type)
158
if (left.db == right.db)
166
if (left.lower_db == right.lower_db)
160
if (left.table_name == right.table_name)
168
if (left.lower_table_name == right.lower_table_name)