25
25
#include <drizzled/errmsg_print.h>
26
26
#include <drizzled/gettext.h>
27
27
#include <drizzled/session.h>
28
#include <drizzled/protocol.h>
28
#include <drizzled/plugin/protocol.h>
29
29
#include <drizzled/table.h>
30
30
#include <drizzled/field/timestamp.h>
1258
bool ha_myisam::check_and_repair(Session *session)
1263
uint32_t old_query_length;
1264
HA_CHECK_OPT check_opt;
1267
check_opt.flags= T_MEDIUM | T_AUTO_REPAIR;
1268
// Don't use quick if deleted rows
1269
if (!file->state->del && (myisam_recover_options & HA_RECOVER_QUICK))
1270
check_opt.flags|=T_QUICK;
1271
errmsg_printf(ERRMSG_LVL_WARN, "Checking table: '%s'",table->s->path.str);
1273
old_query= session->query;
1274
old_query_length= session->query_length;
1275
pthread_mutex_lock(&LOCK_thread_count);
1276
session->query= table->s->table_name.str;
1277
session->query_length= table->s->table_name.length;
1278
pthread_mutex_unlock(&LOCK_thread_count);
1280
if ((marked_crashed= mi_is_crashed(file)) || check(session, &check_opt))
1282
errmsg_printf(ERRMSG_LVL_WARN, "Recovering table: '%s'",table->s->path.str);
1284
((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) |
1285
(marked_crashed ? 0 : T_QUICK) |
1286
(myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) |
1288
if (repair(session, &check_opt))
1291
pthread_mutex_lock(&LOCK_thread_count);
1292
session->query= old_query;
1293
session->query_length= old_query_length;
1294
pthread_mutex_unlock(&LOCK_thread_count);
1298
1259
bool ha_myisam::is_crashed() const