Page 1 of 1

Notify data change with composite key?

PostPosted: Thu Jun 28, 2018 4:53 pm
by rieder
Hi

Can I notify data changes with the rawSQL plugin using composite keys?
What kind of dataset is the pksdataset in:
Code: Select all
var ok = plugins.rawSQL.notifyDataChange(databaseManager.getDataSourceServerName(controller.getDataSource()), 'employees', pksdataset,action)


Thanks for help and regards

Re: Notify data change with composite key?

PostPosted: Thu Jun 28, 2018 5:20 pm
by sean
Hi Birgit,

Yes that is supported. Use a JSDataSet object for the PKs.
If you have a composite keys, then you must add each key to the dataset as an array

Code: Select all

// Adds keys to a dataset
var ds = databaseManager.createEmptyDataSet(0,2) // create a dataset with 0 rows and 2 columns (assuming a 2-column key)
ds.addRow([101,202]) // add keys to the row as array of values (I believe the columns will be interpreted in alphabetical order)
plugins.rawSQL.notifyDataChange(serverName,tableName,ds,SQL_ACTION_TYPES.INSERT_ACTION);

Re: Notify data change with composite key?

PostPosted: Thu Jun 28, 2018 5:40 pm
by rieder
Wow, super, I'll try!
Thanks and regards