60
60
typedef message::Table::TableType Type;
61
typedef std::vector <TableIdentifier> vector;
62
typedef const TableIdentifier& const_reference;
63
typedef TableIdentifier& reference;
67
std::vector<char> key_buffer;
77
const char *vector() const
79
return &key_buffer[0];
82
std::vector<char> &vectorPtr()
87
void set(size_t resize_arg, const std::string &a, const std::string &b);
89
friend bool operator==(const Key &left, const Key &right)
91
if (left.hash_value == right.hash_value and left.key_buffer.size() == right.key_buffer.size())
93
if (memcmp(&left.key_buffer[0], &right.key_buffer[0], left.key_buffer.size()) == 0)
100
friend bool operator<(const Key &left, const Key &right)
102
return left.key_buffer < right.key_buffer;
107
return key_buffer.size();
110
size_t getHashValue() const
61
typedef std::vector<char> Key;
120
66
std::string table_name;
122
69
size_t hash_value;
174
static bool isView(message::Table::TableType arg) // Not a SQL view, but a view for I_S
179
case message::Table::STANDARD:
180
case message::Table::TEMPORARY:
181
case message::Table::INTERNAL:
183
case message::Table::FUNCTION:
190
121
bool isView() const // Not a SQL view, but a view for I_S
123
if (type == message::Table::FUNCTION)
195
128
Type getType() const
200
virtual void getSQLPath(std::string &sql_path) const;
133
const std::string &getSQLPath();
202
virtual const std::string &getPath() const;
135
const std::string &getPath() const;
204
137
void setPath(const std::string &new_path)
214
147
void copyToTableMessage(message::Table &message) const;
216
friend bool operator<(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
149
friend bool operator<(const TableIdentifier &left, const TableIdentifier &right)
218
151
if (left.getKey() < right.getKey())
258
191
return output; // for multiple << operators.
261
friend bool operator==(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
194
friend bool operator==(TableIdentifier &left, TableIdentifier &right)
263
if (left.getHashValue() == right.getHashValue())
265
if (left.getKey() == right.getKey())
196
if (left.getKey() == right.getKey())
272
202
static uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);
273
static size_t build_table_filename(std::string &path, const std::string &db, const std::string &table_name, bool is_tmp);
203
static size_t build_table_filename(std::string &buff, const char *db, const char *table_name, bool is_tmp);
274
204
static size_t build_tmptable_filename(std::string &buffer);
275
205
static size_t build_tmptable_filename(std::vector<char> &buffer);
278
bool isValid() const;
208
Create a table cache key
212
key Create key here (must be of size MAX_DBKEY_LENGTH)
213
table_list Table definition
216
The table cache_key is created from:
220
if the table is a tmp table, we add the following to make each tmp table
223
4 bytes for master thread id
224
4 bytes pseudo thread id
229
static uint32_t createKey(char *key, const char *db_arg, const char *table_name_arg)
234
key_pos= strcpy(key_pos, db_arg) + strlen(db_arg);
235
key_pos= strcpy(key_pos+1, table_name_arg) +
236
strlen(table_name_arg);
237
key_length= (uint32_t)(key_pos-key)+1;
242
static uint32_t createKey(char *key, const TableIdentifier &identifier)
247
key_pos= strcpy(key_pos, identifier.getSchemaName().c_str()) + identifier.getSchemaName().length();
248
key_pos= strcpy(key_pos + 1, identifier.getTableName().c_str()) + identifier.getTableName().length();
249
key_length= (uint32_t)(key_pos-key)+1;
280
254
size_t getHashValue() const