| 10167 | } |
| 10168 | |
| 10169 | int TABLE::hlindex_lock(uint nr) |
| 10170 | { |
| 10171 | DBUG_ASSERT(s->hlindexes() == 1); |
| 10172 | DBUG_ASSERT(nr == s->keys); |
| 10173 | DBUG_ASSERT(hlindex); |
| 10174 | if (hlindex->in_use == in_use) |
| 10175 | return 0; |
| 10176 | hlindex->use_all_columns(); |
| 10177 | |
| 10178 | THR_LOCK_DATA *lock_data; |
| 10179 | DBUG_ASSERT(hlindex->file->lock_count() <= 1); |
| 10180 | hlindex->file->store_lock(in_use, &lock_data, reginfo.lock_type); |
| 10181 | |
| 10182 | int res= hlindex->file->ha_external_lock(in_use, |
| 10183 | reginfo.lock_type < TL_FIRST_WRITE ? F_RDLCK : F_WRLCK); |
| 10184 | if (res == 0) |
| 10185 | hlindex->in_use= in_use; // mark in use for this query |
| 10186 | if (hlindex->file->lock_count() > 0) |
| 10187 | { |
| 10188 | /* |
| 10189 | This code is here mostly for Aria. It requires start_trans() call |
| 10190 | to handle transaction logging. |
| 10191 | */ |
| 10192 | if (res == 0 && !s->tmp_table && lock_data->lock->start_trans) |
| 10193 | lock_data->lock->start_trans(lock_data->status_param); |
| 10194 | lock_data->type= TL_UNLOCK; |
| 10195 | } |
| 10196 | return res; |
| 10197 | } |
| 10198 | |
| 10199 | int TABLE::open_hlindexes_for_write() |
| 10200 | { |
no test coverage detected