13
13
along with this program; if not, write to the Free Software
14
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
18
#define DRIZZLE_LEX 1
20
#include "drizzled/item/num.h"
21
#include "drizzled/abort_exception.h"
22
#include <drizzled/my_hash.h>
20
#include <drizzled/item/num.h>
21
#include <drizzled/abort_exception.h>
23
22
#include <drizzled/error.h>
24
23
#include <drizzled/nested_join.h>
25
24
#include <drizzled/query_id.h>
26
#include "drizzled/transaction_services.h"
25
#include <drizzled/transaction_services.h>
27
26
#include <drizzled/sql_parse.h>
28
27
#include <drizzled/data_home.h>
29
28
#include <drizzled/sql_base.h>
30
29
#include <drizzled/show.h>
31
#include <drizzled/db.h>
32
30
#include <drizzled/function/time/unix_timestamp.h>
33
31
#include <drizzled/function/get_system_var.h>
34
32
#include <drizzled/item/cmpfunc.h>
41
39
#include <drizzled/plugin/client.h>
42
40
#include <drizzled/statement.h>
43
41
#include <drizzled/statement/alter_table.h>
44
#include "drizzled/probes.h"
45
#include "drizzled/global_charset_info.h"
47
#include "drizzled/plugin/logging.h"
48
#include "drizzled/plugin/query_rewrite.h"
49
#include "drizzled/plugin/query_cache.h"
50
#include "drizzled/plugin/authorization.h"
51
#include "drizzled/optimizer/explain_plan.h"
52
#include "drizzled/pthread_globals.h"
53
#include "drizzled/plugin/event_observer.h"
54
#include "drizzled/visibility.h"
42
#include <drizzled/probes.h>
43
#include <drizzled/charset.h>
44
#include <drizzled/plugin/logging.h>
45
#include <drizzled/plugin/query_rewrite.h>
46
#include <drizzled/plugin/query_cache.h>
47
#include <drizzled/plugin/authorization.h>
48
#include <drizzled/optimizer/explain_plan.h>
49
#include <drizzled/pthread_globals.h>
50
#include <drizzled/plugin/event_observer.h>
51
#include <drizzled/display.h>
52
#include <drizzled/visibility.h>
53
#include <drizzled/kill.h>
54
#include <drizzled/schema.h>
55
#include <drizzled/item/subselect.h>
56
#include <drizzled/diagnostics_area.h>
57
#include <drizzled/table_ident.h>
58
#include <drizzled/statistics_variables.h>
59
#include <drizzled/system_variables.h>
60
#include <drizzled/session/times.h>
61
#include <drizzled/session/transactions.h>
56
63
#include <limits.h>
59
66
#include <algorithm>
60
67
#include <boost/date_time.hpp>
61
#include "drizzled/internal/my_sys.h"
68
#include <drizzled/internal/my_sys.h>
63
70
using namespace std;
65
extern int DRIZZLEparse(void *session); // from sql_yacc.cc
72
extern int base_sql_parse(drizzled::Session *session); // from sql_yacc.cc
71
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
77
bool my_yyoverflow(short **a, ParserType **b, ulong *yystacksize);
72
78
static bool parse_sql(Session *session, Lex_input_stream *lip);
73
void parse(Session *session, const char *inBuf, uint32_t length);
79
void parse(Session&, const char *inBuf, uint32_t length);
76
82
@defgroup Runtime_Environment Runtime Environment
122
129
void init_update_queries(void)
126
for (x= 0; x <= SQLCOM_END; x++)
131
for (uint32_t x= uint32_t(SQLCOM_SELECT);
132
x <= uint32_t(SQLCOM_END); x++)
127
134
sql_command_flags[x].reset();
129
137
sql_command_flags[SQLCOM_CREATE_TABLE]= CF_CHANGES_DATA;
130
138
sql_command_flags[SQLCOM_CREATE_INDEX]= CF_CHANGES_DATA;
177
185
1 request of thread shutdown, i. e. if command is
178
186
COM_QUIT/COM_SHUTDOWN
180
bool dispatch_command(enum enum_server_command command, Session *session,
181
char* packet, uint32_t packet_length)
188
bool dispatch_command(enum_server_command command, Session *session,
189
const char* packet, uint32_t packet_length)
184
192
Query_id &query_id= Query_id::get_query_id();
186
194
DRIZZLE_COMMAND_START(session->thread_id, command);
188
196
session->command= command;
189
session->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
197
session->lex().sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
198
session->times.set_time();
191
199
session->setQueryId(query_id.value());
194
203
/* Ignore these statements. */
197
207
/* Increase id and count all other statements. */
199
209
session->status_var.questions++;
203
/* @todo set session->lex->sql_command to SQLCOM_END here */
213
/* @todo set session->lex().sql_command to SQLCOM_END here */
205
215
plugin::Logging::preDo(session);
206
216
if (unlikely(plugin::EventObserver::beforeStatement(*session)))
211
221
session->server_status&=
212
222
~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
216
if (packet_length == 0)
218
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
228
if (packet_length == 0)
230
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
233
if (not schema::change(*session, identifier::Schema(string(packet, packet_length))))
222
string tmp(packet, packet_length);
224
identifier::Schema identifier(tmp);
226
if (not change_db(session, identifier))
234
if (not session->readAndStoreQuery(packet, packet_length))
235
break; // fatal error is set
236
DRIZZLE_QUERY_START(session->getQueryString()->c_str(),
238
const_cast<const char *>(session->schema()->c_str()));
240
parse(session, session->getQueryString()->c_str(), session->getQueryString()->length());
242
session->readAndStoreQuery(packet, packet_length);
243
DRIZZLE_QUERY_START(session->getQueryString()->c_str(), session->thread_id, session->schema()->c_str());
244
parse(*session, session->getQueryString()->c_str(), session->getQueryString()->length());
245
249
/* We don't calculate statistics for this command */
246
session->main_da.disable_status(); // Don't send anything back
247
error=true; // End server
250
session->main_da().disable_status(); // Don't send anything back
251
error= true; // End server
256
if (packet_length != 4)
258
my_error(ER_NO_SUCH_THREAD, MYF(0), 0);
264
memcpy(&kill_id, packet, sizeof(uint32_t));
266
kill_id= ntohl(kill_id);
267
(void)drizzled::kill(*session->user(), kill_id, true);
249
273
case COM_SHUTDOWN:
251
session->status_var.com_other++;
253
session->close_thread_tables(); // Free before kill
275
session->status_var.com_other++;
277
session->close_thread_tables(); // Free before kill
259
284
session->status_var.com_other++;
260
285
session->my_ok(); // Tell client we are alive
263
289
case COM_CONNECT: // Impossible here
270
296
/* If commit fails, we should be able to reset the OK status. */
271
session->main_da.can_overwrite_status= true;
272
TransactionServices &transaction_services= TransactionServices::singleton();
273
transaction_services.autocommitOrRollback(*session, session->is_error());
274
session->main_da.can_overwrite_status= false;
297
session->main_da().can_overwrite_status= true;
298
TransactionServices::autocommitOrRollback(*session, session->is_error());
299
session->main_da().can_overwrite_status= false;
276
301
session->transaction.stmt.reset();
291
316
/* Can not be true, but do not take chances in production. */
292
assert(! session->main_da.is_sent);
317
assert(! session->main_da().is_sent);
294
switch (session->main_da.status())
319
switch (session->main_da().status())
296
321
case Diagnostics_area::DA_ERROR:
297
322
/* The query failed, send error to log and abort bootstrap. */
298
session->getClient()->sendError(session->main_da.sql_errno(),
299
session->main_da.message());
323
session->getClient()->sendError(session->main_da().sql_errno(),
324
session->main_da().message());
302
327
case Diagnostics_area::DA_EOF:
374
399
1 out of memory or SHOW commands are not allowed
375
400
in this version of the server.
377
static bool _schema_select(Session *session, Select_Lex *sel,
378
const string& schema_table_name)
402
static bool _schema_select(Session& session, Select_Lex& sel, const string& schema_table_name)
380
404
LEX_STRING db, table;
381
405
bitset<NUM_OF_TABLE_OPTIONS> table_options;
383
407
We have to make non const db_name & table_name
384
408
because of lower_case_table_names
386
session->make_lex_string(&db, "data_dictionary", sizeof("data_dictionary"), false);
387
session->make_lex_string(&table, schema_table_name, false);
389
if (! sel->add_table_to_list(session, new Table_ident(db, table),
390
NULL, table_options, TL_READ))
410
session.make_lex_string(&db, "data_dictionary", sizeof("data_dictionary"), false);
411
session.make_lex_string(&table, schema_table_name, false);
412
return not sel.add_table_to_list(&session, new Table_ident(db, table), NULL, table_options, TL_READ);
397
int prepare_new_schema_table(Session *session, LEX *lex,
398
const string& schema_table_name)
415
int prepare_new_schema_table(Session *session, LEX& lex0, const string& schema_table_name)
400
Select_Lex *schema_select_lex= NULL;
402
Select_Lex *select_lex= lex->current_select;
404
if (_schema_select(session, select_lex, schema_table_name))
408
TableList *table_list= (TableList*) select_lex->table_list.first;
410
table_list->schema_select_lex= schema_select_lex;
417
Select_Lex& lex= *lex0.current_select;
418
if (_schema_select(*session, lex, schema_table_name))
420
TableList *table_list= (TableList*)lex.table_list.first;
421
table_list->schema_select_lex= NULL;
466
477
assert(first_table == all_tables);
467
478
assert(first_table == all_tables && first_table != 0);
469
lex->first_lists_tables_same();
480
session->lex().first_lists_tables_same();
470
482
/* should be assigned after making first tables same */
471
all_tables= lex->query_tables;
483
all_tables= session->lex().query_tables;
472
485
/* set context for commands which do not use setup_tables */
474
context.resolve_in_table_list_only((TableList*)select_lex->
486
select_lex->context.resolve_in_table_list_only((TableList*)select_lex->table_list.first);
478
489
Reset warning count for each query that uses tables
481
492
variables, but for now this is probably good enough.
482
493
Don't reset warnings when executing a stored routine.
484
if (all_tables || ! lex->is_single_level_stmt())
495
if (all_tables || ! session->lex().is_single_level_stmt())
486
drizzle_reset_errors(session, 0);
497
drizzle_reset_errors(*session, 0);
489
assert(session->transaction.stmt.hasModifiedNonTransData() == false);
500
assert(not session->transaction.stmt.hasModifiedNonTransData());
491
502
if (! (session->server_status & SERVER_STATUS_AUTOCOMMIT)
492
503
&& ! session->inTransaction()
493
&& lex->statement->isTransactional())
504
&& session->lex().statement->isTransactional())
495
if (session->startTransaction() == false)
506
if (not session->startTransaction())
497
508
my_error(drizzled::ER_UNKNOWN_ERROR, MYF(0));
550
561
to prepend EXPLAIN to any query and receive output for it,
551
562
even if the query itself redirects the output.
553
if (!(result= new select_send()))
564
result= new select_send();
555
565
session->send_explain_fields(result);
556
566
optimizer::ExplainPlan planner;
557
res= planner.explainUnion(session, &session->lex->unit, result);
567
res= planner.explainUnion(session, &session->lex().unit, result);
558
568
if (lex->describe & DESCRIBE_EXTENDED)
561
571
String str(buff,(uint32_t) sizeof(buff), system_charset_info);
563
session->lex->unit.print(&str, QT_ORDINARY);
573
session->lex().unit.print(&str);
564
574
str.append('\0');
565
575
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
566
576
ER_YES, str.ptr());
571
581
result->send_eof();
576
if (!result && !(result= new select_send()))
588
result= new select_send();
579
590
/* Init the Query Cache plugin */
580
plugin::QueryCache::prepareResultset(session);
591
plugin::QueryCache::prepareResultset(session);
581
592
res= handle_select(session, lex, result, 0);
582
593
/* Send the Resultset to the cache */
583
plugin::QueryCache::setResultset(session);
594
plugin::QueryCache::setResultset(session);
585
596
if (result != lex->result)
593
604
#define MY_YACC_INIT 1000 // Start with big alloc
594
605
#define MY_YACC_MAX 32000 // Because of 'short'
596
bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
607
bool my_yyoverflow(short **yyss, ParserType **yyvs, ulong *yystacksize)
598
LEX *lex= current_session->lex;
609
LEX *lex= ¤t_session->lex();
599
610
ulong old_info=0;
600
611
if ((uint32_t) *yystacksize >= MY_YACC_MAX)
641
new_select(LEX *lex, bool move_down)
651
bool new_select(LEX *lex, bool move_down)
643
Select_Lex *select_lex;
644
Session *session= lex->session;
646
if (!(select_lex= new (session->mem_root) Select_Lex()))
653
Session* session= lex->session;
654
Select_Lex* select_lex= new (session->mem_root) Select_Lex;
649
656
select_lex->select_number= ++session->select_number;
650
657
select_lex->parent_lex= lex; /* Used in init_query. */
655
662
if (lex->nest_level > (int) MAX_SELECT_NESTING)
657
664
my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING);
661
668
select_lex->nest_level= lex->nest_level;
664
Select_Lex_Unit *unit;
665
671
/* first select_lex of subselect or derived table */
666
if (!(unit= new (session->mem_root) Select_Lex_Unit()))
672
Select_Lex_Unit* unit= new (session->mem_root) Select_Lex_Unit();
669
674
unit->init_query();
670
675
unit->init_select();
723
728
void create_select_for_variable(Session *session, const char *var_name)
726
LEX_STRING tmp, null_lex_string;
728
char buff[MAX_SYS_VAR_LENGTH*2+4+8];
733
lex->sql_command= SQLCOM_SELECT;
730
LEX& lex= session->lex();
732
lex.sql_command= SQLCOM_SELECT;
734
734
tmp.str= (char*) var_name;
735
735
tmp.length=strlen(var_name);
736
LEX_STRING null_lex_string;
736
737
memset(&null_lex_string.str, 0, sizeof(null_lex_string));
738
739
We set the name of Item to @@session.var_name because that then is used
739
740
as the column name in the output.
741
if ((var= get_system_var(session, OPT_SESSION, tmp, null_lex_string)))
742
if (Item* var= get_system_var(session, OPT_SESSION, tmp, null_lex_string))
744
char buff[MAX_SYS_VAR_LENGTH*2+4+8];
743
746
end+= snprintf(buff, sizeof(buff), "@@session.%s", var_name);
744
747
var->set_name(buff, end-buff, system_charset_info);
745
748
session->add_item_to_list(var);
755
758
@param length Length of the query text
758
void parse(Session *session, const char *inBuf, uint32_t length)
761
void parse(Session& session, const char *inBuf, uint32_t length)
760
session->lex->start(session);
762
session->reset_for_next_command();
763
session.lex().start(&session);
764
session.reset_for_next_command();
763
765
/* Check if the Query is Cached if and return true if yes
764
766
* TODO the plugin has to make sure that the query is cacheble
765
767
* by setting the query_safe_cache param to TRUE
768
if (plugin::QueryCache::isCached(session))
770
res= plugin::QueryCache::sendCachedResultset(session);
776
LEX *lex= session->lex;
777
Lex_input_stream lip(session, inBuf, length);
778
bool err= parse_sql(session, &lip);
782
if (not session->is_error())
784
DRIZZLE_QUERY_EXEC_START(session->getQueryString()->c_str(),
786
const_cast<const char *>(session->schema()->c_str()));
787
// Implement Views here --Brian
788
/* Actually execute the query */
791
execute_command(session);
795
// Just try to catch any random failures that could have come
799
DRIZZLE_QUERY_EXEC_DONE(0);
805
assert(session->is_error());
808
session->set_proc_info("freeing items");
809
session->end_statement();
810
session->cleanup_after_query();
811
session->set_end_timer();
769
if (plugin::QueryCache::isCached(&session) && not plugin::QueryCache::sendCachedResultset(&session))
771
Lex_input_stream lip(&session, inBuf, length);
772
if (parse_sql(&session, &lip))
773
assert(session.is_error());
774
else if (not session.is_error())
776
DRIZZLE_QUERY_EXEC_START(session.getQueryString()->c_str(), session.thread_id,
777
const_cast<const char *>(session.schema()->c_str()));
778
// Implement Views here --Brian
779
/* Actually execute the query */
782
execute_command(&session);
786
// Just try to catch any random failures that could have come
790
DRIZZLE_QUERY_EXEC_DONE(0);
792
session.lex().unit.cleanup();
793
session.set_proc_info("freeing items");
794
session.end_statement();
795
session.cleanup_after_query();
796
session.times.set_end_timer(session);
817
801
Store field definition for create.
827
811
Item *default_value, Item *on_update_value,
828
812
LEX_STRING *comment,
830
List<String> *interval_list, const CHARSET_INFO * const cs)
814
List<String> *interval_list, const charset_info_st * const cs)
832
816
register CreateField *new_field;
833
LEX *lex= session->lex;
817
LEX *lex= &session->lex();
834
818
statement::AlterTable *statement= (statement::AlterTable *)lex->statement;
836
820
if (check_identifier_name(field_name, ER_TOO_LONG_IDENT))
898
if (!(new_field= new CreateField()) ||
899
new_field->init(session, field_name->str, type, length, decimals, type_modifier,
900
default_value, on_update_value, comment, change,
901
interval_list, cs, 0, column_format))
882
new_field= new CreateField;
883
if (new_field->init(session, field_name->str, type, length, decimals,
884
type_modifier, comment, change, interval_list, cs, 0, column_format)
885
|| new_field->setDefaultValue(default_value, on_update_value))
904
888
statement->alter_info.create_list.push_back(new_field);
953
if (table->is_derived_table() == false && table->db.str)
936
if (not table->is_derived_table() && table->db.str)
955
938
my_casedn_str(files_charset_info, table->db.str);
957
940
identifier::Schema schema_identifier(string(table->db.str));
958
if (not check_db_name(session, schema_identifier))
941
if (not schema::check(*session, schema_identifier))
961
944
my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
971
954
ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
974
if (!(alias_str= (char*) session->getMemRoot()->duplicate(alias_str,table->table.length+1)))
957
alias_str= (char*) session->mem.memdup(alias_str,table->table.length+1);
977
if (!(ptr = (TableList *) session->calloc(sizeof(TableList))))
959
TableList *ptr = (TableList *) session->mem.calloc(sizeof(TableList));
980
961
if (table->db.str)
1072
bool Select_Lex::init_nested_join(Session *session)
1053
void Select_Lex::init_nested_join(Session& session)
1075
NestedJoin *nested_join;
1077
if (!(ptr= (TableList*) session->calloc(ALIGN_SIZE(sizeof(TableList))+
1078
sizeof(NestedJoin))))
1055
TableList* ptr= (TableList*) session.mem.calloc(ALIGN_SIZE(sizeof(TableList)) + sizeof(NestedJoin));
1080
1056
ptr->setNestedJoin(((NestedJoin*) ((unsigned char*) ptr + ALIGN_SIZE(sizeof(TableList)))));
1081
nested_join= ptr->getNestedJoin();
1057
NestedJoin* nested_join= ptr->getNestedJoin();
1082
1058
join_list->push_front(ptr);
1083
1059
ptr->setEmbedding(embedding);
1084
1060
ptr->setJoinList(join_list);
1085
1061
ptr->alias= (char*) "(nested_join)";
1086
1062
embedding= ptr;
1087
1063
join_list= &nested_join->join_list;
1114
1089
join_list= ptr->getJoinList();
1115
1090
embedding= ptr->getEmbedding();
1116
1091
nested_join= ptr->getNestedJoin();
1117
if (nested_join->join_list.elements == 1)
1092
if (nested_join->join_list.size() == 1)
1119
TableList *embedded= nested_join->join_list.head();
1094
TableList *embedded= &nested_join->join_list.front();
1120
1095
join_list->pop();
1121
1096
embedded->setJoinList(join_list);
1122
1097
embedded->setEmbedding(embedding);
1123
1098
join_list->push_front(embedded);
1126
else if (nested_join->join_list.elements == 0)
1101
else if (nested_join->join_list.size() == 0)
1128
1103
join_list->pop();
1129
1104
ptr= NULL; // return value
1148
1123
TableList *Select_Lex::nest_last_join(Session *session)
1151
NestedJoin *nested_join;
1152
List<TableList> *embedded_list;
1154
if (!(ptr= (TableList*) session->calloc(ALIGN_SIZE(sizeof(TableList))+
1155
sizeof(NestedJoin))))
1125
TableList* ptr= (TableList*) session->mem.calloc(ALIGN_SIZE(sizeof(TableList)) + sizeof(NestedJoin));
1157
1126
ptr->setNestedJoin(((NestedJoin*) ((unsigned char*) ptr + ALIGN_SIZE(sizeof(TableList)))));
1158
nested_join= ptr->getNestedJoin();
1127
NestedJoin* nested_join= ptr->getNestedJoin();
1159
1128
ptr->setEmbedding(embedding);
1160
1129
ptr->setJoinList(join_list);
1161
1130
ptr->alias= (char*) "(nest_last_join)";
1162
embedded_list= &nested_join->join_list;
1163
embedded_list->empty();
1131
List<TableList>* embedded_list= &nested_join->join_list;
1132
embedded_list->clear();
1165
1134
for (uint32_t i=0; i < 2; i++)
1303
1272
Select_Lex *first_sl= first_select();
1304
1273
assert(!fake_select_lex);
1306
if (!(fake_select_lex= new (session_arg->mem_root) Select_Lex()))
1308
fake_select_lex->include_standalone(this,
1309
(Select_Lex_Node**)&fake_select_lex);
1275
fake_select_lex= new (session_arg->mem_root) Select_Lex();
1276
fake_select_lex->include_standalone(this, (Select_Lex_Node**)&fake_select_lex);
1310
1277
fake_select_lex->select_number= INT_MAX;
1311
fake_select_lex->parent_lex= session_arg->lex; /* Used in init_query. */
1278
fake_select_lex->parent_lex= &session_arg->lex(); /* Used in init_query. */
1312
1279
fake_select_lex->make_empty_select();
1313
1280
fake_select_lex->linkage= GLOBAL_OPTIONS_TYPE;
1314
1281
fake_select_lex->select_limit= 0;
1354
1321
true if a memory allocation error occured
1358
push_new_name_resolution_context(Session *session,
1359
TableList *left_op, TableList *right_op)
1324
void push_new_name_resolution_context(Session& session, TableList& left_op, TableList& right_op)
1361
Name_resolution_context *on_context;
1362
if (!(on_context= new (session->mem_root) Name_resolution_context))
1326
Name_resolution_context *on_context= new (session.mem_root) Name_resolution_context;
1364
1327
on_context->init();
1365
on_context->first_name_resolution_table=
1366
left_op->first_leaf_for_name_resolution();
1367
on_context->last_name_resolution_table=
1368
right_op->last_leaf_for_name_resolution();
1369
return session->lex->push_context(on_context);
1328
on_context->first_name_resolution_table= left_op.first_leaf_for_name_resolution();
1329
on_context->last_name_resolution_table= right_op.last_leaf_for_name_resolution();
1330
session.lex().push_context(on_context);
1517
1477
bool update_precheck(Session *session, TableList *)
1519
1479
const char *msg= 0;
1520
LEX *lex= session->lex;
1521
Select_Lex *select_lex= &lex->select_lex;
1480
Select_Lex *select_lex= &session->lex().select_lex;
1523
if (session->lex->select_lex.item_list.elements != session->lex->value_list.elements)
1482
if (session->lex().select_lex.item_list.size() != session->lex().value_list.size())
1525
1484
my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
1529
if (session->lex->select_lex.table_list.elements > 1)
1488
if (session->lex().select_lex.table_list.size() > 1)
1531
if (select_lex->order_list.elements)
1490
if (select_lex->order_list.size())
1532
1491
msg= "ORDER BY";
1533
1492
else if (select_lex->select_limit)
1537
1496
my_error(ER_WRONG_USAGE, MYF(0), "UPDATE", msg);
1557
1516
bool insert_precheck(Session *session, TableList *)
1559
LEX *lex= session->lex;
1562
1519
Check that we have modify privileges for the first table and
1563
1520
select privileges for the rest
1565
if (lex->update_list.elements != lex->value_list.elements)
1522
if (session->lex().update_list.size() != session->lex().value_list.size())
1567
1524
my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
1647
1604
so they should be prohibited until such support is done.
1648
1605
This is why we use the 3-byte utf8 to check well-formedness here.
1650
const CHARSET_INFO * const cs= &my_charset_utf8mb4_general_ci;
1607
const charset_info_st * const cs= &my_charset_utf8mb4_general_ci;
1652
1609
int well_formed_error;
1653
1610
uint32_t res= cs->cset->well_formed_len(cs, str->str, str->str + str->length,