~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/myisamchk.cc

  • Committer: Toru Maesaka
  • Date: 2008-12-05 10:24:51 UTC
  • mto: (656.1.5 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: dev@torum.net-20081205102451-4rpk620bh6oeim49
Final pass of replacing MySQL's my_stpcpy() with appropriate libc calls

Show diffs side-by-side

added added

removed removed

Lines of Context:
1156
1156
  else
1157
1157
    puts("Fixed length");
1158
1158
  printf("Character set:       %s (%d)\n",
1159
 
         get_charset_name(share->state.header.language),
1160
 
         share->state.header.language);
 
1159
  get_charset_name(share->state.header.language),
 
1160
  share->state.header.language);
1161
1161
 
1162
1162
  if (param->testflag & T_VERBOSE)
1163
1163
  {
1175
1175
    }
1176
1176
    pos=buff;
1177
1177
    if (share->state.changed & STATE_CRASHED)
1178
 
      my_stpcpy(buff,"crashed");
 
1178
      strcpy(buff,"crashed");
1179
1179
    else
1180
1180
    {
1181
1181
      if (share->state.open_count)
1182
 
        pos=my_stpcpy(pos,"open,");
 
1182
        pos= strcpy(pos,"open,")+5;
1183
1183
      if (share->state.changed & STATE_CHANGED)
1184
 
        pos=my_stpcpy(pos,"changed,");
 
1184
        pos= strcpy(pos,"changed,")+8;
1185
1185
      else
1186
 
        pos=my_stpcpy(pos,"checked,");
 
1186
        pos= strcpy(pos,"checked,")+8;
1187
1187
      if (!(share->state.changed & STATE_NOT_ANALYZED))
1188
 
        pos=my_stpcpy(pos,"analyzed,");
 
1188
        pos= strcpy(pos,"analyzed,")+9;
1189
1189
      if (!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
1190
 
        pos=my_stpcpy(pos,"optimized keys,");
 
1190
        pos= strcpy(pos,"optimized keys,")+15;
1191
1191
      if (!(share->state.changed & STATE_NOT_SORTED_PAGES))
1192
 
        pos=my_stpcpy(pos,"sorted index pages,");
 
1192
        pos= strcpy(pos,"sorted index pages,")+19;
1193
1193
      pos[-1]=0;                                /* Remove extra ',' */
1194
1194
    }      
1195
1195
    printf("Status:              %s\n",buff);
1207
1207
 
1208
1208
  }
1209
1209
  printf("Data records:        %13s  Deleted blocks:     %13s\n",
1210
 
         llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2));
 
1210
  llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2));
1211
1211
  if (param->testflag & T_SILENT)
1212
1212
    return;                             /* This is enough */
1213
1213
 
1217
1217
    printf("Init-relocation:     %13s\n",llstr(share->base.reloc,llbuff));
1218
1218
#endif
1219
1219
    printf("Datafile parts:      %13s  Deleted data:       %13s\n",
1220
 
           llstr(share->state.split,llbuff),
1221
 
           llstr(info->state->empty,llbuff2));
 
1220
    llstr(share->state.split,llbuff),
 
1221
    llstr(info->state->empty,llbuff2));
1222
1222
    printf("Datafile pointer (bytes):%9d  Keyfile pointer (bytes):%9d\n",
1223
 
           share->rec_reflength,share->base.key_reflength);
 
1223
    share->rec_reflength,share->base.key_reflength);
1224
1224
    printf("Datafile length:     %13s  Keyfile length:     %13s\n",
1225
 
           llstr(info->state->data_file_length,llbuff),
1226
 
           llstr(info->state->key_file_length,llbuff2));
 
1225
    llstr(info->state->data_file_length,llbuff),
 
1226
    llstr(info->state->key_file_length,llbuff2));
1227
1227
 
1228
1228
    if (info->s->base.reloc == 1L && info->s->base.records == 1L)
1229
1229
      puts("This is a one-record table");
1230
1230
    else
1231
1231
    {
1232
1232
      if (share->base.max_data_file_length != HA_OFFSET_ERROR ||
1233
 
          share->base.max_key_file_length != HA_OFFSET_ERROR)
1234
 
        printf("Max datafile length: %13s  Max keyfile length: %13s\n",
1235
 
               llstr(share->base.max_data_file_length-1,llbuff),
1236
 
               llstr(share->base.max_key_file_length-1,llbuff2));
 
1233
          share->base.max_key_file_length != HA_OFFSET_ERROR)
 
1234
        printf("Max datafile length: %13s  Max keyfile length: %13s\n",
 
1235
                     llstr(share->base.max_data_file_length-1,llbuff),
 
1236
                     llstr(share->base.max_key_file_length-1,llbuff2));
1237
1237
    }
1238
1238
  }
1239
1239
 
