~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/instance/base.cc

  • Committer: Brian Aker
  • Date: 2011-02-04 09:28:16 UTC
  • mfrom: (2140.1.4 timestamp)
  • mto: This revision was merged to the branch mainline in revision 2144.
  • Revision ID: brian@tangent.org-20110204092816-2s32j9hlh6ztz7ti
Merge in fix for not found table (simplifies the caller as well).

Events are now just being processed on shared tables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "drizzled/sql_base.h"
43
43
#include "drizzled/pthread_globals.h"
44
44
#include "drizzled/internal/my_pthread.h"
45
 
#include "drizzled/plugin/event_observer.h"
46
45
 
47
46
#include "drizzled/table.h"
48
47
#include "drizzled/table/shell.h"
286
285
  blob_ptr_size(portable_sizeof_char_ptr),
287
286
  db_low_byte_first(false),
288
287
  keys_in_use(0),
289
 
  keys_for_keyread(0),
290
 
  event_observers(NULL)
 
288
  keys_for_keyread(0)
291
289
{
292
290
  if (type_arg == message::Table::INTERNAL)
293
291
  {
349
347
  blob_ptr_size(portable_sizeof_char_ptr),
350
348
  db_low_byte_first(false),
351
349
  keys_in_use(0),
352
 
  keys_for_keyread(0),
353
 
  event_observers(NULL)
 
350
  keys_for_keyread(0)
354
351
{
355
352
  assert(identifier.getKey() == key);
356
353
 
425
422
  blob_ptr_size(portable_sizeof_char_ptr),
426
423
  db_low_byte_first(false),
427
424
  keys_in_use(0),
428
 
  keys_for_keyread(0),
429
 
  event_observers(NULL)
 
425
  keys_for_keyread(0)
430
426
{
431
427
  private_key_for_cache= identifier.getKey();
432
428
  assert(identifier.getPath().size()); // Since we are doing a create table, this should be a positive value
502
498
  blob_ptr_size(portable_sizeof_char_ptr),
503
499
  db_low_byte_first(false),
504
500
  keys_in_use(0),
505
 
  keys_for_keyread(0),
506
 
  event_observers(NULL)
 
501
  keys_for_keyread(0)
507
502
{
508
503
  char *path_buff;
509
504
  std::string _path;
561
556
{
562
557
  storage_engine= NULL;
563
558
 
564
 
  plugin::EventObserver::deregisterTableEvents(*this);
565
 
 
566
559
  mem_root.free_root(MYF(0));                 // Free's share
567
560
}
568
561
 
1547
1540
 
1548
1541
int TableShare::open_table_def(Session& session, const identifier::Table &identifier)
1549
1542
{
1550
 
  int local_error;
1551
 
  bool error_given;
1552
 
 
1553
 
  local_error= 1;
1554
 
  error_given= 0;
1555
 
 
1556
 
  message::table::shared_ptr table;
1557
 
 
1558
 
  local_error= plugin::StorageEngine::getTableDefinition(session, identifier, table);
1559
 
 
1560
 
  do {
1561
 
    if (local_error != EEXIST)
1562
 
    {
1563
 
      if (local_error > 0)
1564
 
      {
1565
 
        errno= local_error;
1566
 
        local_error= 1;
1567
 
      }
1568
 
      else
1569
 
      {
1570
 
        if (not table->IsInitialized())
1571
 
        {
1572
 
          local_error= 4;
1573
 
        }
1574
 
      }
1575
 
      break;
1576
 
    }
1577
 
 
1578
 
    local_error= parse_table_proto(session, *table);
1579
 
 
1580
 
    setTableCategory(TABLE_CATEGORY_USER);
1581
 
  } while (0);
1582
 
 
1583
 
  if (local_error && !error_given)
1584
 
  {
1585
 
    error= local_error;
1586
 
    open_table_error(error, (open_errno= errno), 0);
1587
 
  }
1588
 
 
1589
 
  return(error);
 
1543
  drizzled::error_t local_error= EE_OK;
 
1544
 
 
1545
  message::table::shared_ptr table= plugin::StorageEngine::getTableMessage(session, identifier, local_error);
 
1546
 
 
1547
  if (table and table->IsInitialized())
 
1548
  {
 
1549
    if (parse_table_proto(session, *table))
 
1550
    {
 
1551
      local_error= ER_CORRUPT_TABLE_DEFINITION_UNKNOWN;
 
1552
      my_error(ER_CORRUPT_TABLE_DEFINITION_UNKNOWN, identifier);
 
1553
    }
 
1554
    else
 
1555
    {
 
1556
      setTableCategory(TABLE_CATEGORY_USER);
 
1557
      local_error= EE_OK;
 
1558
    }
 
1559
  }
 
1560
  else if (table and not table->IsInitialized())
 
1561
  {
 
1562
    local_error= ER_CORRUPT_TABLE_DEFINITION_UNKNOWN;
 
1563
    my_error(ER_CORRUPT_TABLE_DEFINITION_UNKNOWN, identifier);
 
1564
  }
 
1565
  else
 
1566
  {
 
1567
    local_error= ER_TABLE_UNKNOWN;
 
1568
    my_error(ER_TABLE_UNKNOWN, identifier);
 
1569
  }
 
1570
 
 
1571
  return static_cast<int>(local_error);
1590
1572
}
1591
1573
 
1592
1574
 
1840
1822
  case 1:
1841
1823
    if (db_errno == ENOENT)
1842
1824
    {
1843
 
      my_error(ER_NO_SUCH_TABLE, MYF(0), db.str, table_name.str);
 
1825
      identifier::Table identifier(db.str, table_name.str);
 
1826
      my_error(ER_TABLE_UNKNOWN, identifier);
1844
1827
    }
1845
1828
    else
1846
1829
    {