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:
@@ -140,6 +140,7 @@ int main()
|
|||||||
eventTableName,
|
eventTableName,
|
||||||
eventColumnName,
|
eventColumnName,
|
||||||
noEventColumnName);
|
noEventColumnName);
|
||||||
|
|
||||||
int j= 0;
|
int j= 0;
|
||||||
while (j < 5) {
|
while (j < 5) {
|
||||||
|
|
||||||
@@ -238,8 +239,10 @@ int myCreateEvent(Ndb* myNdb,
|
|||||||
NdbDictionary::Dictionary *myDict= myNdb->getDictionary();
|
NdbDictionary::Dictionary *myDict= myNdb->getDictionary();
|
||||||
if (!myDict) APIERROR(myNdb->getNdbError());
|
if (!myDict) APIERROR(myNdb->getNdbError());
|
||||||
|
|
||||||
NdbDictionary::Event myEvent(eventName);
|
const NdbDictionary::Table *table= myDict->getTable(eventTableName);
|
||||||
myEvent.setTable(eventTableName);
|
if (!table) APIERROR(myDict->getNdbError());
|
||||||
|
|
||||||
|
NdbDictionary::Event myEvent(eventName, *table);
|
||||||
myEvent.addTableEvent(NdbDictionary::Event::TE_ALL);
|
myEvent.addTableEvent(NdbDictionary::Event::TE_ALL);
|
||||||
// myEvent.addTableEvent(NdbDictionary::Event::TE_INSERT);
|
// myEvent.addTableEvent(NdbDictionary::Event::TE_INSERT);
|
||||||
// myEvent.addTableEvent(NdbDictionary::Event::TE_UPDATE);
|
// myEvent.addTableEvent(NdbDictionary::Event::TE_UPDATE);
|
||||||
|
@@ -928,16 +928,39 @@ public:
|
|||||||
= 3
|
= 3
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constructor
|
||||||
|
* @param name Name of event
|
||||||
|
*/
|
||||||
Event(const char *name);
|
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();
|
virtual ~Event();
|
||||||
/**
|
/**
|
||||||
* Set/get unique identifier for the event
|
* Set/get unique identifier for the event
|
||||||
*/
|
*/
|
||||||
void setName(const char *name);
|
void setName(const char *name);
|
||||||
const char *getName() const;
|
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
|
* 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);
|
void setTable(const char *tableName);
|
||||||
/**
|
/**
|
||||||
@@ -971,7 +994,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param columnName Column name
|
* @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);
|
void addEventColumn(const char * columnName);
|
||||||
/**
|
/**
|
||||||
|
@@ -585,6 +585,13 @@ NdbDictionary::Event::Event(const char * name)
|
|||||||
setName(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)
|
NdbDictionary::Event::Event(NdbEventImpl & impl)
|
||||||
: m_impl(impl)
|
: m_impl(impl)
|
||||||
{
|
{
|
||||||
@@ -610,6 +617,12 @@ NdbDictionary::Event::getName() const
|
|||||||
return m_impl.getName();
|
return m_impl.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NdbDictionary::Event::setTable(const Table& table)
|
||||||
|
{
|
||||||
|
m_impl.setTable(table);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NdbDictionary::Event::setTable(const char * table)
|
NdbDictionary::Event::setTable(const char * table)
|
||||||
{
|
{
|
||||||
|
@@ -551,6 +551,13 @@ const char *NdbEventImpl::getName() const
|
|||||||
return m_externalName.c_str();
|
return m_externalName.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NdbEventImpl::setTable(const NdbDictionary::Table& table)
|
||||||
|
{
|
||||||
|
m_tableImpl= &NdbTableImpl::getImpl(table);
|
||||||
|
m_tableName.assign(m_tableImpl->getName());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NdbEventImpl::setTable(const char * table)
|
NdbEventImpl::setTable(const char * table)
|
||||||
{
|
{
|
||||||
|
@@ -195,6 +195,7 @@ public:
|
|||||||
|
|
||||||
void setName(const char * name);
|
void setName(const char * name);
|
||||||
const char * getName() const;
|
const char * getName() const;
|
||||||
|
void setTable(const NdbDictionary::Table& table);
|
||||||
void setTable(const char * table);
|
void setTable(const char * table);
|
||||||
const char * getTableName() const;
|
const char * getTableName() const;
|
||||||
void addTableEvent(const NdbDictionary::Event::TableEvent t);
|
void addTableEvent(const NdbDictionary::Event::TableEvent t);
|
||||||
|
Reference in New Issue
Block a user