~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/sql_parse.cc

  • Committer: Monty Taylor
  • Date: 2008-07-05 11:38:34 UTC
  • mfrom: (60 drizzle)
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: monty@inaugust.com-20080705113834-23bn0884hk8pqfu9
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
      error=1;
108
108
  }
109
109
  thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
110
 
  thd->transaction.all.modified_non_trans_table= FALSE;
 
110
  thd->transaction.all.modified_non_trans_table= false;
111
111
  DBUG_RETURN(error);
112
112
}
113
113
 
448
448
    thd->server_status&= ~SERVER_STATUS_IN_TRANS;
449
449
    res= ha_commit(thd);
450
450
    thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
451
 
    thd->transaction.all.modified_non_trans_table= FALSE;
 
451
    thd->transaction.all.modified_non_trans_table= false;
452
452
    break;
453
453
  case COMMIT_RELEASE:
454
454
    do_release= 1; /* fall through */
466
466
    if (ha_rollback(thd))
467
467
      res= -1;
468
468
    thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
469
 
    thd->transaction.all.modified_non_trans_table= FALSE;
 
469
    thd->transaction.all.modified_non_trans_table= false;
470
470
    if (!res && (completion == ROLLBACK_AND_CHAIN))
471
471
      res= begin_trans(thd);
472
472
    break;
545
545
 
546
546
    if (net->error != 3)
547
547
    {
548
 
      return_value= TRUE;                       // We have to close it.
 
548
      return_value= true;                       // We have to close it.
549
549
      goto out;
550
550
    }
551
551
 
552
552
    net->error= 0;
553
 
    return_value= FALSE;
 
553
    return_value= false;
554
554
    goto out;
555
555
  }
556
556
 
602
602
  @see mysql_execute_command
603
603
 
604
604
  @returns Status code
605
 
    @retval TRUE The statement should be denied.
606
 
    @retval FALSE The statement isn't updating any relevant tables.
 
605
    @retval true The statement should be denied.
 
606
    @retval false The statement isn't updating any relevant tables.
607
607
*/
608
608
 
609
609
static my_bool deny_updates_if_read_only_option(THD *thd,
612
612
  DBUG_ENTER("deny_updates_if_read_only_option");
613
613
 
614
614
  if (!opt_readonly)
615
 
    DBUG_RETURN(FALSE);
 
615
    DBUG_RETURN(false);
616
616
 
617
617
  LEX *lex= thd->lex;
618
618
 
619
619
  if (!(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA))
620
 
    DBUG_RETURN(FALSE);
 
620
    DBUG_RETURN(false);
621
621
 
622
622
  /* Multi update is an exception and is dealt with later. */
623
623
  if (lex->sql_command == SQLCOM_UPDATE_MULTI)
624
 
    DBUG_RETURN(FALSE);
 
624
    DBUG_RETURN(false);
625
625
 
626
626
  const my_bool create_temp_tables= 
627
627
    (lex->sql_command == SQLCOM_CREATE_TABLE) &&
645
645
      /*
646
646
        An attempt was made to modify one or more non-temporary tables.
647
647
      */
648
 
      DBUG_RETURN(TRUE);
 
648
      DBUG_RETURN(true);
649
649
  }
650
650
 
651
651
 
652
652
  /* Assuming that only temporary tables are modified. */
653
 
  DBUG_RETURN(FALSE);
 
653
  DBUG_RETURN(false);
654
654
}
655
655
 
656
656
/**
687
687
    Commands which always take a long time are logged into
688
688
    the slow log only if opt_log_slow_admin_statements is set.
689
689
  */
690
 
  thd->enable_slow_log= TRUE;
 
690
  thd->enable_slow_log= true;
691
691
  thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
692
692
  thd->set_time();
693
693
  VOID(pthread_mutex_lock(&LOCK_thread_count));
723
723
    status_var_increment(thd->status_var.com_stat[SQLCOM_CHANGE_DB]);
724
724
    thd->convert_string(&tmp, system_charset_info,
725
725
                        packet, packet_length, thd->charset());
726
 
    if (!mysql_change_db(thd, &tmp, FALSE))
 
