~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/instance/base.cc

  • Committer: Mark Atwood
  • Date: 2011-08-04 16:21:21 UTC
  • mfrom: (2318.9.14 refactor3)
  • Revision ID: me@mark.atwood.name-20110804162121-6b9ay1b1de3yfgvl
mergeĀ lp:~olafvdspek/drizzle/refactor3

Show diffs side-by-side

added added

removed removed

Lines of Context:
297
297
{
298
298
  if (type_arg == message::Table::INTERNAL)
299
299
  {
300
 
    identifier::Table::build_tmptable_filename(private_key_for_cache.vectorPtr());
 
300
    string s= identifier::Table::build_tmptable_filename();
 
301
    private_key_for_cache.vectorPtr().assign(s.c_str(), s.c_str() + s.size() + 1);
301
302
    init(private_key_for_cache.vector(), private_key_for_cache.vector());
302
303
  }
303
304
  else
455
456
*/
456
457
TableShare::TableShare(const identifier::Table::Type type_arg,
457
458
                       const identifier::Table &identifier,
458
 
                       char *path_arg,
 
459
                       const char *path_arg,
459
460
                       uint32_t path_length_arg) :
460
461
  table_category(TABLE_UNKNOWN_CATEGORY),
461
462
  found_next_number_field(NULL),
507
508
  keys_in_use(0),
508
509
  keys_for_keyread(0)
509
510
{
510
 
  char *path_buff;
 
511
 
 
512
  private_key_for_cache= identifier.getKey();
 
513
  /*
 
514
    Let us use the fact that the key is "db/0/table_name/0" + optional
 
515
    part for temporary tables.
 
516
  */
 
517
  db.str= const_cast<char *>(private_key_for_cache.vector());
 
518
  db.length=         strlen(db.str);
 
519
  table_name.str=    db.str + db.length + 1;
 
520
  table_name.length= strlen(table_name.str);
 
521
 
511
522
  std::string _path;
512
 
 
513
 
  private_key_for_cache= identifier.getKey();
514
 
  /*
515
 
    Let us use the fact that the key is "db/0/table_name/0" + optional
516
 
    part for temporary tables.
517
 
  */
518
 
  db.str= const_cast<char *>(private_key_for_cache.vector());
519
 
  db.length=         strlen(db.str);
520
 
  table_name.str=    db.str + db.length + 1;
521
 
  table_name.length= strlen(table_name.str);
522
 
 
523
523
  if (path_arg)
524
524
  {
525
 
    _path.append(path_arg, path_length_arg);
 
525
    _path.assign(path_arg, path_length_arg);
526
526
  }
527
527
  else
528
528
  {
529
 
    identifier::Table::build_table_filename(_path, db.str, table_name.str, false);
 
529
    _path= identifier::Table::build_table_filename(db.str, table_name.str, false);
530
530
  }
531
531
 
532
 
  path_buff= (char *)mem_root.alloc(_path.length() + 1);
 
532
  char* path_buff= mem_root.strdup(_path);
533
533
  setPath(path_buff, _path.length());
534
 
  strcpy(path_buff, _path.c_str());
535
534
  setNormalizedPath(path_buff, _path.length());
536
535
 
537
536
  version= g_refresh_version;
610
609
  db_create_options= (local_db_create_options & 0x0000FFFF);
611
610
  db_options_in_use= db_create_options;
612
611
 
613
 
  block_size= table_options.has_block_size() ?
614
 
    table_options.block_size() : 0;
 
612
  block_size= table_options.has_block_size() ? table_options.block_size() : 0;
615
613
 
616
614
  table_charset= get_charset(table_options.collation_id());
617
615
 
764
762
    {
765
763
      keyinfo->flags|= HA_USES_COMMENT;
766
764
      keyinfo->comment.length= indx.comment().length();
767
 
      keyinfo->comment.str= strmake(indx.comment().c_str(), keyinfo->comment.length);
 
765
      keyinfo->comment.str= strdup(indx.comment().c_str(), keyinfo->comment.length);
768
766
    }
769
767
 
770
 
    keyinfo->name= strmake(indx.name().c_str(), indx.name().length());
 
768
    keyinfo->name= strdup(indx.name().c_str(), indx.name().length());
771
769
 
772
770
    addKeyName(string(keyinfo->name, indx.name().length()));
773
771
  }
933
931
 
934
932
    for (int n= 0; n < field_options.field_value_size(); n++)
935
933
    {
936
 
      t->type_names[n]= strmake(field_options.field_value(n).c_str(), field_options.field_value(n).length());
 
934
      t->type_names[n]= strdup(field_options.field_value(n).c_str(), field_options.field_value(n).length());
937
935
 
938
936
      /* 
939
937
       * Go ask the charset what the length is as for "" length=1
1006
1004
      size_t len= pfield.comment().length();
1007
1005
      const char* str= pfield.comment().c_str();
1008
1006
 
1009
 
      comment.str= strmake(str, len);
 
1007
      comment.str= strdup(str, len);
1010
1008
      comment.length= len;
1011
1009
    }
1012
1010