~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: Brian Aker
  • Date: 2009-11-12 16:13:04 UTC
  • mfrom: (1211.1.7 staging)
  • Revision ID: brian@gaz-20091112161304-opamiauv36fg0n6u
Rollup of Brian, Padraig, and Stewart patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
443
443
  uint32_t primary_key;
444
444
  KEY *key_info;
445
445
  Table *table= table_list->table;
446
 
  Cursor *file= table->file;
 
446
  Cursor *cursor= table->cursor;
447
447
  TableShare *share= table->s;
448
448
  HA_CREATE_INFO create_info;
449
449
  bool show_table_options= false;
560
560
  memset(&create_info, 0, sizeof(create_info));
561
561
  /* Allow update_create_info to update row type */
562
562
  create_info.row_type= share->row_type;
563
 
  file->update_create_info(&create_info);
 
563
  cursor->update_create_info(&create_info);
564
564
  primary_key= share->primary_key;
565
565
 
566
566
  for (uint32_t i=0 ; i < share->keys ; i++,key_info++)
616
616
    to the CREATE TABLE statement
617
617
  */
618
618
 
619
 
  if ((for_str= file->get_foreign_key_create_info()))
 
619
  if ((for_str= cursor->get_foreign_key_create_info()))
620
620
  {
621
621
    packet->append(for_str, strlen(for_str));
622
 
    file->free_foreign_key_create_info(for_str);
 
622
    cursor->free_foreign_key_create_info(for_str);
623
623
  }
624
624
 
625
625
  packet->append(STRING_WITH_LEN("\n)"));
638
638
        (create_info_arg->used_fields & HA_CREATE_USED_ENGINE))
639
639
    {
640
640
      packet->append(STRING_WITH_LEN(" ENGINE="));
641
 
      packet->append(file->engine->getName().c_str());
 
641
      packet->append(cursor->engine->getName().c_str());
642
642
    }
643
643
 
644
644
    if (share->db_create_options & HA_OPTION_PACK_KEYS)
662
662
      buff= to_string(share->block_size);
663
663
      packet->append(buff.c_str(), buff.length());
664
664
    }
665
 
    table->file->append_create_info(packet);
 
665
    table->cursor->append_create_info(packet);
666
666
    if (share->hasComment() && share->getCommentLength())
667
667
    {
668
668
      packet->append(STRING_WITH_LEN(" COMMENT="));
1034
1034
bool schema_table_store_record(Session *session, Table *table)
1035
1035
{
1036
1036
  int error;
1037
 
  if ((error= table->file->ha_write_row(table->record[0])))
 
1037
  if ((error= table->cursor->ha_write_row(table->record[0])))
1038
1038
  {
1039
1039
    Tmp_Table_Param *param= table->pos_in_table_list->schema_table_param;
1040
1040
 
1457
1457
  @return         Operation status
1458
1458
    @retval       0           ok
1459
1459
    @retval       1           fatal error
1460
 
    @retval       2           Not fatal error; Safe to ignore this file list
 
1460
    @retval       2           Not fatal error; Safe to ignore this cursor list
1461
1461
*/
1462
1462
 
1463
1463
static int
1641
1641
  @details        The function calculates the method which will be used
1642
1642
                  for table opening:
1643
1643
                  SKIP_OPEN_TABLE - do not open table
1644
 
                  OPEN_FRM_ONLY   - open FRM file only
 
1644
                  OPEN_FRM_ONLY   - open FRM cursor only
1645
1645
                  OPEN_FULL_TABLE - open FRM, data, index files
1646
1646
  @param[in]      tables               I_S table table_list
1647
1647
  @param[in]      schema_table         I_S table struct
1674
1674
 
1675
1675
 
1676
1676
/**
1677
 
  @brief          Fill I_S table with data from FRM file only
 
1677
  @brief          Fill I_S table with data from FRM cursor only
1678
1678
 
1679
1679
  @param[in]      session                      thread Cursor
1680
1680
  @param[in]      table                    Table struct for I_S table
2038
2038
 
2039
2039
  decimals= field->decimals();
2040
2040
  switch (field->type()) {
2041
 
  case DRIZZLE_TYPE_NEWDECIMAL:
2042
 
    field_length= ((Field_new_decimal*) field)->precision;
 
2041
  case DRIZZLE_TYPE_DECIMAL:
 
2042
    field_length= ((Field_decimal*) field)->precision;
2043
2043
    break;
2044
2044
  case DRIZZLE_TYPE_LONG:
2045
2045
  case DRIZZLE_TYPE_LONGLONG:
2242
2242
                           column->getLength())) == NULL)
2243
2243
        return NULL;
2244
2244
      break;
2245
 
    case DRIZZLE_TYPE_NEWDECIMAL:
 
2245
    case DRIZZLE_TYPE_DECIMAL:
2246
2246
      if (!(item= new Item_decimal((int64_t) column->getValue(), false)))
2247
2247
      {
2248
2248
        return(0);
2367
2367
  table->s->tmp_table= SYSTEM_TMP_TABLE;
2368
2368
  /*
2369
2369
    This test is necessary to make
2370
 
    case insensitive file systems +
 
2370
    case insensitive cursor systems +
2371
2371
    upper case table names(information schema tables) +
2372
2372
    views
2373
2373
    working correctly
2483
2483
      */
2484
2484
      if (table_list->schema_table_state && is_subselect)
2485
2485
      {
2486
 
        table_list->table->file->extra(HA_EXTRA_NO_CACHE);
2487
 
        table_list->table->file->extra(HA_EXTRA_RESET_STATE);
2488
 
        table_list->table->file->ha_delete_all_rows();
 
2486
        table_list->table->cursor->extra(HA_EXTRA_NO_CACHE);
 
2487
        table_list->table->cursor->extra(HA_EXTRA_RESET_STATE);
 
2488
        table_list->table->cursor->ha_delete_all_rows();
2489
2489
        table_list->table->free_io_cache();
2490
2490
        table_list->table->filesort_free_buffers(true);
2491
2491
        table_list->table->null_row= 0;
2492
2492
      }
2493
2493
      else
2494
 
        table_list->table->file->stats.records= 0;
 
2494
        table_list->table->cursor->stats.records= 0;
2495
2495
 
2496
2496
      if (table_list->schema_table->fillTable(session, table_list))
2497
2497
      {
2498
2498
        result= 1;
2499
2499
        join->error= 1;
2500
 
        tab->read_record.file= table_list->table->file;
 
2500
        tab->read_record.cursor= table_list->table->cursor;
2501
2501
        table_list->schema_table_state= executed_place;
2502
2502
        break;
2503
2503
      }
2504
 
      tab->read_record.file= table_list->table->file;
 
2504
      tab->read_record.cursor= table_list->table->cursor;
2505
2505
      table_list->schema_table_state= executed_place;
2506
2506
    }
2507
2507
  }