~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_show.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
find_files(THD *thd, List<LEX_STRING> *files, const char *db,
209
209
           const char *path, const char *wild, bool dir)
210
210
{
211
 
  uint i;
 
211
  uint32_t i;
212
212
  char *ext;
213
213
  MY_DIR *dirp;
214
214
  FILEINFO *file;
215
215
  LEX_STRING *file_name= 0;
216
 
  uint file_name_len;
 
216
  uint32_t file_name_len;
217
217
  TableList table_list;
218
218
 
219
219
  if (wild && !wild[0])
443
443
    0   No conflicting character
444
444
*/
445
445
 
446
 
static const char *require_quotes(const char *name, uint name_length)
 
446
static const char *require_quotes(const char *name, uint32_t name_length)
447
447
{
448
 
  uint length;
 
448
  uint32_t length;
449
449
  bool pure_digit= true;
450
450
  const char *end= name + name_length;
451
451
 
477
477
*/
478
478
 
479
479
void
480
 
append_identifier(THD *thd, String *packet, const char *name, uint length)
 
480
append_identifier(THD *thd, String *packet, const char *name, uint32_t length)
481
481
{
482
482
  const char *name_end;
483
483
  char quote_char;
542
542
    #     Quote character
543
543
*/
544
544
 
545
 
int get_quote_char_for_identifier(THD *thd, const char *name, uint length)
 
545
int get_quote_char_for_identifier(THD *thd, const char *name, uint32_t length)
546
546
{
547
547
  if (length &&
548
548
      !is_keyword(name,length) &&
561
561
{
562
562
  if (filename)
563
563
  {
564
 
    uint length= dirname_length(filename);
 
564
    uint32_t length= dirname_length(filename);
565
565
    packet->append(' ');
566
566
    packet->append(dir_type);
567
567
    packet->append(STRING_WITH_LEN(" DIRECTORY='"));
606
606
      if (type.length())
607
607
      {
608
608
        String def_val;
609
 
        uint dummy_errors;
 
609
        uint32_t dummy_errors;
610
610
        /* convert to system_charset_info == utf8 */
611
611
        def_val.copy(type.ptr(), type.length(), field->charset(),
612
612
                     system_charset_info, &dummy_errors);
659
659
  String type(tmp, sizeof(tmp), system_charset_info);
660
660
  String def_value(def_value_buf, sizeof(def_value_buf), system_charset_info);
661
661
  Field **ptr,*field;
662
 
  uint primary_key;
 
662
  uint32_t primary_key;
663
663
  KEY *key_info;
664
664
  Table *table= table_list->table;
665
665
  handler *file= table->file;
699
699
 
700
700
  for (ptr=table->field ; (field= *ptr); ptr++)
701
701
  {
702
 
    uint flags = field->flags;
 
702
    uint32_t flags = field->flags;
703
703
 
704
704
    if (ptr != table->field)
705
705
      packet->append(STRING_WITH_LEN(",\n"));
789
789
  file->update_create_info(&create_info);
790
790
  primary_key= share->primary_key;
791
791
 
792
 
  for (uint i=0 ; i < share->keys ; i++,key_info++)
 
792
  for (uint32_t i=0 ; i < share->keys ; i++,key_info++)
793
793
  {
794
794
    KEY_PART_INFO *key_part= key_info->key_part;
795
795
    bool found_primary=0;
814
814
 
815
815
    packet->append(STRING_WITH_LEN(" ("));
816
816
 
817
 
    for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
 
817
    for (uint32_t j=0 ; j < key_info->key_parts ; j++,key_part++)
818
818
    {
819
819
      if (j)
820
820
        packet->append(',');
994
994
                          HA_CREATE_INFO *create_info)
995
995
{
996
996
  HA_CREATE_INFO create;
997
 
  uint create_options = create_info ? create_info->options : 0;
 
997
  uint32_t create_options = create_info ? create_info->options : 0;
998
998
 
999
999
  if (!my_strcasecmp(system_charset_info, dbname,
1000
1000
                     INFORMATION_SCHEMA_NAME.str))
1084
1084
 
1085
1085
  ulong thread_id;
1086
1086
  time_t start_time;
1087
 
  uint   command;
 
1087
  uint32_t   command;
1088
1088
  const char *user,*host,*db,*proc_info,*state_info;
1089
1089
  char *query;
1090
1090
};
1162
1162
            the comment in sql_class.h why this prevents crashes in possible
1163
1163
            races with query_length
1164
1164
          */
1165
 
          uint length= cmin((uint32_t)max_query_length, tmp->query_length);
 
1165
          uint32_t length= cmin((uint32_t)max_query_length, tmp->query_length);
1166
1166
          thd_info->query=(char*) thd->strmake(tmp->query,length);
1167
1167
        }
1168
1168
        thread_infos.append(thd_info);
1307
1307
*/
1308
1308
static void shrink_var_array(DYNAMIC_ARRAY *array)
1309
1309
{
1310
 
  uint a,b;
 
1310
  uint32_t a,b;
1311
1311
  SHOW_VAR *all= dynamic_element(array, 0, SHOW_VAR *);
1312
1312
 
1313
1313
  for (a= b= 0; b < array->elements; b++)
1448
1448
  else
1449
1449
  {
1450
1450
    SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
1451
 
    uint i;
 
1451
    uint32_t i;
1452
1452
    for (; list->name; list++)
1453
1453
    {
1454
1454
      for (i= 0; i < all_status_vars.elements; i++)
1837
1837
  if (item->type() == Item::FUNC_ITEM)
1838
1838
  {
1839
1839
    Item_func *item_func= (Item_func*)item;
1840
 
    for (uint i=0; i<item_func->argument_count(); i++)
 
1840
    for (uint32_t i=0; i<item_func->argument_count(); i++)
1841
1841
    {
1842
1842
      if (!uses_only_table_name_fields(item_func->arguments()[i], table))
1843
1843
        return 0;
2365
2365
    @retval       SKIP_OPEN_TABLE | OPEN_FRM_ONLY | OPEN_FULL_TABLE
2366
2366
*/
2367
2367
 
2368
 
static uint get_table_open_method(TableList *tables,
 
2368
static uint32_t get_table_open_method(TableList *tables,
2369
2369
                                  ST_SCHEMA_TABLE *schema_table,
2370
2370
                                  enum enum_schema_tables schema_table_idx __attribute__((unused)))
2371
2371
{
2416
2416
  TABLE_SHARE *share;
2417
2417
  Table tbl;
2418
2418
  TableList table_list;
2419
 
  uint res= 0;
 
2419
  uint32_t res= 0;
2420
2420
  int error;
2421
2421
  char key[MAX_DBKEY_LENGTH];
2422
 
  uint key_length;
 
2422
  uint32_t key_length;
2423
2423
 
2424
2424
  memset(&table_list, 0, sizeof(TableList));
2425
2425
  memset(&tbl, 0, sizeof(Table));
2489
2489
  List<LEX_STRING> db_names;
2490
2490
  List_iterator_fast<LEX_STRING> it(db_names);
2491
2491
  COND *partial_cond= 0;
2492
 
  uint derived_tables= lex->derived_tables; 
 
2492
  uint32_t derived_tables= lex->derived_tables; 
2493
2493
  int error= 1;
2494
2494
  Open_tables_state open_tables_state_backup;
2495
2495
  Query_tables_list query_tables_list_backup;
2496
 
  uint table_open_method;
 
2496
  uint32_t table_open_method;
2497
2497
  bool old_value= thd->no_warnings_for_error;
2498
2498
 
2499
2499
  lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
2741
2741
     !with_i_schema)
2742
2742
  {
2743
2743
    char path[FN_REFLEN+16];
2744
 
    uint path_len;
 
2744
    uint32_t path_len;
2745
2745
    struct stat stat_info;
2746
2746
    if (!lookup_field_vals.db_value.str[0])
2747
2747
      return(0);
2979
2979
*/
2980
2980
 
2981
2981
void store_column_type(Table *table, Field *field, const CHARSET_INFO * const cs,
2982
 
                       uint offset)
 
2982
                       uint32_t offset)
2983
2983
{
2984
2984
  bool is_blob;
2985
2985
  int decimals, field_length;
3117
3117
    {
3118
3118
      /* to satisfy 'field->val_str' ASSERTs */
3119
3119
      unsigned char *bitmaps;
3120
 
      uint bitmap_size= show_table_share->column_bitmap_size;
 
3120
      uint32_t bitmap_size= show_table_share->column_bitmap_size;
3121
3121
      if (!(bitmaps= (unsigned char*) alloc_root(thd->mem_root, bitmap_size)))
3122
3122
        return(0);
3123
3123
      bitmap_init(&show_table->def_read_set,
3330
3330
      show_table->file->info(HA_STATUS_VARIABLE |
3331
3331
                             HA_STATUS_NO_LOCK |
3332
3332
                             HA_STATUS_TIME);
3333
 
    for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
 
3333
    for (uint32_t i=0 ; i < show_table->s->keys ; i++,key_info++)
3334
3334
    {
3335
3335
      KEY_PART_INFO *key_part= key_info->key_part;
3336
3336
      const char *str;
3337
 
      for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
 
3337
      for (uint32_t j=0 ; j < key_info->key_parts ; j++,key_part++)
3338
3338
      {
3339
3339
        restore_record(table, s->default_values);
3340
3340
        table->field[1]->store(db_name->str, db_name->length, cs);
3375
3375
                                  key_part->field->charset()->mbmaxlen, true);
3376
3376
          table->field[10]->set_notnull();
3377
3377
        }
3378
 
        uint flags= key_part->field ? key_part->field->flags : 0;
 
3378
        uint32_t flags= key_part->field ? key_part->field->flags : 0;
3379
3379
        const char *pos=(char*) ((flags & NOT_NULL_FLAG) ? "" : "YES");
3380
3380
        table->field[12]->store(pos, strlen(pos), cs);
3381
3381
        if (!show_table->s->keys_in_use.is_set(i))
3399
3399
 
3400
3400
bool store_constraints(THD *thd, Table *table, LEX_STRING *db_name,
3401
3401
                       LEX_STRING *table_name, const char *key_name,
3402
 
                       uint key_len, const char *con_type, uint con_len)
 
3402
                       uint32_t key_len, const char *con_type, uint32_t con_len)
3403
3403
{
3404
3404
  const CHARSET_INFO * const cs= system_charset_info;
3405
3405
  restore_record(table, s->default_values);
3430
3430
    List<FOREIGN_KEY_INFO> f_key_list;
3431
3431
    Table *show_table= tables->table;
3432
3432
    KEY *key_info=show_table->key_info;
3433
 
    uint primary_key= show_table->s->primary_key;
 
3433
    uint32_t primary_key= show_table->s->primary_key;
3434
3434
    show_table->file->info(HA_STATUS_VARIABLE | 
3435
3435
                           HA_STATUS_NO_LOCK |
3436
3436
                           HA_STATUS_TIME);
3437
 
    for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
 
3437
    for (uint32_t i=0 ; i < show_table->s->keys ; i++, key_info++)
3438
3438
    {
3439
3439
      if (i != primary_key && !(key_info->flags & HA_NOSAME))
3440
3440
        continue;
3473
3473
 
3474
3474
void store_key_column_usage(Table *table, LEX_STRING *db_name,
3475
3475
                            LEX_STRING *table_name, const char *key_name,
3476
 
                            uint key_len, const char *con_type, uint con_len,
 
3476
                            uint32_t key_len, const char *con_type, uint32_t con_len,
3477
3477
                            int64_t idx)
3478
3478
{
3479
3479
  const CHARSET_INFO * const cs= system_charset_info;
3505
3505
    List<FOREIGN_KEY_INFO> f_key_list;
3506
3506
    Table *show_table= tables->table;
3507
3507
    KEY *key_info=show_table->key_info;
3508
 
    uint primary_key= show_table->s->primary_key;
 
3508
    uint32_t primary_key= show_table->s->primary_key;
3509
3509
    show_table->file->info(HA_STATUS_VARIABLE | 
3510
3510
                           HA_STATUS_NO_LOCK |
3511
3511
                           HA_STATUS_TIME);
3512
 
    for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
 
3512
    for (uint32_t i=0 ; i < show_table->s->keys ; i++, key_info++)
3513
3513
    {
3514
3514
      if (i != primary_key && !(key_info->flags & HA_NOSAME))
3515
3515
        continue;
3516
 
      uint f_idx= 0;
 
3516
      uint32_t f_idx= 0;
3517
3517
      KEY_PART_INFO *key_part= key_info->key_part;
3518
 
      for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
 
3518
      for (uint32_t j=0 ; j < key_info->key_parts ; j++,key_part++)
3519
3519
      {
3520
3520
        if (key_part->field)
3521
3521
        {
3542
3542
      LEX_STRING *r_info;
3543
3543
      List_iterator_fast<LEX_STRING> it(f_key_info->foreign_fields),
3544
3544
        it1(f_key_info->referenced_fields);
3545
 
      uint f_idx= 0;
 
3545
      uint32_t f_idx= 0;
3546
3546
      while ((f_info= it++))
3547
3547
      {
3548
3548
        r_info= it1++;