1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

added using table object reference in event creation

This commit is contained in:
tomas@poseidon.ndb.mysql.com
2005-01-07 13:00:51 +01:00
parent 95a2dbdd64
commit 7f3e6084cd
5 changed files with 51 additions and 4 deletions

View File

@@ -140,6 +140,7 @@ int main()
eventTableName,
eventColumnName,
noEventColumnName);
int j= 0;
while (j < 5) {
@@ -238,8 +239,10 @@ int myCreateEvent(Ndb* myNdb,
NdbDictionary::Dictionary *myDict= myNdb->getDictionary();
if (!myDict) APIERROR(myNdb->getNdbError());
NdbDictionary::Event myEvent(eventName);
myEvent.setTable(eventTableName);
const NdbDictionary::Table *table= myDict->getTable(eventTableName);
if (!table) APIERROR(myDict->getNdbError());
NdbDictionary::Event myEvent(eventName, *table);
myEvent.addTableEvent(NdbDictionary::Event::TE_ALL);
// myEvent.addTableEvent(NdbDictionary::Event::TE_INSERT);
// myEvent.addTableEvent(NdbDictionary::Event::TE_UPDATE);

View File

@@ -929,15 +929,38 @@ public:
#endif
};
/*
* Constructor
* @param name Name of event
*/
Event(const char *name);
/*
* Constructor
* @param name Name of event
* @param table Reference retrieved from NdbDictionary
*/
Event(const char *name, const NdbDictionary::Table& table);
virtual ~Event();
/**
* Set/get unique identifier for the event
*/
void setName(const char *name);
const char *getName() const;
/**
* Define table on which events should be detected
*
* @note calling this method will default to detection
* of events on all columns. Calling subsequent
* addEventColumn calls will override this.
*
* @param table reference retrieved from NdbDictionary
*/
void setTable(const NdbDictionary::Table& table);
/**
* Set table for which events should be detected
*
* @note preferred way is using setTable(const NdbDictionary::Table)
* or constructor with table object parameter
*/
void setTable(const char *tableName);
/**
@@ -971,7 +994,7 @@ public:
*
* @param columnName Column name
*
* @note errors will mot be detected until createEvent() is called
* @note errors will not be detected until createEvent() is called
*/
void addEventColumn(const char * columnName);
/**

View File

@@ -585,6 +585,13 @@ NdbDictionary::Event::Event(const char * name)
setName(name);
}
NdbDictionary::Event::Event(const char * name, const Table& table)
: m_impl(* new NdbEventImpl(* this))
{
setName(name);
setTable(table);
}
NdbDictionary::Event::Event(NdbEventImpl & impl)
: m_impl(impl)
{
@@ -610,6 +617,12 @@ NdbDictionary::Event::getName() const
return m_impl.getName();
}
void
NdbDictionary::Event::setTable(const Table& table)
{
m_impl.setTable(table);
}
void
NdbDictionary::Event::setTable(const char * table)
{

View File

@@ -551,6 +551,13 @@ const char *NdbEventImpl::getName() const
return m_externalName.c_str();
}
void
NdbEventImpl::setTable(const NdbDictionary::Table& table)
{
m_tableImpl= &NdbTableImpl::getImpl(table);
m_tableName.assign(m_tableImpl->getName());
}
void
NdbEventImpl::setTable(const char * table)
{

View File

@@ -195,6 +195,7 @@ public:
void setName(const char * name);
const char * getName() const;
void setTable(const NdbDictionary::Table& table);
void setTable(const char * table);
const char * getTableName() const;
void addTableEvent(const NdbDictionary::Event::TableEvent t);