726
    if (!mysql_change_db(thd, &tmp, false))
727
727
    {
728
728
      general_log_write(thd, command, thd->db, thd->db_length);
729
729
      my_ok(thd);
819
819
    /* Clear variables that are allocated */
820
820
    thd->user_connect= 0;
821
821
    thd->security_ctx->priv_user= thd->security_ctx->user;
822
 
    res= check_user(thd, COM_CHANGE_USER, passwd, passwd_len, db, FALSE);
 
822
    res= check_user(thd, COM_CHANGE_USER, passwd, passwd_len, db, false);
823
823
 
824
824
    if (res)
825
825
    {
981
981
    general_log_print(thd, command, NullS);
982
982
    net->error=0;                               // Don't give 'abort' message
983
983
    thd->main_da.disable_status();              // Don't send anything back
984
 
    error=TRUE;                                 // End server
 
984
    error=true;                                 // End server
985
985
    break;
986
986
  case COM_BINLOG_DUMP:
987
987
    {
1004
1004
      mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
1005
1005
      unregister_slave(thd,1,1);
1006
1006
      /*  fake COM_QUIT -- if we get here, the thread needs to terminate */
1007
 
      error = TRUE;
 
1007
      error = true;
1008
1008
      break;
1009
1009
    }
1010
1010
  case COM_SHUTDOWN:
1030
1030
    my_eof(thd);
1031
1031
    close_thread_tables(thd);                   // Free before kill
1032
1032
    kill_mysql();
1033
 
    error=TRUE;
 
1033
    error=true;
1034
1034
    break;
1035
1035
  }
1036
1036
  case COM_STATISTICS:
1121
1121
  }
1122
1122
 
1123
1123
  /* If commit fails, we should be able to reset the OK status. */
1124
 
  thd->main_da.can_overwrite_status= TRUE;
 
1124
  thd->main_da.can_overwrite_status= true;
1125
1125
  ha_autocommit_or_rollback(thd, thd->is_error());
1126
 
  thd->main_da.can_overwrite_status= FALSE;
 
1126
  thd->main_da.can_overwrite_status= false;
1127
1127
 
1128
1128
  thd->transaction.stmt.reset();
1129
1129
 
1306
1306
  - query_length
1307
1307
 
1308
1308
  @retval
1309
 
    FALSE ok
 
1309
    false ok
1310
1310
  @retval
1311
 
    TRUE  error;  In this case thd->fatal_error is set
 
1311
    true  error;  In this case thd->fatal_error is set
1312
1312
*/
1313
1313
 
1314
1314
bool alloc_query(THD *thd, const char *packet, uint packet_length)
1331
1331
  if (!(thd->query= (char*) thd->memdup_w_gap((uchar*) (packet),
1332
1332
                                              packet_length,
1333
1333
                                              thd->db_length+ 1)))
1334
 
    return TRUE;
 
1334
    return true;
1335
1335
  thd->query[packet_length]=0;
1336
1336
  thd->query_length= packet_length;
1337
1337
 
1339
1339
  thd->packet.shrink(thd->variables.net_buffer_length);
1340
1340
  thd->convert_buffer.shrink(thd->variables.net_buffer_length);
1341
1341
 
1342
 
  return FALSE;
 
1342
  return false;
1343
1343
}
1344
1344
 
1345
1345
static void reset_one_shot_variables(THD *thd) 
1385
1385
    - SUSPEND and FOR MIGRATE are not supported yet. TODO
1386
1386
 
1387
1387
  @retval
1388
 
    FALSE       OK
 
1388
    false       OK
1389
1389
  @retval
1390
 
    TRUE        Error
 
1390
    true        Error
1391
1391
*/
1392
1392
 
1393
1393
int
1394
1394
mysql_execute_command(THD *thd)
1395
1395
{
1396
 
  int res= FALSE;
1397
 
  bool need_start_waiting= FALSE; // have protection against global read lock
 
1396
  int res= false;
 
1397
  bool need_start_waiting= false; // have protection against global read lock
1398
1398
  int  up_result= 0;
1399
1399
  LEX  *lex= thd->lex;
1400
1400
  /* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
1498
1498
  } /* endif unlikely slave */
1499
1499
  status_var_increment(thd->status_var.com_stat[lex->sql_command]);
1500
1500
 
1501
 
  DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE);
 
