~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: Brian Aker
  • Date: 2009-05-14 16:46:36 UTC
  • mto: This revision was merged to the branch mainline in revision 1016.
  • Revision ID: brian@gaz-20090514164636-ipl0u2inw8nr7ueb
Remove dead session calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
/* Match the values of enum ha_choice */
63
63
static const char *ha_choice_values[] = {"", "0", "1"};
64
64
 
65
 
static void store_key_options(Session *session, String *packet, Table *table,
66
 
                              KEY *key_info);
 
65
static void store_key_options(String *packet, Table *table, KEY *key_info);
67
66
 
68
67
static vector<InfoSchemaTable *> all_schema_tables;
69
68
 
358
357
  if (open_normal_and_derived_tables(session, table_list, 0))
359
358
  {
360
359
    if (session->is_error())
361
 
      return(true);
 
360
      return true;
362
361
 
363
362
    /*
364
363
      Clear all messages with 'error' level status and
371
370
 
372
371
  buffer.length(0);
373
372
 
374
 
  if (store_create_info(session, table_list, &buffer, NULL))
375
 
    return(true);
 
373
  if (store_create_info(table_list, &buffer, NULL))
 
374
    return true;
376
375
 
377
376
  List<Item> field_list;
378
377
  {
385
384
  if (protocol->sendFields(&field_list,
386
385
                           Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
387
386
  {
388
 
    return(true);
 
387
    return true;
389
388
  }
390
389
  protocol->prepareForResend();
391
390
  {
399
398
  protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
400
399
 
401
400
  if (protocol->write())
402
 
    return(true);
 
401
    return true;
403
402
 
404
403
  session->my_eof();
405
 
  return(false);
 
404
  return false;
406
405
}
407
406
 
408
407
bool mysqld_show_create_db(Session *session, char *dbname,
419
418
      can fail is incorrect database name (which is the case now).
420
419
    */
421
420
    my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
422
 
    return(true);
 
421
    return true;
423
422
  }
424
423
 
425
424
  List<Item> field_list;
428
427
 
429
428
  if (protocol->sendFields(&field_list,
430
429
                           Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
431
 
    return(true);
 
430
    return true;
432
431
 
433
432
  protocol->prepareForResend();
434
433
  protocol->store(dbname, strlen(dbname), system_charset_info);
435
434
  protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
436
435
 
437
436
  if (protocol->write())
438
 
    return(true);
 
437
    return true;
439
438
  session->my_eof();
440
 
  return(false);
 
439
  return false;
441
440
}
442
441
 
443
442
 
472
471
  if (session->protocol->sendFields(&field_list, Protocol::SEND_DEFAULTS))
473
472
    return;
474
473
  session->my_eof();
475
 
  return;
476
474
}
477
475
 
478
476
 
481
479
 
482
480
  SYNOPSIS
483
481
    get_quote_char_for_identifier()
484
 
    session             Thread handler
485
 
    name        name to quote
486
 
    length      length of name
487
482
 
488
483
  IMPLEMENTATION
489
484
    Force quoting in the following cases:
499
494
    #     Quote character
500
495
*/
501
496
 
502
 
int get_quote_char_for_identifier(Session *, const char *, uint32_t)
 
497
int get_quote_char_for_identifier()
503
498
{
504
499
  return '`';
505
500
}
507
502
 
508
503
/* Append directory name (if exists) to CREATE INFO */
509
504
 
510
 
static void append_directory(Session *,
511
 
                             String *packet, const char *dir_type,
 
505
static void append_directory(String *packet, const char *dir_type,
512
506
                             const char *filename)
513
507
{
514
508
  if (filename)
525
519
 
526
520
#define LIST_PROCESS_HOST_LEN 64
527
521
 
528
 
static bool get_field_default_value(Session *,
529
 
                                    Field *timestamp_field,
 
522
static bool get_field_default_value(Field *timestamp_field,
530
523
                                    Field *field, String *def_value,
531
524
                                    bool quoted)
532
525
{
572
565
    else if (field->maybe_null() && quoted)
573
566
      def_value->append(STRING_WITH_LEN("NULL"));    // Null as default
574
567
    else
575
 
      return 0;
 
568
      return false;
576
569
  }
577
570
  return has_default;
578
571
}
582
575
 
583
576
  SYNOPSIS
584
577
    store_create_info()
585
 
    session               The thread
586
578
    table_list        A list containing one table to write statement
587
579
                      for.
588
580
    packet            Pointer to a string where statement will be
600
592
    0       OK
601
593
 */
602
594
 
603
 
int store_create_info(Session *session, TableList *table_list, String *packet,
604
 
                      HA_CREATE_INFO *create_info_arg)
 
595
int store_create_info(TableList *table_list, String *packet, HA_CREATE_INFO *create_info_arg)
605
596
{
606
597
  List<Item> field_list;
607
598
  char tmp[MAX_FIELD_WIDTH], *for_str, def_value_buf[MAX_FIELD_WIDTH];
711
702
          packet->append(STRING_WITH_LEN(" DYNAMIC */"));
712
703
      }
713
704
    }
714
 
    if (get_field_default_value(session, table->timestamp_field,
715
 
                                field, &def_value, 1))
 
705
    if (get_field_default_value(table->timestamp_field, field, &def_value, 1))
716
706
    {
717
707
      packet->append(STRING_WITH_LEN(" DEFAULT "));
718
708
      packet->append(def_value.ptr(), def_value.length(), system_charset_info);
783
773
      }
784
774
    }
