~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/info_schema_methods.cc

  • Committer: Brian Aker
  • Date: 2009-11-11 21:40:59 UTC
  • mfrom: (1208.3.3 reference)
  • mto: This revision was merged to the branch mainline in revision 1212.
  • Revision ID: brian@gaz-20091111214059-0xfxkwrrixpx2jd9
Update for cursor name change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
396
396
    Table *show_table= tables->table;
397
397
    KEY *key_info=show_table->key_info;
398
398
    uint32_t primary_key= show_table->s->primary_key;
399
 
    show_table->file->info(HA_STATUS_VARIABLE |
400
 
                           HA_STATUS_NO_LOCK |
401
 
                           HA_STATUS_TIME);
 
399
    show_table->cursor->info(HA_STATUS_VARIABLE |
 
400
                             HA_STATUS_NO_LOCK |
 
401
                             HA_STATUS_TIME);
402
402
    for (uint32_t i=0 ; i < show_table->s->keys ; i++, key_info++)
403
403
    {
404
404
      if (i != primary_key && !(key_info->flags & HA_NOSAME))
427
427
      }
428
428
    }
429
429
 
430
 
    show_table->file->get_foreign_key_list(session, &f_key_list);
 
430
    show_table->cursor->get_foreign_key_list(session, &f_key_list);
431
431
    FOREIGN_KEY_INFO *f_key_info;
432
432
    List_iterator_fast<FOREIGN_KEY_INFO> fkey_it(f_key_list);
433
433
    while ((f_key_info= fkey_it++))