1501
  DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == false);
1502
1502
  
1503
1503
  switch (lex->sql_command) {
1504
1504
  case SQLCOM_SHOW_STATUS:
1597
1597
    res= mysql_assign_to_keycache(thd, first_table, &lex->ident);
1598
1598
    break;
1599
1599
  }
1600
 
  case SQLCOM_PRELOAD_KEYS:
1601
 
  {
1602
 
    DBUG_ASSERT(first_table == all_tables && first_table != 0);
1603
 
    res = mysql_preload_keys(thd, first_table);
1604
 
    break;
1605
 
  }
1606
1600
  case SQLCOM_CHANGE_MASTER:
1607
1601
  {
1608
1602
    pthread_mutex_lock(&LOCK_active_mi);
1744
1738
      if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
1745
1739
      {
1746
1740
        lex->link_first_table_back(create_table, link_to_local);
1747
 
        create_table->create= TRUE;
 
1741
        create_table->create= true;
1748
1742
      }
1749
1743
 
1750
1744
      if (!(res= open_and_lock_tables(thd, lex->query_tables)))
2010
2004
      /*
2011
2005
        Presumably, REPAIR and binlog writing doesn't require synchronization
2012
2006
      */
2013
 
      write_bin_log(thd, TRUE, thd->query, thd->query_length);
 
2007
      write_bin_log(thd, true, thd->query, thd->query_length);
2014
2008
    }
2015
2009
    select_lex->table_list.first= (uchar*) first_table;
2016
2010
    lex->query_tables=all_tables;
2036
2030
      /*
2037
2031
        Presumably, ANALYZE and binlog writing doesn't require synchronization
2038
2032
      */
2039
 
      write_bin_log(thd, TRUE, thd->query, thd->query_length);
 
2033
      write_bin_log(thd, true, thd->query, thd->query_length);
2040
2034
    }
2041
2035
    select_lex->table_list.first= (uchar*) first_table;
2042
2036
    lex->query_tables=all_tables;
2056
2050
      /*
2057
2051
        Presumably, OPTIMIZE and binlog writing doesn't require synchronization
2058
2052
      */
2059
 
      write_bin_log(thd, TRUE, thd->query, thd->query_length);
 
2053
      write_bin_log(thd, true, thd->query, thd->query_length);
2060
2054
    }
2061
2055
    select_lex->table_list.first= (uchar*) first_table;
2062
2056
    lex->query_tables=all_tables;
2285
2279
    res = mysql_delete(thd, all_tables, select_lex->where,
2286
2280
                       &select_lex->order_list,
2287
2281
                       unit->select_limit_cnt, select_lex->options,
2288
 
                       FALSE);
 
2282
                       false);
2289
2283
    break;
2290
2284
  }
2291
2285
  case SQLCOM_DELETE_MULTI:
2305
2299
    if ((res= multi_delete_precheck(thd, all_tables)))
2306
2300
      break;
2307
2301
 
2308
 
    /* condition will be TRUE on SP re-excuting */
 
2302
    /* condition will be true on SP re-excuting */
2309
2303
    if (select_lex->item_list.elements != 0)
2310
2304
      select_lex->item_list.empty();
2311
2305
    if (add_item_to_list(thd, new Item_null()))
2338
2332
      delete del_result;
2339
2333
    }
2340
2334
    else
2341
 
      res= TRUE;                                // Error
 
2335
      res= true;                                // Error
2342
2336
    break;
2343
2337
  }
2344
2338
  case SQLCOM_DROP_TABLE:
2382
2376
  {
2383
2377
    LEX_STRING db_str= { (char *) select_lex->db, strlen(select_lex->db) };
2384
2378
 
2385
 
    if (!mysql_change_db(thd, &db_str, FALSE))
 
2379
    if (!mysql_change_db(thd, &db_str, false))
2386
2380
      my_ok(thd);
2387
2381
 
2388
2382
    break;
2513
2507
    {
2514
2508
      thd->locked_tables=thd->lock;
2515
2509
      thd->lock=0;
2516
 
      (void) set_handler_table_locks(thd, all_tables, FALSE);
 
2510
      (void) set_handler_table_locks(thd, all_tables, false);
2517
2511
      DBUG_PRINT("lock_info", ("thd->locked_tables: 0x%lx",
2518
2512
                               (long) thd->locked_tables));
2519
2513
      my_ok(thd);
2713
2707
      */
2714
2708
      if (!lex->no_write_to_binlog && write_to_binlog)
2715
2709
      {
2716
 
        write_bin_log(thd, FALSE, thd->query, thd->query_length);
 
2710
        write_bin_log(thd, false, thd->query, thd->query_length);
2717
2711
      }
2718
2712
      my_ok(thd);
2719
2713
    } 
2779
2773
    if (sv)
2780
2774
    {
2781
2775
      if (ha_release_savepoint(thd, sv))
2782
 
        res= TRUE; // cannot happen
 
2776
        res= true; // cannot happen
2783
2777
      else
2784
2778
        my_ok(thd);
2785
2779
      thd->transaction.savepoints=sv->prev;
2801
2795
    if (sv)
2802
2796
    {
2803
2797
      if (ha_rollback_to_savepoint(thd, sv))
2804
 
        res= TRUE; // cannot happen
 
2798
        res= true; // cannot happen
2805
2799
      else
2806
2800
      {
2807
2801
        if (((thd->options & OPTION_KEEP_LOG) || 
2853
2847
        be free'd when transaction ends anyway
2854
2848
      */
2855
2849
      if (ha_savepoint(thd, newsv))
2856
 
        res= TRUE;
 
2850
        res= true;
2857
2851
      else
2858
2852
      {
2859
2853
        newsv->prev=thd->transaction.savepoints;
2899
2893
  goto finish;
2900
2894
 
2901
2895
error:
2902
 
  res= TRUE;
 
2896
  res= true;
2903
2897
 
2904
2898
finish:
2905
2899
  if (need_start_waiting)
3079
3073
  if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
3080
3074
  {
3081
3075
    thd->options&= ~OPTION_KEEP_LOG;
3082
 
    thd->transaction.all.modified_non_trans_table= FALSE;
 
3076
    thd->transaction.all.modified_non_trans_table= false;
3083
3077
  }
3084
3078
  DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
3085
 
  thd->thread_specific_used= FALSE;
 
3079
  thd->thread_specific_used= false;
3086
3080
 
3087
3081
  if (opt_bin_log)
3088
3082
  {
3142
3136
  if (move_down)
3143
3137
  {
3144
3138
    SELECT_LEX_UNIT *unit;
3145
 
    lex->subqueries= TRUE;
 
3139
    lex->subqueries= true;
3146
3140
    /* first select_lex of subselect or derived table */
3147
3141
    if (!(unit= new (thd->mem_root) SELECT_LEX_UNIT()))
3148
3142
      DBUG_RETURN(1);
3183
3177
    in subquery is SELECT query and we allow resolution of names in SELECT
3184
3178
    list
3185
3179
  */
3186
 
  select_lex->context.resolve_in_select_list= TRUE;
 
3180
  select_lex->context.resolve_in_select_list= true;
3187
3181
  DBUG_RETURN(0);
3188
3182
}
3189
3183
 
3546
3540
    DBUG_RETURN(0);
3547
3541
  }
3548
3542
 
3549
 
  if (table->is_derived_table() == FALSE && table->db.str &&
 
3543
  if (table->is_derived_table() == false && table->db.str &&
3550
3544
      check_db_name(&table->db))
3551
3545
  {
3552
3546
    my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
3568
3562
    DBUG_RETURN(0);                             /* purecov: inspected */
3569
3563
  if (table->db.str)
3570
3564
  {
3571
 
    ptr->is_fqtn= TRUE;
 
3565
    ptr->is_fqtn= true;
3572
3566
    ptr->db= table->db.str;
3573
3567
    ptr->db_length= table->db.length;
3574
3568
  }
3575
3569
  else if (lex->copy_db_to(&ptr->db, &ptr->db_length))
3576
3570
    DBUG_RETURN(0);
3577
3571
  else
3578
 
    ptr->is_fqtn= FALSE;
 
3572
    ptr->is_fqtn= false;
3579
3573
 
3580
3574
  ptr->alias= alias_str;
3581
 
  ptr->is_alias= alias ? TRUE : FALSE;
 
3575
  ptr->is_alias= alias ? true : false;
3582
3576
  if (lower_case_table_names && table->table.length)
3583
3577
    table->table.length= my_casedn_str(files_charset_info, table->table.str);
3584
3578
  ptr->table_name=table->table.str;
3790
3784
    embedded_list->push_back(table);
3791
3785
    if (table->natural_join)
3792
3786
    {
3793
 
      ptr->is_natural_join= TRUE;
 
3787
      ptr->is_natural_join= true;
3794
3788
      /*
3795
3789
        If this is a JOIN ... USING, move the list of joined fields to the
3796
3790
        table reference that describes the join.
3946
3940
 
3947
3941
  fake_select_lex->context.outer_context=first_sl->context.outer_context;
3948
3942
  /* allow item list resolving in fake select for ORDER BY */
3949
 
  fake_select_lex->context.resolve_in_select_list= TRUE;
 
3943
  fake_select_lex->context.resolve_in_select_list= true;
3950
3944
  fake_select_lex->context.select_lex= fake_select_lex;
3951
3945
 
3952
3946
  if (!is_union())
3980
3974
  @param right_op  rigth operand of the JOIN
3981
3975
 
3982
3976
  @retval
3983
 
    FALSE  if all is OK
 
3977
    false  if all is OK
3984
3978
  @retval
3985
 
    TRUE   if a memory allocation error occured
 
3979
    true   if a memory allocation error occured
3986
3980
*/
3987
3981
 
3988
3982
bool
3991
3985
{
3992
3986
  Name_resolution_context *on_context;
3993
3987
  if (!(on_context= new (thd->mem_root) Name_resolution_context))
3994
 
    return TRUE;
 
3988
    return true;
3995
3989
  on_context->init();
3996
3990
  on_context->first_name_resolution_table=
3997
3991
    left_op->first_leaf_for_name_resolution();
4010
4004
  @param expr  the condition to be added to the ON clause
4011
4005
 
4012
4006
  @retval
4013
 
    FALSE  if there was some error
 
4007
    false  if there was some error
4014
4008
  @retval
4015
 
    TRUE   if all is OK
 
4009
    true   if all is OK
4016
4010
*/
4017
4011
 
4018
4012
void add_join_on(TABLE_LIST *b, Item *expr)
4169
4163
      tmp_write_to_binlog= 0;
4170
4164
      if (lock_global_read_lock(thd))
4171
4165
        return 1;                               // Killed
4172
 
      result= close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
4173
 
                                  FALSE : TRUE, TRUE);
 
4166
      result= close_cached_tables(thd, tables, false, (options & REFRESH_FAST) ?
 
4167
                                  false : true, true);
4174
4168
      if (make_global_read_lock_block_commit(thd)) // Killed
4175
4169
      {
4176
4170
        /* Don't leave things in a half-locked state */
4179
4173
      }
4180
4174
    }
4181
4175
    else
4182
 
      result= close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
4183
 
                                  FALSE : TRUE, FALSE);
 
4176
      result= close_cached_tables(thd, tables, false, (options & REFRESH_FAST) ?
 
4177
                                  false : true, false);
4184
4178
    my_dbopt_cleanup();
4185
4179
  }
4186
4180
  if (thd && (options & REFRESH_STATUS))
4397
4391
  @param tables Global/local table list (have to be the same)
4398
4392
 
4399
4393
  @retval
4400
 
    FALSE OK
 
4394
    false OK
4401
4395
  @retval
4402
 
    TRUE  Error
 
4396
    true  Error
4403
4397
*/
4404
4398
 
4405
4399
bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
4412
4406
  if (select_lex->item_list.elements != lex->value_list.elements)
4413
4407
  {
4414
4408
    my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
4415
 
    DBUG_RETURN(TRUE);
 
4409
    DBUG_RETURN(true);
4416
4410
  }
4417
4411
 
4418
4412
  if (select_lex->order_list.elements)
4422
4416
  if (msg)
4423
4417
  {
4424
4418
    my_error(ER_WRONG_USAGE, MYF(0), "UPDATE", msg);
4425
 
    DBUG_RETURN(TRUE);
 
4419
    DBUG_RETURN(true);
4426
4420
  }
4427
 
  DBUG_RETURN(FALSE);
 
4421
  DBUG_RETURN(false);
4428
4422
}
4429
4423
 
4430
4424
/**
4434
4428
  @param tables         Global/local table list
4435
4429
 
4436
4430
  @retval
4437
 
    FALSE OK
 
4431
    false OK
4438
4432
  @retval
4439
 
    TRUE  error
 
4433
    true  error
4440
4434
*/
4441
4435
 
4442
4436
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
4452
4446
  {
4453
4447
    my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
4454
4448
               ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
4455
 
    DBUG_RETURN(TRUE);
 
4449
    DBUG_RETURN(true);
4456
4450
  }
4457
 
  DBUG_RETURN(FALSE);
 
4451
  DBUG_RETURN(false);
4458
4452
}
4459
4453
 
4460
4454
 
4522
4516
  @param lex   pointer to LEX representing multi-delete
4523
4517
 
4524
4518
  @retval
4525
 
    FALSE   success
 
4519
    false   success
4526
4520
  @retval
4527
 
    TRUE    error
 
4521
    true    error
4528
4522
*/
4529
4523
 
4530
4524
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex)
4542
4536
    /* All tables in aux_tables must be found in FROM PART */
4543
4537
    TABLE_LIST *walk= multi_delete_table_match(lex, target_tbl, tables);
4544
4538
    if (!walk)
4545
 
      DBUG_RETURN(TRUE);
 
4539
      DBUG_RETURN(true);
4546
4540
    if (!walk->derived)
4547
4541
    {
4548
4542
      target_tbl->table_name= walk->table_name;
4552
4546
    walk->lock_type= target_tbl->lock_type;
4553
4547
    target_tbl->correspondent_table= walk;      // Remember corresponding table
4554
4548
  }
4555
 
  DBUG_RETURN(FALSE);
 
4549
  DBUG_RETURN(false);
4556
4550
}
4557
4551
 
4558
4552
 
4563
4557
  @param tables Global table list
4564
4558
 
4565
4559
  @retval
4566
 
    FALSE OK
 
4560
    false OK
4567
4561
  @retval
4568
 
    TRUE  Error
 
4562
    true  Error
4569
4563
*/
4570
4564
 
4571
4565
bool update_precheck(THD *thd, TABLE_LIST *tables)
4574
4568
  if (thd->lex->select_lex.item_list.elements != thd->lex->value_list.elements)
4575
4569
  {
4576
4570
    my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
4577
 
    DBUG_RETURN(TRUE);
 
4571
    DBUG_RETURN(true);
4578
4572
  }
4579
 
  DBUG_RETURN(FALSE);
 
4573
  DBUG_RETURN(false);
4580
4574
}
4581
4575
 
4582
4576
 
4587
4581
  @param tables Global table list
4588
4582
 
4589
4583
  @retval
4590
 
    FALSE  OK
 
4584
    false  OK
4591
4585
  @retval
4592
 
    TRUE   error
 
4586
    true   error
4593
4587
*/
4594
4588
 
4595
4589
bool insert_precheck(THD *thd, TABLE_LIST *tables)
4604
4598
  if (lex->update_list.elements != lex->value_list.elements)
4605
4599
  {
4606
4600
    my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
4607
 
    DBUG_RETURN(TRUE);
 
4601
    DBUG_RETURN(true);
4608
4602
  }
4609
 
  DBUG_RETURN(FALSE);
 
4603
  DBUG_RETURN(false);
4610
4604
}
4611
4605
 
4612
4606
 
4618
4612
  @param create_table           Table which will be created
4619
4613
 
4620
4614
  @retval
4621
 
    FALSE   OK
 
4615
    false   OK
4622
4616
  @retval
4623
 
    TRUE   Error
 
4617
    true   Error
4624
4618
*/
4625
4619
 
4626
4620
bool create_table_precheck(THD *thd, TABLE_LIST *tables,
4628
4622
{
4629
4623
  LEX *lex= thd->lex;
4630
4624
  SELECT_LEX *select_lex= &lex->select_lex;
4631
 
  bool error= TRUE;                                 // Error message is given
 
4625
  bool error= true;                                 // Error message is given
4632
4626
  DBUG_ENTER("create_table_precheck");
4633
4627
 
4634
4628
  if (create_table && (strcmp(create_table->db, "information_schema") == 0))
4635
4629
  {
4636
4630
    my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", INFORMATION_SCHEMA_NAME.str);
4637
 
    DBUG_RETURN(TRUE);
 
4631
    DBUG_RETURN(true);
4638
4632
  }
4639
4633
 
4640
4634
  if (select_lex->item_list.elements)
4657
4651
          find_table_in_global_list(tables, create_table->db,
4658
4652
                                    create_table->table_name))
4659
4653
      {
4660
 
        error= FALSE;
 
4654
        error= false;
4661
4655
        goto err;
4662
4656
      }
4663
4657
    }
4664
4658
#endif
4665
4659
  }
