I'm using Events in the NDB API. I'm wondering if it is possible to listen for events based upon a particular row...
For example:
CREATE TABLE mytable( id int(11) NOT NULL AUTO_INCREMENT,
name varchar(40),
PRIMARY KEY(id) );
INSERT INTO mytable values(NULL,'john');
INSERT INTO mytable values(NULL,'sallie');
INSERT INTO mytable values(NULL,'martin');
INSERT INTO mytable values(NULL,'alex');
So, now we have a table(mytable) with two columns. And we have added 4 rows.
In my examples testing the NDB API, I am able to tell when one of these names has been changed. So, say we change 'john' to 'jim'. In my code, after pollEvents() and getValue(), I am able to see that 'john' has changed to 'jim' by looking the contents of NdbRecAttr.
But, is there a way to only listen for changes to a specific id(row)?
For example, say I wanted to know when the name 'alex'(PK id = 4) has been changed.
Is this possible?
Or is there a way to tell which specific row has been altered, after the fact?
The only way I can find to achieve this is to request the Primary Key(s) using Event::addEventColumn() along with the column you are listening for an event on. Then you can perform your own filtering based on that/those primary keys
https://dev.mysql.com/doc/ndbapi/en/ndb-event-methods.html#ndb-event-addeventcolumn