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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e1e34b51
Commit
e1e34b51
authored
Jan 13, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#7626
parent
0928b660
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
15 deletions
+34
-15
ndb/examples/ndbapi_event_example/ndbapi_event.cpp
ndb/examples/ndbapi_event_example/ndbapi_event.cpp
+6
-5
ndb/include/kernel/trigger_definitions.h
ndb/include/kernel/trigger_definitions.h
+1
-0
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+3
-0
ndb/src/ndbapi/NdbEventOperationImpl.cpp
ndb/src/ndbapi/NdbEventOperationImpl.cpp
+20
-8
ndb/src/ndbapi/NdbEventOperationImpl.hpp
ndb/src/ndbapi/NdbEventOperationImpl.hpp
+4
-2
No files found.
ndb/examples/ndbapi_event_example/ndbapi_event.cpp
View file @
e1e34b51
...
...
@@ -70,12 +70,13 @@
* mysql> use TEST_DB;
* mysql> create table TAB0 (COL0 int primary key, COL1 int, COL11 int) engine=ndb;
*
* In another window start ndbapi_e
xample5
, wait until properly started
* In another window start ndbapi_e
vent
, wait until properly started
*
* mysql> insert into TAB0 values (1,2,3);
* mysql> insert into TAB0 values (2,2,3);
* mysql> insert into TAB0 values (3,2,9);
* mysql>
insert into TAB0 values (1,2,3);
insert into TAB0 values (2,2,3);
insert into TAB0 values (3,2,9);
update TAB0 set COL1=10 where COL0=1;
delete from TAB0 where COL0=1;
*
* you should see the data popping up in the example window
*
...
...
ndb/include/kernel/trigger_definitions.h
View file @
e1e34b51
...
...
@@ -56,6 +56,7 @@ struct TriggerActionTime {
};
struct
TriggerEvent
{
/** TableEvent must match 1 << TriggerEvent */
enum
Value
{
TE_INSERT
=
0
,
TE_DELETE
=
1
,
...
...
ndb/include/ndbapi/NdbDictionary.hpp
View file @
e1e34b51
...
...
@@ -915,6 +915,9 @@ public:
/**
* Specifies the type of database operations an Event listens to
*/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** TableEvent must match 1 << TriggerEvent */
#endif
enum
TableEvent
{
TE_INSERT
=
1
,
///< Insert event on table
TE_DELETE
=
2
,
///< Delete event on table
...
...
ndb/src/ndbapi/NdbEventOperationImpl.cpp
View file @
e1e34b51
...
...
@@ -224,9 +224,8 @@ NdbEventOperationImpl::execute()
int
hasSubscriber
;
int
r
=
m_bufferHandle
->
prepareAddSubscribeEvent
(
m_eventImpl
->
m_eventId
,
hasSubscriber
/* return value */
);
int
r
=
m_bufferHandle
->
prepareAddSubscribeEvent
(
this
,
hasSubscriber
/*return value*/
);
m_error
.
code
=
4709
;
if
(
r
<
0
)
...
...
@@ -697,10 +696,11 @@ NdbGlobalEventBufferHandle::drop(NdbGlobalEventBufferHandle *handle)
}
*/
int
NdbGlobalEventBufferHandle
::
prepareAddSubscribeEvent
(
Uint32
eventId
,
int
&
hasSubscriber
)
NdbGlobalEventBufferHandle
::
prepareAddSubscribeEvent
(
NdbEventOperationImpl
*
eventOp
,
int
&
hasSubscriber
)
{
ADD_DROP_LOCK_GUARDR
(
int
,
real_prepareAddSubscribeEvent
(
this
,
eventId
,
hasSubscriber
));
ADD_DROP_LOCK_GUARDR
(
int
,
real_prepareAddSubscribeEvent
(
this
,
eventOp
,
hasSubscriber
));
}
void
NdbGlobalEventBufferHandle
::
addSubscribeEvent
...
...
@@ -891,13 +891,15 @@ NdbGlobalEventBuffer::real_remove(NdbGlobalEventBufferHandle *h)
exit
(
-
1
);
}
int
int
NdbGlobalEventBuffer
::
real_prepareAddSubscribeEvent
(
NdbGlobalEventBufferHandle
*
aHandle
,
Uint32
eventId
,
int
&
hasSubscriber
)
(
NdbGlobalEventBufferHandle
*
aHandle
,
NdbEventOperationImpl
*
eventOp
,
int
&
hasSubscriber
)
{
DBUG_ENTER
(
"NdbGlobalEventBuffer::real_prepareAddSubscribeEvent"
);
int
i
;
int
bufferId
=
-
1
;
Uint32
eventId
=
eventOp
->
m_eventId
;
// add_drop_lock(); // only one thread can do add or drop at a time
...
...
@@ -939,6 +941,7 @@ NdbGlobalEventBuffer::real_prepareAddSubscribeEvent
bufferId
=
NO_ID
(
0
,
bufferId
);
b
.
gId
=
eventId
;
b
.
eventType
=
(
Uint32
)
eventOp
->
m_eventImpl
->
mi_type
;
if
((
b
.
p_buf_mutex
=
NdbMutex_Create
())
==
NULL
)
{
ndbout_c
(
"NdbGlobalEventBuffer: NdbMutex_Create() failed"
);
...
...
@@ -1137,6 +1140,8 @@ NdbGlobalEventBuffer::real_insertDataL(int bufferId,
#ifdef EVENT_DEBUG
int
n
=
NO
(
bufferId
);
#endif
if
(
b
.
eventType
&
(
1
<<
(
Uint32
)
sdata
->
operation
)
)
{
if
(
b
.
subs
)
{
#ifdef EVENT_DEBUG
...
...
@@ -1175,6 +1180,13 @@ NdbGlobalEventBuffer::real_insertDataL(int bufferId,
#endif
}
}
else
{
#ifdef EVENT_DEBUG
ndbout_c
(
"skipped"
);
#endif
}
DBUG_RETURN
(
0
);
}
...
...
ndb/src/ndbapi/NdbEventOperationImpl.hpp
View file @
e1e34b51
...
...
@@ -79,7 +79,7 @@ public:
//static NdbGlobalEventBufferHandle *init(int MAX_NUMBER_ACTIVE_EVENTS);
// returns bufferId 0-N if ok otherwise -1
int
prepareAddSubscribeEvent
(
Uint32
eventId
,
int
&
hasSubscriber
);
int
prepareAddSubscribeEvent
(
NdbEventOperationImpl
*
,
int
&
hasSubscriber
);
void
unprepareAddSubscribeEvent
(
int
bufferId
);
void
addSubscribeEvent
(
int
bufferId
,
NdbEventOperationImpl
*
ndbEventOperationImpl
);
...
...
@@ -133,7 +133,8 @@ private:
int
MAX_NUMBER_ACTIVE_EVENTS
);
int
real_prepareAddSubscribeEvent
(
NdbGlobalEventBufferHandle
*
h
,
Uint32
eventId
,
int
&
hasSubscriber
);
NdbEventOperationImpl
*
,
int
&
hasSubscriber
);
void
real_unprepareAddSubscribeEvent
(
int
bufferId
);
void
real_addSubscribeEvent
(
int
bufferId
,
void
*
ndbEventOperation
);
...
...
@@ -177,6 +178,7 @@ private:
// local mutex for each event/buffer
NdbMutex
*
p_buf_mutex
;
Uint32
gId
;
Uint32
eventType
;
struct
Data
{
SubTableData
*
sdata
;
LinearSectionPtr
ptr
[
3
];
...
...
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