790
785
my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[transaction.xid_state.xa_state]);
793
if (options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN | OPTION_TABLE_LOCK))
788
if (options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
795
/* Safety if one did "drop table" on locked tables */
797
options&= ~OPTION_TABLE_LOCK;
798
790
server_status&= ~SERVER_STATUS_IN_TRANS;
799
791
if (ha_commit(this))
2261
2235
if (open_tables)
2262
2236
close_open_tables();
2241
Prepare statement for reopening of tables and recalculation of set of
2245
close_tables_for_reopen()
2246
session in Thread context
2247
tables in/out List of tables which we were trying to open and lock
2251
void Session::close_tables_for_reopen(TableList **tables)
2254
If table list consists only from tables from prelocking set, table list
2255
for new attempt should be empty, so we have to update list's root pointer.
2257
if (lex->first_not_own_table() == *tables)
2259
lex->chop_off_not_own_tables();
2260
for (TableList *tmp= *tables; tmp; tmp= tmp->next_global)
2262
close_thread_tables();
2267
Open all tables in list, locks them (all, including derived)
2270
open_and_lock_tables_derived()
2271
session - thread handler
2272
tables - list of tables for open&locking
2273
derived - if to handle derived tables
2280
The lock will automaticaly be freed by close_thread_tables()
2283
There are two convenience functions:
2284
- simple_open_n_lock_tables(session, tables) without derived handling
2285
- open_and_lock_tables(session, tables) with derived handling
2286
Both inline functions call open_and_lock_tables_derived() with
2287
the third argument set appropriately.
2290
int Session::open_and_lock_tables(TableList *tables)
2297
if (open_tables_from_list(&tables, &counter, 0))
2300
if (!lock_tables(this, tables, counter, &need_reopen))
2304
close_tables_for_reopen(&tables);
2306
if ((mysql_handle_derived(lex, &mysql_derived_prepare) ||
2307
(fill_derived_tables() &&
2308
mysql_handle_derived(lex, &mysql_derived_filling))))
2309
return 1; /* purecov: inspected */
2316
Open all tables in list and process derived tables
2319
open_normal_and_derived_tables
2320
session - thread handler
2321
tables - list of tables for open
2322
flags - bitmap of flags to modify how the tables will be open:
2323
DRIZZLE_LOCK_IGNORE_FLUSH - open table even if someone has
2324
done a flush or namelock on it.
2331
This is to be used on prepare stage when you don't read any
2332
data from the tables.
2335
bool Session::open_normal_and_derived_tables(TableList *tables, uint32_t flags)
2338
assert(!(fill_derived_tables()));
2339
if (open_tables_from_list(&tables, &counter, flags) ||
2340
mysql_handle_derived(lex, &mysql_derived_prepare))
2341
return true; /* purecov: inspected */