785
775
    packet->append(')');
786
 
    store_key_options(session, packet, table, key_info);
 
776
    store_key_options(packet, table, key_info);
787
777
  }
788
778
 
789
779
  /*
897
887
      packet->append(STRING_WITH_LEN(" CONNECTION="));
898
888
      append_unescaped(packet, share->connect_string.str, share->connect_string.length);
899
889
    }
900
 
    append_directory(session, packet, "DATA",  create_info.data_file_name);
901
 
    append_directory(session, packet, "INDEX", create_info.index_file_name);
 
890
    append_directory(packet, "DATA",  create_info.data_file_name);
 
891
    append_directory(packet, "INDEX", create_info.index_file_name);
902
892
  }
903
893
  table->restore_column_map(old_map);
904
894
  return(0);
940
930
  else
941
931
  {
942
932
    if (check_db_dir_existence(dbname))
943
 
      return(true);
 
933
      return true;
944
934
 
945
935
    load_db_opt_by_name(dbname, &create);
946
936
  }
955
945
 
956
946
  buffer->append_identifier(dbname, strlen(dbname));
957
947
 
958
 
  return(false);
 
948
  return false;
959
949
}
960
950
 
961
 
static void store_key_options(Session *,
962
 
                              String *packet, Table *table,
963
 
                              KEY *key_info)
 
951
static void store_key_options(String *packet, Table *table, KEY *key_info)
964
952
{
965
953
  char *end, buff[32];
966
954
 
1532
1520
        pthread_mutex_unlock(&LOCK_global_system_variables);
1533
1521
 
1534
1522
        if (schema_table_store_record(session, table))
1535
 
          return(true);
 
1523
          return true;
1536
1524
      }
1537
1525
    }
1538
1526
  }
1539
1527
 
1540
 
  return(false);
 
1528
  return false;
1541
1529
}
1542
1530
 
1543
1531
 
1597
1585
 
1598
1586
    if (create_myisam_from_heap(session, table, param->start_recinfo,
1599
1587
                                &param->recinfo, error, 0))
1600
 
      return 1;
 
1588
      return true;
1601
1589
  }
1602
 
  return 0;
 
1590
  return false;
1603
1591
}
1604
1592
 
1605
1593
 
2103
2091
  {
2104
2092
    if (with_i_schema)
2105
2093
    {
2106
 
      if (find_schema_table(session, lookup_field_vals->table_value.str))
 
2094
      if (find_schema_table(lookup_field_vals->table_value.str))
2107
2095
      {
2108
2096
        if (table_names->push_back(&lookup_field_vals->table_value))
2109
2097
          return 1;
3055
3043
                           cs);
3056
3044
    table->field[4]->store((int64_t) count, true);
3057
3045
 
3058
 
    if (get_field_default_value(session, timestamp_field, field, &type, 0))
 
3046
    if (get_field_default_value(timestamp_field, field, &type, 0))
3059
3047
    {
3060
3048
      table->field[5]->store(type.ptr(), type.length(), cs);
3061
3049
      table->field[5]->set_notnull();
3661
3649
 
3662
3650
  SYNOPSIS
3663
3651
    find_schema_table()
3664
 
    session                 thread handler
3665
3652
    table_name          table name
3666
3653
 
3667
3654
  RETURN
3669
3656
    #   pointer to 'schema_tables' element
3670
3657
*/
3671
3658
 
3672
 
InfoSchemaTable *find_schema_table(Session *, const char* table_name)
 
3659
InfoSchemaTable *find_schema_table(const char* table_name)
3673
3660
{
3674
3661
  InfoSchemaTable *schema_table= schema_tables;
3675
3662