~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/locking/global.cc

  • Committer: Lee Bieber
  • Date: 2011-04-14 02:58:23 UTC
  • mfrom: (2275.2.5 typelib)
  • mto: This revision was merged to the branch mainline in revision 2278.
  • Revision ID: kalebral@gmail.com-20110414025823-vz32sg8fuxslygyd
Merge Olaf - remove unused functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
        lock request will set its lock type properly.
164
164
*/
165
165
 
166
 
static void reset_lock_data_and_free(DrizzleLock **mysql_lock)
 
166
static void reset_lock_data_and_free(DrizzleLock*& lock)
167
167
{
168
 
  DrizzleLock *sql_lock= *mysql_lock;
169
 
  sql_lock->reset();
170
 
  delete sql_lock;
171
 
  *mysql_lock= 0;
 
168
  lock->reset();
 
169
  delete lock;
 
170
  lock= NULL;
172
171
}
173
172
 
174
173
DrizzleLock *Session::lockTables(Table **tables, uint32_t count, uint32_t flags)
191
190
      if (wait_if_global_read_lock(1, 1))
192
191
      {
193
192
        /* Clear the lock type of all lock data to avoid reusage. */
194
 
        reset_lock_data_and_free(&sql_lock);
 
193
        reset_lock_data_and_free(sql_lock);
195
194
        break;
196
195
      }
197
196
 
198
197
      if (open_tables.version != g_refresh_version)
199
198
      {
200
199
        /* Clear the lock type of all lock data to avoid reusage. */
201
 
        reset_lock_data_and_free(&sql_lock);
 
200
        reset_lock_data_and_free(sql_lock);
202
201
        break;
203
202
      }
204
203
    }
240
239
    if (sql_lock->sizeTable() && lock_external(sql_lock->getTable(), sql_lock->sizeTable()))
241
240
    {
242
241
      /* Clear the lock type of all lock data to avoid reusage. */
243
 
      reset_lock_data_and_free(&sql_lock);
 
242
      reset_lock_data_and_free(sql_lock);
244
243
      break;
245
244
    }
246
245
    set_proc_info("Table lock");
260
259
    {
261
260
      if (sql_lock->sizeTable())
262
261
        unlock_external(sql_lock->getTable(), sql_lock->sizeTable());
263
 
      reset_lock_data_and_free(&sql_lock);
 
262
      reset_lock_data_and_free(sql_lock);
264
263
      my_error(rc, MYF(0));
265
264
    }
266
265
  } while(0);
559
558
        my_error(ER_OPEN_AS_READONLY, MYF(0), table->getAlias());
560
559
        /* Clear the lock type of the lock data that are stored already. */
561
560
        sql_lock->setLock(locks - sql_lock->getLocks());
562
 
        reset_lock_data_and_free(&sql_lock);
 
561
        reset_lock_data_and_free(sql_lock);
563
562
        return NULL;
564
563
      }
565
564
    }