Navigation Menu

Skip to content

Commit

Permalink
mysql5.1: make buildable but alter_table_disable_enable_keys still fails
Browse files Browse the repository at this point in the history
refs #1310 #1311
  • Loading branch information
kou committed May 7, 2012
1 parent 7f3cbac commit 46f82eb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/mrn_auto_increment_value_lock.cpp
Expand Up @@ -19,18 +19,24 @@

#include "mrn_auto_increment_value_lock.hpp"

#if MYSQL_VERSION_ID >= 50500
# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->LOCK_ha_data))
#else
# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->mutex))
#endif

namespace mrn {
AutoIncrementValueLock::AutoIncrementValueLock(TABLE_SHARE *table_share)
: table_share_(table_share),
need_lock_(table_share_->tmp_table == NO_TMP_TABLE) {
if (need_lock_) {
mysql_mutex_lock(&table_share_->LOCK_ha_data);
mysql_mutex_lock(AUTO_INCREMENT_VALUE_MUTEX(table_share_));
}
}

AutoIncrementValueLock::~AutoIncrementValueLock() {
if (need_lock_) {
mysql_mutex_unlock(&table_share_->LOCK_ha_data);
mysql_mutex_unlock(AUTO_INCREMENT_VALUE_MUTEX(table_share_));
}
}
}

0 comments on commit 46f82eb

Please sign in to comment.