~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-22 22:39:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2348.
  • Revision ID: olafvdspek@gmail.com-20110622223931-z6r8g68zp401kkbe
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1625
1625
 
1626
1626
int Session::lock_tables(TableList *tables, uint32_t count, bool *need_reopen)
1627
1627
{
1628
 
  Session *session= this;
1629
 
 
1630
1628
  /*
1631
1629
    We can't meet statement requiring prelocking if we already
1632
1630
    in prelocked mode.
1636
1634
  if (tables == NULL)
1637
1635
    return 0;
1638
1636
 
1639
 
  assert(session->open_tables.lock == 0);       // You must lock everything at once
1640
 
  uint32_t lock_flag= DRIZZLE_LOCK_NOTIFY_IF_NEED_REOPEN;
 
1637
  assert(not open_tables.lock); // You must lock everything at once
1641
1638
 
1642
1639
  Table** start;
1643
 
  Table** ptr=start=(Table**) session->mem.alloc(sizeof(Table*)*count);
 
1640
  Table** ptr=start= new (mem) Table*[count];
1644
1641
  for (TableList* table= tables; table; table= table->next_global)
1645
1642
  {
1646
1643
    if (!table->placeholder())
1647
1644
      *(ptr++)= table->table;
1648
1645
  }
1649
 
  if (not (session->open_tables.lock= session->lockTables(start, (uint32_t) (ptr - start), lock_flag)))
 
1646
  if (not (open_tables.lock= lockTables(start, (uint32_t) (ptr - start), DRIZZLE_LOCK_NOTIFY_IF_NEED_REOPEN)))
1650
1647
  {
1651
1648
    return -1;
1652
1649
  }