Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
68f6ef90
Commit
68f6ef90
authored
Jan 07, 2005
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/export/space/pekka/ndb/version/my50-dt
parents
f3103c48
7f3e6084
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
36 deletions
+127
-36
ndb/examples/ndbapi_event_example/ndbapi_event.cpp
ndb/examples/ndbapi_event_example/ndbapi_event.cpp
+5
-2
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+43
-5
ndb/include/ndbapi/NdbEventOperation.hpp
ndb/include/ndbapi/NdbEventOperation.hpp
+0
-13
ndb/src/ndbapi/NdbDictionary.cpp
ndb/src/ndbapi/NdbDictionary.cpp
+37
-1
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+31
-13
ndb/src/ndbapi/NdbDictionaryImpl.hpp
ndb/src/ndbapi/NdbDictionaryImpl.hpp
+5
-2
ndb/src/ndbapi/ndberror.c
ndb/src/ndbapi/ndberror.c
+6
-0
No files found.
ndb/examples/ndbapi_event_example/ndbapi_event.cpp
View file @
68f6ef90
...
@@ -140,6 +140,7 @@ int main()
...
@@ -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,
...
@@ -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);
...
...
ndb/include/ndbapi/NdbDictionary.hpp
View file @
68f6ef90
...
@@ -937,24 +937,55 @@ public:
...
@@ -937,24 +937,55 @@ public:
#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 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
;
/**
* 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
);
/**
* Get table name for events
*
* @return table name
*/
const
char
*
getTableName
()
const
;
/**
/**
* Add type of event that should be detected
* Add type of event that should be detected
*/
*/
void
addTableEvent
(
const
TableEvent
te
);
void
addTableEvent
(
const
TableEvent
te
);
/**
/**
*
S
et durability of the event
*
Get/s
et durability of the event
*/
*/
void
setDurability
(
const
EventDurability
ed
);
void
setDurability
(
EventDurability
ed
);
EventDurability
getDurability
()
const
;
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void
addColumn
(
const
Column
&
c
);
void
addColumn
(
const
Column
&
c
);
#endif
#endif
...
@@ -971,7 +1002,7 @@ public:
...
@@ -971,7 +1002,7 @@ public:
*
*
* @param columnName Column name
* @param columnName Column name
*
*
* @note errors will
m
ot be detected until createEvent() is called
* @note errors will
n
ot be detected until createEvent() is called
*/
*/
void
addEventColumn
(
const
char
*
columnName
);
void
addEventColumn
(
const
char
*
columnName
);
/**
/**
...
@@ -985,6 +1016,13 @@ public:
...
@@ -985,6 +1016,13 @@ public:
*/
*/
void
addEventColumns
(
int
n
,
const
char
**
columnNames
);
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
* Get object status
*/
*/
...
...
ndb/include/ndbapi/NdbEventOperation.hpp
View file @
68f6ef90
...
@@ -14,19 +14,6 @@
...
@@ -14,19 +14,6 @@
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
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
#ifndef NdbEventOperation_H
#define NdbEventOperation_H
#define NdbEventOperation_H
...
...
ndb/src/ndbapi/NdbDictionary.cpp
View file @
68f6ef90
...
@@ -585,6 +585,13 @@ NdbDictionary::Event::Event(const char * name)
...
@@ -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
)
{
{
...
@@ -604,12 +611,30 @@ NdbDictionary::Event::setName(const char * name)
...
@@ -604,12 +611,30 @@ NdbDictionary::Event::setName(const char * name)
m_impl
.
setName
(
name
);
m_impl
.
setName
(
name
);
}
}
const
char
*
NdbDictionary
::
Event
::
getName
()
const
{
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
)
{
{
m_impl
.
setTable
(
table
);
m_impl
.
setTable
(
table
);
}
}
const
char
*
NdbDictionary
::
Event
::
getTableName
()
const
{
return
m_impl
.
getTableName
();
}
void
void
NdbDictionary
::
Event
::
addTableEvent
(
const
TableEvent
t
)
NdbDictionary
::
Event
::
addTableEvent
(
const
TableEvent
t
)
{
{
...
@@ -617,11 +642,17 @@ NdbDictionary::Event::addTableEvent(const TableEvent t)
...
@@ -617,11 +642,17 @@ NdbDictionary::Event::addTableEvent(const TableEvent t)
}
}
void
void
NdbDictionary
::
Event
::
setDurability
(
const
EventDurability
d
)
NdbDictionary
::
Event
::
setDurability
(
EventDurability
d
)
{
{
m_impl
.
setDurability
(
d
);
m_impl
.
setDurability
(
d
);
}
}
NdbDictionary
::
Event
::
EventDurability
NdbDictionary
::
Event
::
getDurability
()
const
{
return
m_impl
.
getDurability
();
}
void
void
NdbDictionary
::
Event
::
addColumn
(
const
Column
&
c
){
NdbDictionary
::
Event
::
addColumn
(
const
Column
&
c
){
NdbColumnImpl
*
col
=
new
NdbColumnImpl
;
NdbColumnImpl
*
col
=
new
NdbColumnImpl
;
...
@@ -649,6 +680,11 @@ NdbDictionary::Event::addEventColumns(int n, const char ** names)
...
@@ -649,6 +680,11 @@ NdbDictionary::Event::addEventColumns(int n, const char ** names)
addEventColumn
(
names
[
i
]);
addEventColumn
(
names
[
i
]);
}
}
int
NdbDictionary
::
Event
::
getNoOfEventColumns
()
const
{
return
m_impl
.
getNoOfEventColumns
();
}
NdbDictionary
::
Object
::
Status
NdbDictionary
::
Object
::
Status
NdbDictionary
::
Event
::
getObjectStatus
()
const
NdbDictionary
::
Event
::
getObjectStatus
()
const
{
{
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
68f6ef90
...
@@ -564,22 +564,28 @@ void NdbEventImpl::setName(const char * name)
...
@@ -564,22 +564,28 @@ void NdbEventImpl::setName(const char * name)
m_externalName
.
assign
(
name
);
m_externalName
.
assign
(
name
);
}
}
const
char
*
NdbEventImpl
::
getName
()
const
{
return
m_externalName
.
c_str
();
}
void
void
NdbEventImpl
::
setTable
(
const
char
*
table
)
NdbEventImpl
::
setTable
(
const
NdbDictionary
::
Table
&
table
)
{
{
m_tableName
.
assign
(
table
);
m_tableImpl
=
&
NdbTableImpl
::
getImpl
(
table
);
m_tableName
.
assign
(
m_tableImpl
->
getName
());
}
}
const
char
*
void
NdbEventImpl
::
getTable
()
const
NdbEventImpl
::
setTable
(
const
char
*
table
)
{
{
return
m_tableName
.
c_str
(
);
m_tableName
.
assign
(
table
);
}
}
const
char
*
const
char
*
NdbEventImpl
::
getName
()
const
NdbEventImpl
::
get
Table
Name
()
const
{
{
return
m_
external
Name
.
c_str
();
return
m_
table
Name
.
c_str
();
}
}
void
void
...
@@ -599,6 +605,17 @@ NdbEventImpl::setDurability(const NdbDictionary::Event::EventDurability d)
...
@@ -599,6 +605,17 @@ NdbEventImpl::setDurability(const NdbDictionary::Event::EventDurability d)
m_dur
=
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
* NdbDictionaryImpl
*/
*/
...
@@ -2248,12 +2265,12 @@ int
...
@@ -2248,12 +2265,12 @@ int
NdbDictionaryImpl
::
createEvent
(
NdbEventImpl
&
evnt
)
NdbDictionaryImpl
::
createEvent
(
NdbEventImpl
&
evnt
)
{
{
int
i
;
int
i
;
NdbTableImpl
*
tab
=
getTable
(
evnt
.
getTable
());
NdbTableImpl
*
tab
=
getTable
(
evnt
.
getTable
Name
());
if
(
tab
==
0
){
if
(
tab
==
0
){
#ifdef EVENT_DEBUG
#ifdef EVENT_DEBUG
ndbout_c
(
"NdbDictionaryImpl::createEvent: table not found: %s"
,
ndbout_c
(
"NdbDictionaryImpl::createEvent: table not found: %s"
,
evnt
.
getTable
());
evnt
.
getTable
Name
());
#endif
#endif
return
-
1
;
return
-
1
;
}
}
...
@@ -2275,7 +2292,8 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
...
@@ -2275,7 +2292,8 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
evnt
.
m_facade
->
addColumn
(
*
(
col_impl
->
m_facade
));
evnt
.
m_facade
->
addColumn
(
*
(
col_impl
->
m_facade
));
}
else
{
}
else
{
ndbout_c
(
"Attr id %u in table %s not found"
,
evnt
.
m_attrIds
[
i
],
ndbout_c
(
"Attr id %u in table %s not found"
,
evnt
.
m_attrIds
[
i
],
evnt
.
getTable
());
evnt
.
getTableName
());
m_error
.
code
=
4713
;
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -2533,8 +2551,8 @@ NdbDictionaryImpl::getEvent(const char * eventName)
...
@@ -2533,8 +2551,8 @@ NdbDictionaryImpl::getEvent(const char * eventName)
}
}
// We only have the table name with internal name
// We only have the table name with internal name
ev
->
setTable
(
m_ndb
.
externalizeTableName
(
ev
->
getTable
()));
ev
->
setTable
(
m_ndb
.
externalizeTableName
(
ev
->
getTable
Name
()));
ev
->
m_tableImpl
=
getTable
(
ev
->
getTable
());
ev
->
m_tableImpl
=
getTable
(
ev
->
getTable
Name
());
// get the columns from the attrListBitmask
// get the columns from the attrListBitmask
...
...
ndb/src/ndbapi/NdbDictionaryImpl.hpp
View file @
68f6ef90
...
@@ -195,11 +195,14 @@ public:
...
@@ -195,11 +195,14 @@ 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
*
getTable
()
const
;
const
char
*
getTable
Name
()
const
;
void
addTableEvent
(
const
NdbDictionary
::
Event
::
TableEvent
t
);
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
);
void
addEventColumn
(
const
NdbColumnImpl
&
c
);
int
getNoOfEventColumns
()
const
;
void
print
()
{
void
print
()
{
ndbout_c
(
"NdbEventImpl: id=%d, key=%d"
,
ndbout_c
(
"NdbEventImpl: id=%d, key=%d"
,
...
...
ndb/src/ndbapi/ndberror.c
View file @
68f6ef90
...
@@ -299,6 +299,12 @@ ErrorBundle ErrorCodes[] = {
...
@@ -299,6 +299,12 @@ ErrorBundle ErrorCodes[] = {
{
4232
,
AE
,
"Parallelism can only be between 1 and 240"
},
{
4232
,
AE
,
"Parallelism can only be between 1 and 240"
},
{
290
,
AE
,
"Scan not started or has been closed by kernel due to timeout"
},
{
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
* Event application errors
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment