Commit 93831097 authored by unknown's avatar unknown

added get methods on event object

parent bec9de67
......@@ -932,21 +932,29 @@ public:
Event(const char *name);
virtual ~Event();
/**
* Set unique identifier for the event
* Set/get unique identifier for the event
*/
void setName(const char *name);
const char *getName() const;
/**
* Set table for which events should be detected
*/
void setTable(const char *tableName);
/**
* Get table name for events
*
* @return table name
*/
const char* getTableName() const;
/**
* Add type of event that should be detected
*/
void addTableEvent(const TableEvent te);
/**
* Set durability of the event
* Get/set durability of the event
*/
void setDurability(const EventDurability ed);
void setDurability(EventDurability ed);
EventDurability getDurability() const;
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void addColumn(const Column &c);
#endif
......@@ -977,6 +985,13 @@ public:
*/
void addEventColumns(int n, const char ** columnNames);
/**
* Get no of columns defined in an Event
*
* @return Number of columns, -1 on error
*/
int getNoOfEventColumns() const;
/**
* Get object status
*/
......
......@@ -14,19 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbEventOperation.hpp
* Include:
* Link:
* Author: Tomas Ulin MySQL AB
* Date: 2003-11-21
* Version: 0.1
* Description: Event support
* Documentation:
* Adjust: 2003-11-21 Tomas Ulin First version.
* Adjust: 2003-12-11 Tomas Ulin Alpha Release.
****************************************************************************/
#ifndef NdbEventOperation_H
#define NdbEventOperation_H
......
......@@ -604,12 +604,24 @@ NdbDictionary::Event::setName(const char * name)
m_impl.setName(name);
}
const char *
NdbDictionary::Event::getName() const
{
return m_impl.getName();
}
void
NdbDictionary::Event::setTable(const char * table)
{
m_impl.setTable(table);
}
const char*
NdbDictionary::Event::getTableName() const
{
return m_impl.getTableName();
}
void
NdbDictionary::Event::addTableEvent(const TableEvent t)
{
......@@ -617,11 +629,17 @@ NdbDictionary::Event::addTableEvent(const TableEvent t)
}
void
NdbDictionary::Event::setDurability(const EventDurability d)
NdbDictionary::Event::setDurability(EventDurability d)
{
m_impl.setDurability(d);
}
NdbDictionary::Event::EventDurability
NdbDictionary::Event::getDurability() const
{
return m_impl.getDurability();
}
void
NdbDictionary::Event::addColumn(const Column & c){
NdbColumnImpl* col = new NdbColumnImpl;
......@@ -649,6 +667,11 @@ NdbDictionary::Event::addEventColumns(int n, const char ** names)
addEventColumn(names[i]);
}
int NdbDictionary::Event::getNoOfEventColumns() const
{
return m_impl.getNoOfEventColumns();
}
NdbDictionary::Object::Status
NdbDictionary::Event::getObjectStatus() const
{
......
......@@ -546,24 +546,23 @@ void NdbEventImpl::setName(const char * name)
m_externalName.assign(name);
}
const char *NdbEventImpl::getName() const
{
return m_externalName.c_str();
}
void
NdbEventImpl::setTable(const char * table)
{
m_tableName.assign(table);
}
const char *
NdbEventImpl::getTable() const
const char *
NdbEventImpl::getTableName() const
{
return m_tableName.c_str();
}
const char *
NdbEventImpl::getName() const
{
return m_externalName.c_str();
}
void
NdbEventImpl::addTableEvent(const NdbDictionary::Event::TableEvent t = NdbDictionary::Event::TE_ALL)
{
......@@ -581,6 +580,17 @@ NdbEventImpl::setDurability(const NdbDictionary::Event::EventDurability d)
m_dur = d;
}
NdbDictionary::Event::EventDurability
NdbEventImpl::getDurability() const
{
return m_dur;
}
int NdbEventImpl::getNoOfEventColumns() const
{
return m_attrIds.size() + m_columns.size();
}
/**
* NdbDictionaryImpl
*/
......@@ -2233,12 +2243,12 @@ int
NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
{
int i;
NdbTableImpl* tab = getTable(evnt.getTable());
NdbTableImpl* tab = getTable(evnt.getTableName());
if(tab == 0){
#ifdef EVENT_DEBUG
ndbout_c("NdbDictionaryImpl::createEvent: table not found: %s",
evnt.getTable());
evnt.getTableName());
#endif
return -1;
}
......@@ -2260,7 +2270,8 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
evnt.m_facade->addColumn(*(col_impl->m_facade));
} else {
ndbout_c("Attr id %u in table %s not found", evnt.m_attrIds[i],
evnt.getTable());
evnt.getTableName());
m_error.code= 4713;
return -1;
}
}
......@@ -2518,8 +2529,8 @@ NdbDictionaryImpl::getEvent(const char * eventName)
}
// We only have the table name with internal name
ev->setTable(m_ndb.externalizeTableName(ev->getTable()));
ev->m_tableImpl = getTable(ev->getTable());
ev->setTable(m_ndb.externalizeTableName(ev->getTableName()));
ev->m_tableImpl = getTable(ev->getTableName());
// get the columns from the attrListBitmask
......
......@@ -196,10 +196,12 @@ public:
void setName(const char * name);
const char * getName() const;
void setTable(const char * table);
const char * getTable() const;
const char * getTableName() const;
void addTableEvent(const NdbDictionary::Event::TableEvent t);
void setDurability(const NdbDictionary::Event::EventDurability d);
void setDurability(NdbDictionary::Event::EventDurability d);
NdbDictionary::Event::EventDurability getDurability() const;
void addEventColumn(const NdbColumnImpl &c);
int getNoOfEventColumns() const;
void print() {
ndbout_c("NdbEventImpl: id=%d, key=%d",
......
......@@ -299,6 +299,12 @@ ErrorBundle ErrorCodes[] = {
{ 4232, AE, "Parallelism can only be between 1 and 240" },
{ 290, AE, "Scan not started or has been closed by kernel due to timeout" },
/**
* Event schema errors
*/
{ 4713, SE, "Column defined in event does not exist in table"},
/**
* Event application errors
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment