~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-05-06 14:23:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1544.
  • Revision ID: barry.leslie@primebase.com-20100506142327-hg5wnvqgn5bc6lw3
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer.
Unless I really need a pointer to an object I now always pass things by reference.
'Post' event observers can now report a failure the same as 'Pre' event observers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include "drizzled/message/table.pb.h"
44
44
#include "drizzled/plugin/client.h"
45
45
#include "drizzled/internal/my_sys.h"
46
 
#include "drizzled/plugin/event.h"
 
46
#include "drizzled/plugin/event_observer.h"
47
47
 
48
48
using namespace std;
49
49
 
1485
1485
  DRIZZLE_INSERT_ROW_START(table->getSchemaName(), table_share->getTableName());
1486
1486
  setTransactionReadWrite();
1487
1487
  
1488
 
  if (unlikely(plugin::Event::preWriteRowDo(table->in_use, table_share, buf)))
1489
 
    error= ER_EVENT_PLUGIN;
 
1488
  if (unlikely(plugin::EventObserver::preWriteRowDo(*(table->in_use), *table_share, buf)))
 
1489
  {
 
1490
    error= ER_EVENT_OBSERVER_PLUGIN;
 
1491
  }
1490
1492
  else
1491
1493
  {
1492
1494
    error= doInsertRecord(buf);
1493
 
    plugin::Event::postWriteRowDo(table->in_use, table_share, buf, error);
 
1495
    if (unlikely(plugin::EventObserver::postWriteRowDo(*(table->in_use), *table_share, buf, error))) 
 
1496
    {
 
1497
      error= ER_EVENT_OBSERVER_PLUGIN;
 
1498
    }
1494
1499
  }
1495
1500
 
1496
1501
  DRIZZLE_INSERT_ROW_DONE(error);
1519
1524
 
1520
1525
  DRIZZLE_UPDATE_ROW_START(table_share->getSchemaName(), table_share->getTableName());
1521
1526
  setTransactionReadWrite();
1522
 
  if (unlikely(plugin::Event::preUpdateRowDo(table->in_use, table_share, old_data, new_data)))
1523
 
    error= ER_EVENT_PLUGIN;
 
1527
  if (unlikely(plugin::EventObserver::preUpdateRowDo(*(table->in_use), *table_share, old_data, new_data)))
 
1528
  {
 
1529
    error= ER_EVENT_OBSERVER_PLUGIN;
 
1530
  }
1524
1531
  else
1525
1532
  {
1526
1533
    error= doUpdateRecord(old_data, new_data);
1527
 
    plugin::Event::postUpdateRowDo(table->in_use, table_share, old_data, new_data, error);
 
1534
    if (unlikely(plugin::EventObserver::postUpdateRowDo(*(table->in_use), *table_share, old_data, new_data, error)))
 
1535
    {
 
1536
      error= ER_EVENT_OBSERVER_PLUGIN;
 
1537
    }
1528
1538
  }
1529
1539
 
1530
1540
  DRIZZLE_UPDATE_ROW_DONE(error);
1546
1556
 
1547
1557
  DRIZZLE_DELETE_ROW_START(table_share->getSchemaName(), table_share->getTableName());
1548
1558
  setTransactionReadWrite();
1549
 
  if (unlikely(plugin::Event::preDeleteRowDo(table->in_use, table_share, buf)))
1550
 
    error= ER_EVENT_PLUGIN;
 
1559
  if (unlikely(plugin::EventObserver::preDeleteRowDo(*(table->in_use), *table_share, buf)))
 
1560
  {
 
1561
    error= ER_EVENT_OBSERVER_PLUGIN;
 
1562
  }
1551
1563
  else
1552
1564
  {
1553
1565
    error= doDeleteRecord(buf);
1554
 
    plugin::Event::postDeleteRowDo(table->in_use, table_share, buf, error);
 
1566
    if (unlikely(plugin::EventObserver::postDeleteRowDo(*(table->in_use), *table_share, buf, error)))
 
1567
    {
 
1568
      error= ER_EVENT_OBSERVER_PLUGIN;
 
1569
    }
1555
1570
  }
1556
1571
 
1557
1572
  DRIZZLE_DELETE_ROW_DONE(error);