1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

ha_innodb.cc, ha_innodb.h:

Fix assertion when a temporary table is created and used inside LOCK TABLES
This commit is contained in:
heikki@hundin.mysql.fi
2002-09-20 23:26:21 +03:00
parent 12bf4a08a0
commit cff9c1df1e
2 changed files with 38 additions and 2 deletions

View File

@ -3638,10 +3638,43 @@ ha_innobase::reset(void)
return(0); return(0);
} }
/**********************************************************************
When we create a temporary table inside MySQL LOCK TABLES, MySQL will
not call external_lock for the temporary table when it uses it. Instead,
it will call this function. */
int
start_stmt(
/*=======*/
/* out: 0 or error code */
THD* thd) /* in: handle to the user thread */
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
DBUG_ENTER("ha_innobase::external_lock");
update_thd(thd);
trx = prebuilt->trx;
innobase_release_stat_resources(trx);
trx_mark_sql_stat_end(trx);
auto_inc_counter_for_this_stat = 0;
prebuilt->sql_stat_start = TRUE;
prebuilt->hint_no_need_to_fetch_extra_cols = TRUE;
prebuilt->read_just_key = 0;
prebuilt->select_lock_type = LOCK_NONE;
thd->transaction.all.innodb_active_trans = 1;
}
/********************************************************************** /**********************************************************************
As MySQL will execute an external lock for every new table it uses when it As MySQL will execute an external lock for every new table it uses when it
starts to process an SQL statement, we can use this function to store the starts to process an SQL statement (an exception is when MySQL calls
pointer to the THD in the handle. We will also use this function to communicate start_stmt for the handle) we can use this function to store the pointer to
the THD in the handle. We will also use this function to communicate
to InnoDB that a new SQL statement has started and that we must store a to InnoDB that a new SQL statement has started and that we must store a
savepoint to our transaction handle, so that we are able to roll back savepoint to our transaction handle, so that we are able to roll back
the SQL statement in case of an error. */ the SQL statement in case of an error. */
@ -3649,6 +3682,7 @@ the SQL statement in case of an error. */
int int
ha_innobase::external_lock( ha_innobase::external_lock(
/*=======================*/ /*=======================*/
/* out: 0 or error code */
THD* thd, /* in: handle to the user thread */ THD* thd, /* in: handle to the user thread */
int lock_type) /* in: lock type */ int lock_type) /* in: lock type */
{ {

View File

@ -146,6 +146,8 @@ class ha_innobase: public handler
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation);
int reset(void); int reset(void);
int external_lock(THD *thd, int lock_type); int external_lock(THD *thd, int lock_type);
int start_stmt(THD *thd);
void position(byte *record); void position(byte *record);
ha_rows records_in_range(int inx, ha_rows records_in_range(int inx,
const byte *start_key,uint start_key_len, const byte *start_key,uint start_key_len,