4666
 
  error= FALSE;
 
4660
  error= false;
4667
4661
 
4668
4662
  DBUG_RETURN(error);
4669
4663
}
4711
4705
  @param max_length  max length
4712
4706
 
4713
4707
  @retval
4714
 
    FALSE   the passed string is not longer than max_length
 
4708
    false   the passed string is not longer than max_length
4715
4709
  @retval
4716
 
    TRUE    the passed string is longer than max_length
 
4710
    true    the passed string is longer than max_length
4717
4711
 
4718
4712
  NOTE
4719
4713
    The function is not used in existing code but can be useful later?
4723
4717
                              uint max_byte_length)
4724
4718
{
4725
4719
  if (str->length <= max_byte_length)
4726
 
    return FALSE;
 
4720
    return false;
4727
4721
 
4728
4722
  my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_byte_length);
4729
4723
 
4730
 
  return TRUE;
 
4724
  return true;
4731
4725
}
4732
4726
 
4733
4727
 
4742
4736
      cs               string charset
4743
4737
 
4744
4738
  RETURN
4745
 
    FALSE   the passed string is not longer than max_char_length
4746
 
    TRUE    the passed string is longer than max_char_length
 
4739
    false   the passed string is not longer than max_char_length
 
4740
    true    the passed string is longer than max_char_length