1242
1242
  {
1243
1243
    int64_t2str(share->state.key_map,buff,2);
1244
1244
    printf("Using only keys '%s' of %d possibly keys\n",
1245
 
           buff, share->base.keys);
 
1245
    buff, share->base.keys);
1246
1246
  }
1247
1247
  puts("\ntable description:");
1248
1248
  printf("Key Start Len Index   Type");
1261
1261
    pos=buff;
1262
1262
    if (keyseg->flag & HA_REVERSE_SORT)
1263
1263
      *pos++ = '-';
1264
 
    pos=my_stpcpy(pos,type_names[keyseg->type]);
 
1264
    pos= strcpy(pos,type_names[keyseg->type]);
 
1265
    pos+= strlen(type_names[keyseg->type]);
1265
1266
    *pos++ = ' ';
1266
1267
    *pos=0;
1267
1268
    if (keyinfo->flag & HA_PACK_KEY)
1268
 
      pos=my_stpcpy(pos,prefix_packed_txt);
 
1269
      pos= strcpy(pos,prefix_packed_txt) + strlen(prefix_packed_txt);
1269
1270
    if (keyinfo->flag & HA_BINARY_PACK_KEY)
1270
 
      pos=my_stpcpy(pos,bin_packed_txt);
 
1271
      pos= strcpy(pos,bin_packed_txt) + strlen(bin_packed_txt);
1271
1272
    if (keyseg->flag & HA_SPACE_PACK)
1272
 
      pos=my_stpcpy(pos,diff_txt);
 
1273
      pos= strcpy(pos,diff_txt) + strlen(diff_txt);
1273
1274
    if (keyseg->flag & HA_BLOB_PART)
1274
 
      pos=my_stpcpy(pos,blob_txt);
 
1275
      pos= strcpy(pos,blob_txt) + strlen(blob_txt);
1275
1276
    if (keyseg->flag & HA_NULL_PART)
1276
 
      pos=my_stpcpy(pos,null_txt);
 
1277
      pos= strcpy(pos,null_txt) + strlen(null_txt);
1277
1278
    *pos=0;
1278
1279
 
1279
1280
    printf("%-4d%-6ld%-3d %-8s%-21s",
1280
 
           key+1,(long) keyseg->start+1,keyseg->length,text,buff);
 
1281
           key+1,(long) keyseg->start+1,keyseg->length,text,buff);
1281
1282
    if (share->state.key_root[key] != HA_OFFSET_ERROR)
1282
1283
      llstr(share->state.key_root[key],buff);
1283
1284
    else
1284
1285
      buff[0]=0;
1285
1286
    if (param->testflag & T_VERBOSE)
1286
1287
      printf("%11lu %12s %10d",
1287
 
             share->state.rec_per_key_part[keyseg_nr++],
1288
 
             buff,keyinfo->block_length);
 
1288
    share->state.rec_per_key_part[keyseg_nr++],
 
1289
    buff,keyinfo->block_length);
1289
1290
    putchar('\n');
1290
1291
    while ((++keyseg)->type != HA_KEYTYPE_END)
1291
1292
    {
1292
1293
      pos=buff;
1293
1294
      if (keyseg->flag & HA_REVERSE_SORT)
1294
 
        *pos++ = '-';
1295
 
      pos=my_stpcpy(pos,type_names[keyseg->type]);
 
1295
        *pos++ = '-';
 
1296
      pos= strcpy(pos,type_names[keyseg->type]);
 
1297
      pos+= strlen(type_names[keyseg->type]);
1296
1298
      *pos++= ' ';
1297
1299
      if (keyseg->flag & HA_SPACE_PACK)
1298
 
        pos=my_stpcpy(pos,diff_txt);
 
1300
        pos= strcpy(pos,diff_txt) + strlen(diff_txt);
1299
1301
      if (keyseg->flag & HA_BLOB_PART)
1300
 
        pos=my_stpcpy(pos,blob_txt);
 
1302
        pos= strcpy(pos,blob_txt) + strlen(blob_txt);
1301
1303
      if (keyseg->flag & HA_NULL_PART)
1302
 
        pos=my_stpcpy(pos,null_txt);
 
1304
        pos= strcpy(pos,null_txt) + strlen(null_txt);
1303
1305
      *pos=0;
1304
1306
      printf("    %-6ld%-3d         %-21s",
1305
1307
             (long) keyseg->start+1,keyseg->length,buff);
1306
1308
      if (param->testflag & T_VERBOSE)
1307
 
        printf("%11lu", share->state.rec_per_key_part[keyseg_nr++]);
 
1309
        printf("%11lu", share->state.rec_per_key_part[keyseg_nr++]);
1308
1310
      putchar('\n');
1309
1311
    }
1310
1312
    keyseg++;
1314
1316
    MI_UNIQUEDEF *uniqueinfo;
1315
1317
    puts("\nUnique  Key  Start  Len  Nullpos  Nullbit  Type");
1316
1318
    for (key=0,uniqueinfo= &share->uniqueinfo[0] ;
1317
 
         key < share->state.header.uniques; key++, uniqueinfo++)
 
1319
         key < share->state.header.uniques; key++, uniqueinfo++)
1318
1320
    {
1319
1321
      bool new_row=0;
1320
1322
      char null_bit[8],null_pos[8];
1321
1323
      printf("%-8d%-5d",key+1,uniqueinfo->key+1);
1322
1324
      for (keyseg=uniqueinfo->seg ; keyseg->type != HA_KEYTYPE_END ; keyseg++)
1323
1325
      {
1324
 
        if (new_row)
1325
 
          fputs("             ",stdout);
1326
 
        null_bit[0]=null_pos[0]=0;
1327
 
        if (keyseg->null_bit)
1328
 
        {
1329
 
          sprintf(null_bit,"%d",keyseg->null_bit);
1330
 
          sprintf(null_pos,"%ld",(long) keyseg->null_pos+1);
1331
 
        }
1332
 
        printf("%-7ld%-5d%-9s%-10s%-30s\n",
1333
 
               (long) keyseg->start+1,keyseg->length,
1334
 
               null_pos,null_bit,
1335
 
               type_names[keyseg->type]);
1336
 
        new_row=1;
 
1326
        if (new_row)
 
1327
          fputs("             ",stdout);
 
1328
        null_bit[0]=null_pos[0]=0;
 
1329
        if (keyseg->null_bit)
 
1330
        {
 
1331
          sprintf(null_bit,"%d",keyseg->null_bit);
 
1332
          sprintf(null_pos,"%ld",(long) keyseg->null_pos+1);
 
1333
        }
 
1334
        printf("%-7ld%-5d%-9s%-10s%-30s\n",
 
1335
               (long) keyseg->start+1,keyseg->length,
 
1336
               null_pos,null_bit,
 
1337
               type_names[keyseg->type]);
 
1338
        new_row=1;
1337
1339
      }
1338
1340
    }
1339
1341
  }
1348
1350
    for (field=0 ; field < share->base.fields ; field++)
1349
1351
    {
1350
1352
      if (share->options & HA_OPTION_COMPRESS_RECORD)
1351
 
        type=share->rec[field].base_type;
 
1353
        type=share->rec[field].base_type;
1352
1354
      else
1353
 
        type=(enum en_fieldtype) share->rec[field].type;
1354
 
      end=my_stpcpy(buff,field_pack[type]);
 
1355
        type=(enum en_fieldtype) share->rec[field].type;
 
1356
      end= strcpy(buff, field_pack[type]);
 
1357
      end+= strlen(field_pack[type]);
1355
1358
      if (share->options & HA_OPTION_COMPRESS_RECORD)
1356
1359
      {
1357
 
        if (share->rec[field].pack_type & PACK_TYPE_SELECTED)
1358
 
          end=my_stpcpy(end,", not_always");
1359
 
        if (share->rec[field].pack_type & PACK_TYPE_SPACE_FIELDS)
1360
 
          end=my_stpcpy(end,", no empty");
1361
 
        if (share->rec[field].pack_type & PACK_TYPE_ZERO_FILL)
1362
 
        {
1363
 
          sprintf(end,", zerofill(%d)",share->rec[field].space_length_bits);
1364
 
          end= strchr(end, '\0');
1365
 
        }
 
1360
        if (share->rec[field].pack_type & PACK_TYPE_SELECTED)
 
1361
          end= strcpy(end,", not_always")+12;
 
1362
        if (share->rec[field].pack_type & PACK_TYPE_SPACE_FIELDS)
 
1363
          end= strcpy(end,", no empty")+10;
 
1364
        if (share->rec[field].pack_type & PACK_TYPE_ZERO_FILL)
 
1365
        {
 
1366
          sprintf(end,", zerofill(%d)",share->rec[field].space_length_bits);
 
1367
          end= strchr(end, '\0');
 
1368
        }
1366
1369
      }
1367
1370
      if (buff[0] == ',')
1368
 
        my_stpcpy(buff,buff+2);
 
1371
        strcpy(buff,buff+2);
1369
1372
      int10_to_str((long) share->rec[field].length,length,10);
1370
1373
      null_bit[0]=null_pos[0]=0;
1371
1374
      if (share->rec[field].null_bit)
1372
1375
      {
1373
 
        sprintf(null_bit,"%d",share->rec[field].null_bit);
1374
 
        sprintf(null_pos,"%d",share->rec[field].null_pos+1);
 
1376
        sprintf(null_bit,"%d",share->rec[field].null_bit);
 
1377
        sprintf(null_pos,"%d",share->rec[field].null_pos+1);
1375
1378
      }
1376
1379
      printf("%-6d%-6d%-7s%-8s%-8s%-35s",field+1,start,length,
1377
1380
             null_pos, null_bit, buff);