2693
2693
assert(next_insert_id == 0);
2695
if (DRIZZLE_HANDLER_RDLOCK_START_ENABLED() ||
2696
DRIZZLE_HANDLER_WRLOCK_START_ENABLED() ||
2697
DRIZZLE_HANDLER_UNLOCK_START_ENABLED())
2699
if (lock_type == F_RDLCK)
2701
DRIZZLE_EXTERNAL_RDLOCK_START(table_share->db.str,
2702
table_share->table_name.str);
2704
else if (lock_type == F_WRLCK)
2706
DRIZZLE_EXTERNAL_WRLOCK_START(table_share->db.str,
2707
table_share->table_name.str);
2709
else if (lock_type == F_UNLCK)
2711
DRIZZLE_EXTERNAL_UNLOCK_START(table_share->db.str,
2712
table_share->table_name.str);
2696
2717
We cache the table flags if the locking succeeded. Otherwise, we
2697
2718
keep them as they were when they were fetched in ha_open().
2699
DRIZZLE_EXTERNAL_LOCK(lock_type);
2701
2721
int error= external_lock(session, lock_type);
2723
if (DRIZZLE_HANDLER_RDLOCK_DONE_ENABLED() ||
2724
DRIZZLE_HANDLER_WRLOCK_DONE_ENABLED() ||
2725
DRIZZLE_HANDLER_UNLOCK_DONE_ENABLED())
2727
if (lock_type == F_RDLCK)
2729
DRIZZLE_EXTERNAL_RDLOCK_DONE(table_share->db.str,
2730
table_share->table_name.str);
2732
else if (lock_type == F_WRLCK)
2734
DRIZZLE_EXTERNAL_WRLOCK_DONE(table_share->db.str,
2735
table_share->table_name.str);
2737
else if (lock_type == F_UNLCK)
2739
DRIZZLE_EXTERNAL_UNLOCK_DONE(table_share->db.str,
2740
table_share->table_name.str);
2702
2743
if (error == 0)
2703
2744
cached_table_flags= table_flags();