43
43
#include <limits.h>
46
#include <drizzled/error.h>
47
#include <drizzled/errmsg_print.h>
48
#include <drizzled/charset_info.h>
49
#include <drizzled/internal/m_string.h>
50
#include <drizzled/internal/my_sys.h>
51
#include <drizzled/my_hash.h>
52
#include <drizzled/plugin.h>
53
#include <drizzled/show.h>
54
#include <drizzled/data_home.h>
55
#include <drizzled/error.h>
56
#include <drizzled/field.h>
57
#include <drizzled/charset.h>
58
#include <drizzled/session.h>
59
#include <drizzled/current_session.h>
60
#include <drizzled/table.h>
61
#include <drizzled/field/blob.h>
62
#include <drizzled/field/varstring.h>
63
#include <drizzled/plugin/xa_storage_engine.h>
64
#include <drizzled/plugin/daemon.h>
65
#include <drizzled/memory/multi_malloc.h>
66
#include <drizzled/pthread_globals.h>
67
#include <drizzled/named_savepoint.h>
46
#include "drizzled/error.h"
47
#include "drizzled/errmsg_print.h"
48
#include "drizzled/charset_info.h"
49
#include "drizzled/internal/m_string.h"
50
#include "drizzled/internal/my_sys.h"
51
#include "drizzled/my_hash.h"
52
#include "drizzled/plugin.h"
53
#include "drizzled/show.h"
54
#include "drizzled/data_home.h"
55
#include "drizzled/error.h"
56
#include "drizzled/field.h"
57
#include "drizzled/charset.h"
58
#include "drizzled/session.h"
59
#include "drizzled/current_session.h"
60
#include "drizzled/table.h"
61
#include "drizzled/field/blob.h"
62
#include "drizzled/field/varstring.h"
63
#include "drizzled/plugin/xa_storage_engine.h"
64
#include "drizzled/plugin/daemon.h"
65
#include "drizzled/memory/multi_malloc.h"
66
#include "drizzled/pthread_globals.h"
67
#include "drizzled/named_savepoint.h"
69
69
#include <drizzled/transaction_services.h>
70
#include <drizzled/message/statement_transform.h>
70
#include "drizzled/message/statement_transform.h"
72
72
#include <boost/algorithm/string.hpp>
73
73
#include <boost/program_options.hpp>
125
125
#include <sstream>
126
126
#include <string>
128
#include <plugin/innobase/handler/status_function.h>
129
#include <plugin/innobase/handler/replication_log.h>
128
#include "plugin/innobase/handler/status_function.h"
129
#include "plugin/innobase/handler/replication_log.h"
131
131
#include <google/protobuf/io/zero_copy_stream.h>
132
132
#include <google/protobuf/io/zero_copy_stream_impl.h>
524
524
CachedDirectory::Entries entries= directory.getEntries();
526
std::string search_string(schema_identifier.getSchemaName());
528
boost::algorithm::to_lower(search_string);
530
if (search_string.compare("data_dictionary") == 0)
532
set_of_identifiers.push_back(identifier::Table(schema_identifier.getSchemaName(), "SYS_REPLICATION_LOG"));
535
526
for (CachedDirectory::Entries::iterator entry_iter= entries.begin();
536
527
entry_iter != entries.end(); ++entry_iter)
962
944
uint64_t trx_id= message.transaction_context().transaction_id();
963
945
uint32_t seg_id= message.segment_id();
964
uint64_t end_timestamp= message.transaction_context().end_timestamp();
965
bool is_end_segment= message.end_segment();
966
trx->log_commit_id= TRUE;
967
ulint error= insert_replication_message(data, message.ByteSize(), trx, trx_id,
968
end_timestamp, is_end_segment, seg_id);
946
ulint error= insert_replication_message(data, message.ByteSize(), trx, trx_id, seg_id);
1181
1159
"Drizzle thread %"PRIu64", query id %"PRIu64", %s, %s, %s ",
1182
1160
static_cast<uint64_t>(in_session->getSessionId()),
1183
1161
static_cast<uint64_t>(in_session->getQueryId()),
1184
getServerHostname().c_str(),
1185
1163
user_identifier->address().c_str(),
1186
1164
user_identifier->username().c_str()
3250
3228
user_session = NULL;
3252
std::string search_string(identifier.getSchemaName());
3253
boost::algorithm::to_lower(search_string);
3230
if (!(share=get_share(identifier.getKeyPath().c_str()))) {
3255
if (search_string.compare("data_dictionary") == 0)
3257
std::string table_name(identifier.getTableName());
3258
boost::algorithm::to_upper(table_name);
3259
if (!(share=get_share(table_name.c_str())))
3266
if (!(share=get_share(identifier.getKeyPath().c_str())))
3272
3235
/* Create buffers for packing the fields of a record. Why
3295
3258
/* Get pointer to a table object in InnoDB dictionary cache */
3296
if (search_string.compare("data_dictionary") == 0)
3298
std::string table_name(identifier.getTableName());
3299
boost::algorithm::to_upper(table_name);
3300
ib_table = dict_table_get(table_name.c_str(), TRUE);
3304
ib_table = dict_table_get(identifier.getKeyPath().c_str(), TRUE);
3259
ib_table = dict_table_get(identifier.getKeyPath().c_str(), TRUE);
3307
3261
if (NULL == ib_table) {
3308
3262
errmsg_printf(error::ERROR, "Cannot find or open table %s from\n"
3328
3282
return(HA_ERR_NO_SUCH_TABLE);
3331
if (ib_table->ibd_file_missing && ! session->doing_tablespace_operation()) {
3285
if (ib_table->ibd_file_missing && !session_tablespace_op(session)) {
3332
3286
errmsg_printf(error::ERROR, "MySQL is trying to open a table handle but "
3333
3287
"the .ibd file for\ntable %s does not exist.\n"
3334
3288
"Have you deleted the .ibd file from the "
6041
5995
const char* stmt;
6042
5996
size_t stmt_len;
6044
std::string search_string(identifier.getSchemaName());
6045
boost::algorithm::to_lower(search_string);
6047
if (search_string.compare("data_dictionary") == 0)
6049
return HA_WRONG_CREATE_OPTION;
6052
5998
if (form.getShare()->sizeFields() > 1000) {
6053
5999
/* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020,
6054
6000
but we play safe here */
6299
6245
does a table copy too. */
6301
6247
if ((create_proto.options().has_auto_increment_value()
6302
|| session.getSqlCommand() == SQLCOM_ALTER_TABLE
6303
|| session.getSqlCommand() == SQLCOM_CREATE_INDEX)
6248
|| session_sql_command(&session) == SQLCOM_ALTER_TABLE
6249
|| session_sql_command(&session) == SQLCOM_CREATE_INDEX)
6304
6250
&& create_proto.options().auto_increment_value() != 0) {
6306
6252
/* Query was one of :
6436
6382
ut_a(identifier.getPath().length() < 1000);
6438
std::string search_string(identifier.getSchemaName());
6439
boost::algorithm::to_lower(search_string);
6441
if (search_string.compare("data_dictionary") == 0)
6443
return HA_ERR_TABLE_READONLY;
6446
6384
/* Get the transaction associated with the current session, or create one
6447
6385
if not yet created */
6488
6426
if (identifier.getType() == message::Table::TEMPORARY)
6490
6428
session.getMessageCache().removeTableMessage(identifier);
6491
ulint sql_command = session.getSqlCommand();
6429
ulint sql_command = session_sql_command(&session);
6493
6431
// If this was the final removal to an alter table then we will need
6494
6432
// to remove the .dfe that was left behind.
8787
8725
finds charset information and returns length of prefix_len characters in the
8788
8726
index field in bytes.
8789
8727
@return number of bytes occupied by the first n characters */
8730
innobase_get_at_most_n_mbchars(
8731
/*===========================*/
8732
ulint charset_id, /*!< in: character set id */
8733
ulint prefix_len, /*!< in: prefix length in bytes of the index
8734
(this has to be divided by mbmaxlen to get the
8735
number of CHARACTERS n in the prefix) */
8736
ulint data_len, /*!< in: length of the string in bytes */
8737
const char* str); /*!< in: character string */
8792
8740
innobase_get_at_most_n_mbchars(