~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.cc

  • Committer: devananda
  • Date: 2009-06-30 14:27:54 UTC
  • mfrom: (1030.2.4 trunk)
  • mto: (1093.1.7 captain)
  • mto: This revision was merged to the branch mainline in revision 1095.
  • Revision ID: devananda.vdv@gmail.com-20090630142754-vm9w374yxkf1pikc
mergeĀ fromĀ lp

Show diffs side-by-side

added added

removed removed

Lines of Context:
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>
31
31
 
1255
1255
}
1256
1256
 
1257
1257
 
1258
 
bool ha_myisam::check_and_repair(Session *session)
1259
 
{
1260
 
  int error=0;
1261
 
  int marked_crashed;
1262
 
  char *old_query;
1263
 
  uint32_t old_query_length;
1264
 
  HA_CHECK_OPT check_opt;
1265
 
 
1266
 
  check_opt.init();
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);
1272
 
 
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);
1279
 
 
1280
 
  if ((marked_crashed= mi_is_crashed(file)) || check(session, &check_opt))
1281
 
  {
1282
 
    errmsg_printf(ERRMSG_LVL_WARN, "Recovering table: '%s'",table->s->path.str);
1283
 
    check_opt.flags=
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) |
1287
 
       T_AUTO_REPAIR);
1288
 
    if (repair(session, &check_opt))
1289
 
      error=1;
1290
 
  }
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);
1295
 
  return(error);
1296
 
}
1297
1258
 
1298
1259
bool ha_myisam::is_crashed() const
1299
1260
{