~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.cc

mergeĀ fromĀ lp

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
** MyISAM tables
61
61
*****************************************************************************/
62
62
 
 
63
static const char *ha_myisam_exts[] = {
 
64
  ".MYI",
 
65
  ".MYD",
 
66
  NULL
 
67
};
 
68
 
63
69
class MyisamEngine : public StorageEngine
64
70
{
65
71
public:
71
77
  {
72
78
    return new (mem_root) ha_myisam(this, table);
73
79
  }
 
80
 
 
81
  const char **bas_ext() const {
 
82
    return ha_myisam_exts;
 
83
  }
 
84
 
 
85
  int createTableImpl(Session *, const char *table_name,
 
86
                      Table *table_arg, HA_CREATE_INFO *ha_create_info);
 
87
 
 
88
  int renameTableImpl(Session*, const char *from, const char *to);
 
89
 
 
90
  int deleteTableImpl(Session*, const string table_name);
74
91
};
75
92
 
76
93
// collect errors printed by mi_check routines
110
127
    push_warning).
111
128
  */
112
129
  protocol->prepareForResend();
113
 
  protocol->store(name, length, system_charset_info);
114
 
  protocol->store(param->op_name, system_charset_info);
115
 
  protocol->store(msg_type, system_charset_info);
116
 
  protocol->store(msgbuf, msg_length, system_charset_info);
 
130
  protocol->store(name, length);
 
131
  protocol->store(param->op_name);
 
132
  protocol->store(msg_type);
 
133
  protocol->store(msgbuf, msg_length);
117
134
  if (protocol->write())
118
135
    errmsg_printf(ERRMSG_LVL_ERROR, "Failed on drizzleclient_net_write, writing to stderr instead: %s\n",
119
136
                    msgbuf);
506
523
  return new_handler;
507
524
}
508
525
 
509
 
 
510
 
static const char *ha_myisam_exts[] = {
511
 
  ".MYI",
512
 
  ".MYD",
513
 
  NULL
514
 
};
515
 
 
516
 
const char **ha_myisam::bas_ext() const
517
 
{
518
 
  return ha_myisam_exts;
519
 
}
520
 
 
521
 
 
522
526
const char *ha_myisam::index_type(uint32_t )
523
527
{
524
528
  return "BTREE";
871
875
  strcpy(fixed_name,file->filename);
872
876
 
873
877
  // Don't lock tables if we have used LOCK Table
874
 
  if (!session->locked_tables &&
875
 
      mi_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))
 
878
  if (mi_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))
876
879
  {
877
880
    mi_check_print_error(&param,ER(ER_CANT_LOCK),my_errno);
878
881
    return(HA_ADMIN_FAILED);
981
984
    update_state_info(&param, file, 0);
982
985
  }
983
986
  session->set_proc_info(old_proc_info);
984
 
  if (!session->locked_tables)
985
 
    mi_lock_database(file,F_UNLCK);
 
987
  mi_lock_database(file,F_UNLCK);
 
988
 
986
989
  return(error ? HA_ADMIN_FAILED :
987
990
              !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK);
988
991
}
1601
1604
  return mi_delete_all_rows(file);
1602
1605
}
1603
1606
 
1604
 
int ha_myisam::delete_table(const char *name)
 
1607
int MyisamEngine::deleteTableImpl(Session*, const string table_name)
1605
1608
{
1606
 
  return mi_delete_table(name);
 
1609
  return mi_delete_table(table_name.c_str());
1607
1610
}
1608
1611
 
1609
1612
 
1622
1625
  if (lock_type != TL_IGNORE && file->lock.type == TL_UNLOCK)
1623
1626
    file->lock.type=lock_type;
1624
1627
  *to++= &file->lock;
 
1628
 
1625
1629
  return to;
1626
1630
}
1627
1631
 
1637
1641
}
1638
1642
 
1639
1643
 
1640
 
int ha_myisam::create(const char *name, register Table *table_arg,
1641
 
                      HA_CREATE_INFO *ha_create_info)
 
1644
int MyisamEngine::createTableImpl(Session *, const char *table_name,
 
1645
                                  Table *table_arg,
 
1646
                                  HA_CREATE_INFO *ha_create_info)
1642
1647
{
1643
1648
  int error;
1644
1649
  uint32_t create_flags= 0, create_records;
1675
1680
    create_flags|= HA_CREATE_DELAY_KEY_WRITE;
1676
1681
 
1677
1682
  /* TODO: Check that the following fn_format is really needed */
1678
 
  error= mi_create(fn_format(buff, name, "", "",
 
1683
  error= mi_create(fn_format(buff, table_name, "", "",
1679
1684
                             MY_UNPACK_FILENAME|MY_APPEND_EXT),
1680
1685
                   share->keys, keydef,
1681
1686
                   create_records, recinfo,
1686
1691
}
1687
1692
 
1688
1693
 
1689
 
int ha_myisam::rename_table(const char * from, const char * to)
 
1694
int MyisamEngine::renameTableImpl(Session*, const char *from, const char *to)
1690
1695
{
1691
1696
  return mi_rename(from,to);
1692
1697
}