~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 03:55:31 UTC
  • mto: This revision was merged to the branch mainline in revision 479.
  • Revision ID: brian@gir.tangent.org-20081006035531-ade3cc3kfwutd35g
uint cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
          a number of modified rows
162
162
*/
163
163
 
164
 
uint sql_command_flags[SQLCOM_END+1];
 
164
uint32_t sql_command_flags[SQLCOM_END+1];
165
165
 
166
166
void init_update_queries(void)
167
167
{
420
420
  my_net_set_read_timeout(net, thd->variables.net_read_timeout);
421
421
 
422
422
  assert(packet_length);
423
 
  return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1));
 
423
  return_value= dispatch_command(command, thd, packet+1, (uint32_t) (packet_length-1));
424
424
 
425
425
out:
426
426
  return(return_value);
508
508
        COM_QUIT/COM_SHUTDOWN
509
509
*/
510
510
bool dispatch_command(enum enum_server_command command, THD *thd,
511
 
                      char* packet, uint packet_length)
 
511
                      char* packet, uint32_t packet_length)
512
512
{
513
513
  NET *net= &thd->net;
514
514
  bool error= 0;
577
577
      terminated, so also '\0' for empty string).
578
578
 
579
579
      Cast *passwd to an unsigned char, so that it doesn't extend the sign
580
 
      for *passwd > 127 and become 2**32-127 after casting to uint.
 
580
      for *passwd > 127 and become 2**32-127 after casting to uint32_t.
581
581
    */
582
582
    char db_buff[NAME_LEN+1];                 // buffer to store db in utf8
583
583
    char *db= passwd;
591
591
      my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
592
592
      break;
593
593
    }
594
 
    uint passwd_len= (thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
 
594
    uint32_t passwd_len= (thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
595
595
                      (uchar)(*passwd++) : strlen(passwd));
596
 
    uint dummy_errors, save_db_length, db_length;
 
596
    uint32_t dummy_errors, save_db_length, db_length;
597
597
    int res;
598
598
    Security_context save_security_ctx= *thd->security_ctx;
599
599
    USER_CONN *save_user_connect;
611
611
    db_length= strlen(db);
612
612
 
613
613
    char *ptr= db + db_length + 1;
614
 
    uint cs_number= 0;
 
614
    uint32_t cs_number= 0;
615
615
 
616
616
    if (ptr < packet_end)
617
617
    {
731
731
    */
732
732
    arg_end= strchr(packet, '\0');
733
733
    thd->convert_string(&conv_name, system_charset_info,
734
 
                        packet, (uint) (arg_end - packet), thd->charset());
 
734
                        packet, (uint32_t) (arg_end - packet), thd->charset());
735
735
    table_list.alias= table_list.table_name= conv_name.str;
736
736
    packet= arg_end + 1;
737
737
 
743
743
        table_list.schema_table= schema_table;
744
744
    }
745
745
 
746
 
    thd->query_length= (uint) (packet_end - packet); // Don't count end \0
 
746
    thd->query_length= (uint32_t) (packet_end - packet); // Don't count end \0
747
747
    if (!(thd->query=fields= (char*) thd->memdup(packet,thd->query_length+1)))
748
748
      break;
749
749
    if (lower_case_table_names)
776
776
  case COM_BINLOG_DUMP:
777
777
    {
778
778
      ulong pos;
779
 
      ushort flags;
 
779
      uint16_t flags;
780
780
      uint32_t slave_server_id;
781
781
 
782
782
      status_var_increment(thd->status_var.com_other);
822
822
  case COM_SET_OPTION:
823
823
  {
824
824
    status_var_increment(thd->status_var.com_stat[SQLCOM_SET_OPTION]);
825
 
    uint opt_command= uint2korr(packet);
 
825
    uint32_t opt_command= uint2korr(packet);
826
826
 
827
827
    switch (opt_command) {
828
828
    case (int) DRIZZLE_OPTION_MULTI_STATEMENTS_ON:
1016
1016
    true  error;  In this case thd->fatal_error is set
1017
1017
*/
1018
1018
 
1019
 
bool alloc_query(THD *thd, const char *packet, uint packet_length)
 
1019
bool alloc_query(THD *thd, const char *packet, uint32_t packet_length)
1020
1020
{
1021
1021
  /* Remove garbage at start and end of query */
1022
1022
  while (packet_length > 0 && my_isspace(thd->charset(), packet[0]))
1272
1272
  case SQLCOM_SHOW_WARNS:
1273
1273
  {
1274
1274
    res= mysqld_show_warnings(thd, (uint32_t)
1275
 
                              ((1L << (uint) DRIZZLE_ERROR::WARN_LEVEL_NOTE) |
1276
 
                               (1L << (uint) DRIZZLE_ERROR::WARN_LEVEL_WARN) |
1277
 
                               (1L << (uint) DRIZZLE_ERROR::WARN_LEVEL_ERROR)
 
1275
                              ((1L << (uint32_t) DRIZZLE_ERROR::WARN_LEVEL_NOTE) |
 
1276
                               (1L << (uint32_t) DRIZZLE_ERROR::WARN_LEVEL_WARN) |
 
1277
                               (1L << (uint32_t) DRIZZLE_ERROR::WARN_LEVEL_ERROR)
1278
1278
                               ));
1279
1279
    break;
1280
1280
  }
1281
1281
  case SQLCOM_SHOW_ERRORS:
1282
1282
  {
1283
1283
    res= mysqld_show_warnings(thd, (uint32_t)
1284
 
                              (1L << (uint) DRIZZLE_ERROR::WARN_LEVEL_ERROR));
 
1284
                              (1L << (uint32_t) DRIZZLE_ERROR::WARN_LEVEL_ERROR));
1285
1285
    break;
1286
1286
  }
1287
1287
  case SQLCOM_SHOW_SLAVE_HOSTS:
2564
2564
{
2565
2565
  LEX   *lex= current_thd->lex;
2566
2566
  ulong old_info=0;
2567
 
  if ((uint) *yystacksize >= MY_YACC_MAX)
 
2567
  if ((uint32_t) *yystacksize >= MY_YACC_MAX)
2568
2568
    return 1;
2569
2569
  if (!lex->yacc_yyvs)
2570
2570
    old_info= *yystacksize;
2802
2802
                               the next query in the query text.
2803
2803
*/
2804
2804
 
2805
 
void mysql_parse(THD *thd, const char *inBuf, uint length,
 
2805
void mysql_parse(THD *thd, const char *inBuf, uint32_t length,
2806
2806
                 const char ** found_semicolon)
2807
2807
{
2808
2808
  /*
2880
2880
    1   can be ignored
2881
2881
*/
2882
2882
 
2883
 
bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
 
2883
bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint32_t length)
2884
2884
{
2885
2885
  LEX *lex= thd->lex;
2886
2886
  bool error= 0;
2908
2908
 
2909
2909
bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
2910
2910
                       char *length, char *decimals,
2911
 
                       uint type_modifier,
 
2911
                       uint32_t type_modifier,
2912
2912
                       enum column_format_type column_format,
2913
2913
                       Item *default_value, Item *on_update_value,
2914
2914
                       LEX_STRING *comment,
3312
3312
  embedded_list= &nested_join->join_list;
3313
3313
  embedded_list->empty();
3314
3314
 
3315
 
  for (uint i=0; i < 2; i++)
 
3315
  for (uint32_t i=0; i < 2; i++)
3316
3316
  {
3317
3317
    TableList *table= join_list->pop();
3318
3318
    table->join_list= embedded_list;
3749
3749
                ulong id, bool only_kill_query)
3750
3750
{
3751
3751
  THD *tmp;
3752
 
  uint error=ER_NO_SUCH_THREAD;
 
3752
  uint32_t error=ER_NO_SUCH_THREAD;
3753
3753
  pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
3754
3754
  I_List_iterator<THD> it(threads);
3755
3755
  while ((tmp=it++))
3785
3785
 
3786
3786
void sql_kill(THD *thd, ulong id, bool only_kill_query)
3787
3787
{
3788
 
  uint error;
 
3788
  uint32_t error;
3789
3789
  if (!(error= kill_one_thread(thd, id, only_kill_query)))
3790
3790
    my_ok(thd);
3791
3791
  else
4212
4212
*/
4213
4213
 
4214
4214
bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
4215
 
                              uint max_byte_length)
 
4215
                              uint32_t max_byte_length)
4216
4216
{
4217
4217
  if (str->length <= max_byte_length)
4218
4218
    return false;
4240
4240
 
4241
4241
 
4242
4242
bool check_string_char_length(LEX_STRING *str, const char *err_msg,
4243
 
                              uint max_char_length, const CHARSET_INFO * const cs,
 
4243
                              uint32_t max_char_length, const CHARSET_INFO * const cs,
4244
4244
                              bool no_error)
4245
4245
{
4246
4246
  int well_formed_error;
4247
 
  uint res= cs->cset->well_formed_len(cs, str->str, str->str + str->length,
 
4247
  uint32_t res= cs->cset->well_formed_len(cs, str->str, str->str + str->length,
4248
4248
                                      max_char_length, &well_formed_error);
4249
4249
 
4250
4250
  if (!well_formed_error &&  str->length == res)
4256
4256
}
4257
4257
 
4258
4258
 
4259
 
bool check_identifier_name(LEX_STRING *str, uint max_char_length,
4260
 
                           uint err_code, const char *param_for_err_msg)
 
4259
bool check_identifier_name(LEX_STRING *str, uint32_t max_char_length,
 
4260
                           uint32_t err_code, const char *param_for_err_msg)
4261
4261
{
4262
4262
#ifdef HAVE_CHARSET_utf8mb3
4263
4263
  /*
4270
4270
  const CHARSET_INFO * const cs= system_charset_info;
4271
4271
#endif
4272
4272
  int well_formed_error;
4273
 
  uint res= cs->cset->well_formed_len(cs, str->str, str->str + str->length,
 
4273
  uint32_t res= cs->cset->well_formed_len(cs, str->str, str->str + str->length,
4274
4274
                                      max_char_length, &well_formed_error);
4275
4275
 
4276
4276
  if (well_formed_error)
4316
4316
bool test_if_data_home_dir(const char *dir)
4317
4317
{
4318
4318
  char path[FN_REFLEN], conv_path[FN_REFLEN];
4319
 
  uint dir_len, home_dir_len= strlen(mysql_unpacked_real_data_home);
 
4319
  uint32_t dir_len, home_dir_len= strlen(mysql_unpacked_real_data_home);
4320
4320
 
4321
4321
  if (!dir)
4322
4322
    return(0);