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;
200
virtual void getSQLPath(std::string &sql_path) const;
147
const std::string &getSQLPath();
202
virtual const std::string &getPath() const;
149
const std::string &getPath() const;
204
151
void setPath(const std::string &new_path)
214
161
void copyToTableMessage(message::Table &message) const;
216
friend bool operator<(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
163
friend bool operator<(const TableIdentifier &left, const TableIdentifier &right)
218
165
if (left.getKey() < right.getKey())
258
205
return output; // for multiple << operators.
261
friend bool operator==(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
208
friend bool operator==(TableIdentifier &left, TableIdentifier &right)
263
210
if (left.getHashValue() == right.getHashValue())
272
219
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);
220
static size_t build_table_filename(std::string &buff, const char *db, const char *table_name, bool is_tmp);
274
221
static size_t build_tmptable_filename(std::string &buffer);
275
222
static size_t build_tmptable_filename(std::vector<char> &buffer);
278
bool isValid() const;
225
Create a table cache key
229
key Create key here (must be of size MAX_DBKEY_LENGTH)
230
table_list Table definition
233
The table cache_key is created from:
237
if the table is a tmp table, we add the following to make each tmp table
240
4 bytes for master thread id
241
4 bytes pseudo thread id
246
static uint32_t createKey(char *key, const char *db_arg, const char *table_name_arg)
251
key_pos= strcpy(key_pos, db_arg) + strlen(db_arg);
252
key_pos= strcpy(key_pos+1, table_name_arg) +
253
strlen(table_name_arg);
254
key_length= (uint32_t)(key_pos-key)+1;
259
static uint32_t createKey(char *key, const TableIdentifier &identifier)
264
key_pos= strcpy(key_pos, identifier.getSchemaName().c_str()) + identifier.getSchemaName().length();
265
key_pos= strcpy(key_pos + 1, identifier.getTableName().c_str()) + identifier.getTableName().length();
266
key_length= (uint32_t)(key_pos-key)+1;
280
271
size_t getHashValue() const