Commit c187798f authored by jan@hundin.mysql.fi's avatar jan@hundin.mysql.fi

Print a error message if the handler don't support transactional table

locks (LOCK TABLES ... WHERE ENGINE = ).
 
parent ee4f2783
...@@ -452,7 +452,13 @@ public: ...@@ -452,7 +452,13 @@ public:
{ return extra(operation); } { return extra(operation); }
virtual int reset() { return extra(HA_EXTRA_RESET); } virtual int reset() { return extra(HA_EXTRA_RESET); }
virtual int external_lock(THD *thd, int lock_type) { return 0; } virtual int external_lock(THD *thd, int lock_type) { return 0; }
virtual int transactional_table_lock(THD *thd, int lock_type) {return 0;} /*
This is called to set transactional table lock to a table.
If the handler don't support this, then this function will
return HA_ERR_WRONG_COMMAND and MySQL will give
ER_ILLEGAL_HA error message.
*/
virtual int transactional_table_lock(THD *thd, int lock_type) {return HA_ERR_WRONG_COMMAND;}
virtual void unlock_row() {} virtual void unlock_row() {}
virtual int start_stmt(THD *thd) {return 0;} virtual int start_stmt(THD *thd) {return 0;}
/* /*
......
...@@ -79,7 +79,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count, ...@@ -79,7 +79,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count,
bool unlock, TABLE **write_locked); bool unlock, TABLE **write_locked);
static int lock_external(THD *thd, TABLE **table,uint count); static int lock_external(THD *thd, TABLE **table,uint count);
static int unlock_external(THD *thd, TABLE **table,uint count); static int unlock_external(THD *thd, TABLE **table,uint count);
static void print_lock_error(int error); static void print_lock_error(int error, const char *);
MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count) MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count)
...@@ -187,7 +187,7 @@ static int lock_external(THD *thd, TABLE **tables, uint count) ...@@ -187,7 +187,7 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
(*tables)->file->external_lock(thd, F_UNLCK); (*tables)->file->external_lock(thd, F_UNLCK);
(*tables)->current_lock=F_UNLCK; (*tables)->current_lock=F_UNLCK;
} }
print_lock_error(error); print_lock_error(error, (*tables)->file->table_type());
DBUG_RETURN(error); DBUG_RETURN(error);
} }
else else
...@@ -380,7 +380,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count) ...@@ -380,7 +380,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
table++; table++;
} while (--count); } while (--count);
if (error_code) if (error_code)
print_lock_error(error_code); print_lock_error(error_code, (*table)->file->table_type());
DBUG_RETURN(error_code); DBUG_RETURN(error_code);
} }
...@@ -683,7 +683,7 @@ void unlock_table_names(THD *thd, TABLE_LIST *table_list, ...@@ -683,7 +683,7 @@ void unlock_table_names(THD *thd, TABLE_LIST *table_list,
} }
static void print_lock_error(int error) static void print_lock_error(int error, const char *table)
{ {
int textno; int textno;
DBUG_ENTER("print_lock_error"); DBUG_ENTER("print_lock_error");
...@@ -698,11 +698,19 @@ static void print_lock_error(int error) ...@@ -698,11 +698,19 @@ static void print_lock_error(int error)
case HA_ERR_LOCK_DEADLOCK: case HA_ERR_LOCK_DEADLOCK:
textno=ER_LOCK_DEADLOCK; textno=ER_LOCK_DEADLOCK;
break; break;
case HA_ERR_WRONG_COMMAND:
textno=ER_ILLEGAL_HA;
break;
default: default:
textno=ER_CANT_LOCK; textno=ER_CANT_LOCK;
break; break;
} }
my_error(textno,MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG),error);
if ( textno == ER_ILLEGAL_HA )
my_error(textno, MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG), table);
else
my_error(textno, MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG), error);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -977,7 +985,7 @@ int transactional_lock_tables(THD *thd, TABLE_LIST *tables, uint counter) ...@@ -977,7 +985,7 @@ int transactional_lock_tables(THD *thd, TABLE_LIST *tables, uint counter)
if ((error=(*start)->file->transactional_table_lock(thd, lock_type))) if ((error=(*start)->file->transactional_table_lock(thd, lock_type)))
{ {
print_lock_error(error); print_lock_error(error, (*start)->file->table_type());
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment