Notify data change with composite key?

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Notify data change with composite key?

Postby rieder » Thu Jun 28, 2018 4:53 pm

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
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: Notify data change with composite key?

Postby sean » Thu Jun 28, 2018 5:20 pm

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);
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Notify data change with composite key?

Postby rieder » Thu Jun 28, 2018 5:40 pm

Wow, super, I'll try!
Thanks and regards
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: Bing [Bot] and 8 guests