4747
4741
*/
4748
4742
 
4749
4743
 
4756
4750
                                      max_char_length, &well_formed_error);
4757
4751
 
4758
4752
  if (!well_formed_error &&  str->length == res)
4759
 
    return FALSE;
 
4753
    return false;
4760
4754
 
4761
4755
  if (!no_error)
4762
4756
    my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_char_length);
4763
 
  return TRUE;
 
4757
  return true;
4764
4758
}
4765
4759
 
4766
4760
 
4784
4778
  if (well_formed_error)
4785
4779
  {
4786
4780
    my_error(ER_INVALID_CHARACTER_STRING, MYF(0), "identifier", str->str);
4787
 
    return TRUE;
 
4781
    return true;
4788
4782
  }
4789
4783
  
4790
4784
  if (str->length == res)
4791
 
    return FALSE;
 
4785
    return false;
4792
4786
 
4793
4787
  switch (err_code)
4794
4788
  {
4804
4798
    DBUG_ASSERT(0);
4805
4799
    break;
4806
4800
  }
4807
 
  return TRUE;
 
4801
  return true;
4808
4802
}
4809
4803
 
4810
4804
 
4863
4857
  @param creation_ctx Object creation context.
4864
4858
 
4865
4859
  @return Error status.
4866
 
    @retval FALSE on success.
4867
 
    @retval TRUE on parsing error.
 
4860
    @retval false on success.
 
4861
    @retval true on parsing error.
4868
4862
*/
4869
4863
 
4870
4864
bool parse_sql(THD *thd,