756
756
  {
757
757
    List<FOREIGN_KEY_INFO> f_key_list;
758
758
    Table *show_table= tables->table;
759
 
    show_table->file->info(HA_STATUS_VARIABLE |
 
759
    show_table->cursor->info(HA_STATUS_VARIABLE |
760
760
                           HA_STATUS_NO_LOCK |
761
761
                           HA_STATUS_TIME);
762
762
 
763
 
    show_table->file->get_foreign_key_list(session, &f_key_list);
 
763
    show_table->cursor->get_foreign_key_list(session, &f_key_list);
764
764
    FOREIGN_KEY_INFO *f_key_info;
765
765
    List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
766
766
    while ((f_key_info= it++))
927
927
  {
928
928
    Table *show_table= tables->table;
929
929
    KEY *key_info=show_table->s->key_info;
930
 
    if (show_table->file)
 
930
    if (show_table->cursor)
931
931
    {
932
 
      show_table->file->info(HA_STATUS_VARIABLE |
933
 
                             HA_STATUS_NO_LOCK |
934
 
                             HA_STATUS_TIME);
 
932
      show_table->cursor->info(HA_STATUS_VARIABLE |
 
933
                               HA_STATUS_NO_LOCK |
 
934
                               HA_STATUS_TIME);
935
935
    }
936
936
    for (uint32_t i=0 ; i < show_table->s->keys ; i++,key_info++)
937
937
    {
950
950
        str=(key_part->field ? key_part->field->field_name :
951
951
             "?unknown field?");
952
952
        table->field[7]->store(str, strlen(str), cs);
953
 
        if (show_table->file)
 
953
        if (show_table->cursor)
954
954
        {
955
 
          if (show_table->file->index_flags(i, j, 0) & HA_READ_ORDER)
 
955
          if (show_table->cursor->index_flags(i, j, 0) & HA_READ_ORDER)
956
956
          {
957
957
            table->field[8]->store(((key_part->key_part_flag &
958
958
                                     HA_REVERSE_SORT) ?
962
962
          KEY *key=show_table->key_info+i;
963
963
          if (key->rec_per_key[j])
964
964
          {
965
 
            ha_rows records=(show_table->file->stats.records /
 
965
            ha_rows records=(show_table->cursor->stats.records /
966
966
                             key->rec_per_key[j]);
967
967
            table->field[9]->store((int64_t) records, true);
968
968
            table->field[9]->set_notnull();
969
969
          }
970
 
          str= show_table->file->index_type(i);
 
970
          str= show_table->cursor->index_type(i);
971
971
          table->field[13]->store(str, strlen(str), cs);
972
972
        }
973
973
        if ((key_part->field &&
1082
1082
    Table *show_table= tables->table;
1083
1083
    KEY *key_info=show_table->key_info;
1084
1084
    uint32_t primary_key= show_table->s->primary_key;
1085
 
    show_table->file->info(HA_STATUS_VARIABLE |
1086
 
                           HA_STATUS_NO_LOCK |
1087
 
                           HA_STATUS_TIME);
 
1085
    show_table->cursor->info(HA_STATUS_VARIABLE |
 
1086
                             HA_STATUS_NO_LOCK |
 
1087
                             HA_STATUS_TIME);
1088
1088
    for (uint32_t i=0 ; i < show_table->s->keys ; i++, key_info++)
1089
1089
    {
1090
1090
      if (i != primary_key && !(key_info->flags & HA_NOSAME))
1112
1112
      }
1113
1113
    }
1114
1114
 
1115
 
    show_table->file->get_foreign_key_list(session, &f_key_list);
 
1115
    show_table->cursor->get_foreign_key_list(session, &f_key_list);
1116
1116
    FOREIGN_KEY_INFO *f_key_info;
1117
1117
    List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
1118
1118
    while ((f_key_info=it++))
1163
1163
    char option_buff[400],*ptr;
1164
1164
    Table *show_table= tables->table;
1165
1165
    TableShare *share= show_table->s;
1166
 
    Cursor *file= show_table->file;
 
1166
    Cursor *cursor= show_table->cursor;
1167
1167
    drizzled::plugin::StorageEngine *tmp_db_type= share->db_type();
1168
1168
 
1169
1169
    if (share->tmp_table == SYSTEM_TMP_TABLE)
1223
1223
      table->field[20]->store(share->getComment(),
1224
1224
                              share->getCommentLength(), cs);
1225
1225
 
1226
 
    if(file)
 
1226
    if (cursor)
1227
1227
    {
1228
 
      file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO |
1229
 
                 HA_STATUS_NO_LOCK);
1230
 
      enum row_type row_type = file->get_row_type();
 
1228
      cursor->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO |
 
1229
                   HA_STATUS_NO_LOCK);
 
1230
      enum row_type row_type = cursor->get_row_type();
1231
1231
      switch (row_type) {
1232
1232
      case ROW_TYPE_NOT_USED:
1233
1233
      case ROW_TYPE_DEFAULT:
1258
1258
      table->field[6]->store(tmp_buff, strlen(tmp_buff), cs);
1259
1259
      if (! tables->schema_table)
1260
1260
      {
1261
 
        table->field[7]->store((int64_t) file->stats.records, true);
 
1261
        table->field[7]->store((int64_t) cursor->stats.records, true);
1262
1262
        table->field[7]->set_notnull();
1263
1263
      }
1264
 
      table->field[8]->store((int64_t) file->stats.mean_rec_length, true);
1265
 
      table->field[9]->store((int64_t) file->stats.data_file_length, true);
1266
 
      if (file->stats.max_data_file_length)
 
1264
      table->field[8]->store((int64_t) cursor->stats.mean_rec_length, true);
 
1265
      table->field[9]->store((int64_t) cursor->stats.data_file_length, true);
 
1266
      if (cursor->stats.max_data_file_length)
1267
1267
      {
1268
 
        table->field[10]->store((int64_t) file->stats.max_data_file_length,
 
1268
        table->field[10]->store((int64_t) cursor->stats.max_data_file_length,
1269
1269
                                true);
1270
1270
      }
1271
 
      table->field[11]->store((int64_t) file->stats.index_file_length, true);
1272
 
      table->field[12]->store((int64_t) file->stats.delete_length, true);
 
1271
      table->field[11]->store((int64_t) cursor->stats.index_file_length, true);
 
1272
      table->field[12]->store((int64_t) cursor->stats.delete_length, true);
1273
1273
      if (show_table->found_next_number_field)
1274
1274
      {
1275
 
        table->field[13]->store((int64_t) file->stats.auto_increment_value,
1276
 
                                true);
 
1275
        table->field[13]->store((int64_t) cursor->stats.auto_increment_value, true);
1277
1276
        table->field[13]->set_notnull();
1278
1277
      }
1279
 
      if (file->stats.create_time)
 
1278
      if (cursor->stats.create_time)
1280
1279
      {
1281
1280
        session->variables.time_zone->gmt_sec_to_TIME(&time,
1282
 
                                                  (time_t) file->stats.create_time);
 
1281
                                                  (time_t) cursor->stats.create_time);
1283
1282
        table->field[14]->store_time(&time, DRIZZLE_TIMESTAMP_DATETIME);
1284
1283
        table->field[14]->set_notnull();
1285
1284
      }
1286
 
      if (file->stats.update_time)
 
1285
      if (cursor->stats.update_time)
1287
1286
      {
1288
1287
        session->variables.time_zone->gmt_sec_to_TIME(&time,
1289
 
                                                  (time_t) file->stats.update_time);
 
1288
                                                  (time_t) cursor->stats.update_time);
1290
1289
        table->field[15]->store_time(&time, DRIZZLE_TIMESTAMP_DATETIME);
1291
1290
        table->field[15]->set_notnull();
1292
1291
      }
1293
 
      if (file->stats.check_time)
 
1292
      if (cursor->stats.check_time)
1294
1293
      {
1295
1294
        session->variables.time_zone->gmt_sec_to_TIME(&time,
1296
 
                                                  (time_t) file->stats.check_time);
 
1295
                                                  (time_t) cursor->stats.check_time);
1297
1296
        table->field[16]->store_time(&time, DRIZZLE_TIMESTAMP_DATETIME);
1298
1297
        table->field[16]->set_notnull();
1299
1298
      }
1300
 
      if (file->ha_table_flags() & (ulong) HA_HAS_CHECKSUM)
 
1299
      if (cursor->ha_table_flags() & (ulong) HA_HAS_CHECKSUM)
1301
1300
      {
1302
 
        table->field[18]->store((int64_t) file->checksum(), true);
 
1301
        table->field[18]->store((int64_t) cursor->checksum(), true);
1303
1302
        table->field[18]->set_notnull();
1304
1303
      }
1305
1304
    }