{column:padding=0px|width=80px}{column}{column}{column}
Server Property Summary
{column:padding=0px|width=80px}{column}{column}{column}
Method Summary
executeSQL(serverName, tableName, SQL, [arguments])
Execute any SQL, returns true if successful.
executeStoredProcedure(serverName, procedureDeclaration, [arguments[], [IODirectionality[], maxNrReturnedRows)
Execute a stored procedure.
flushAllClientsCache(serverName, tableName)
Flush cached database data.
getException()
If the result from a function was false, it will return the exception object.
notifyDataChange(serverName, tableName, pksDataset, action)
Notify clients about changes in records, based on pk(s).
{column:padding=0px|width=100%}{column}
Server Property Details
In case of performance problem you might want to disable this (true/false)
Since
Replace with version info
Parameters
Returns
Also see
External links
Sample
{column:padding=0px|width=100%}{column}
Method Details
executeSQL
(serverName, tableName, SQL, [arguments])
Execute any SQL, returns true if successful.
Since
Replace with version info
Parameters
serverName
tableName
SQL
[arguments]
Also see
External links
Sample
/**************************************************************************** WARNING! You can cause data loss or serious data integrity compromises! You should have a THOROUGH understanding of both SQL and your backend database (and other interfaces that may use that backend) BEFORE YOU USE ANY OF THESE COMMANDS. You should also READ THE DOCUMENTATION BEFORE USING ANY OF THESE COMMANDS Note that when server names have been switched (databasemanager.switchServer),the real server names must be used here, plugins.rawSQL is not transparent to switched servers. ****************************************************************************/ // Execute any SQL, returns true if successful. var country = 'NL' var done = plugins.rawSQL.executeSQL("example_data","employees","update employees set country = ?", [country]) if (done) { //flush is required when changes are made in db plugins.rawSQL.flushAllClientsCache("example_data","employees") } else { var msg = plugins.rawSQL.getException().getMessage(); //see exception node for more info about the exception obj plugins.dialogs.showErrorDialog('Error', 'SQL exception: '+msg, 'Ok') }
executeStoredProcedure
(serverName, procedureDeclaration, [arguments[], [IODirectionality[], maxNrReturnedRows)
Execute a stored procedure.
Since
Replace with version info
Parameters
serverName
procedureDeclaration
[arguments[]
[IODirectionality[]
maxNrReturnedRows
Also see
External links
Sample
/**************************************************************************** WARNING! You can cause data loss or serious data integrity compromises! You should have a THOROUGH understanding of both SQL and your backend database (and other interfaces that may use that backend) BEFORE YOU USE ANY OF THESE COMMANDS. You should also READ THE DOCUMENTATION BEFORE USING ANY OF THESE COMMANDS Note that when server names have been switched (databasemanager.switchServer),the real server names must be used here, plugins.rawSQL is not transparent to switched servers. ****************************************************************************/ // Execute a stored procedure. var maxReturnedRows = 10; //useful to limit number of rows var procedure_declaration = '{?=calculate_interest_rate(?)}' // define the direction, a 0 for input data, a 1 for output data var typesArray = [1, 0]; // define the types and values, a value for input data, a sql-type for output data var args = [java.sql.Types.NUMERIC, 3000] // A dataset is returned, when no output-parameters defined, the last select-result in the procedure will be returned. // When one or more output-parameters are defined, the dataset will contain 1 row with the output data. var dataset = plugins.rawSQL.executeStoredProcedure(controller.getServerName(), procedure_declaration, args, typesArray, maxReturnedRows); var interest_rate = dataset.getValue(1, 1);
flushAllClientsCache
(serverName, tableName)
Flush cached database data. Use with extreme care, its affecting the performance of clients!
Since
Replace with version info
Parameters
serverName
tableName
Also see
External links
Sample
/**************************************************************************** WARNING! You can cause data loss or serious data integrity compromises! You should have a THOROUGH understanding of both SQL and your backend database (and other interfaces that may use that backend) BEFORE YOU USE ANY OF THESE COMMANDS. You should also READ THE DOCUMENTATION BEFORE USING ANY OF THESE COMMANDS Note that when server names have been switched (databasemanager.switchServer),the real server names must be used here, plugins.rawSQL is not transparent to switched servers. ****************************************************************************/ // Flush cached database data. Use with extreme care, its affecting the performance of clients! var country = 'NL' var done = plugins.rawSQL.executeSQL("example_data","employees","update employees set country = ?", [country]) if (done) { //flush is required when changes are made in db plugins.rawSQL.flushAllClientsCache("example_data","employees") } else { var msg = plugins.rawSQL.getException().getMessage(); //see exception node for more info about the exception obj plugins.dialogs.showErrorDialog('Error', 'SQL exception: '+msg, 'Ok') }
getException
()
If the result from a function was false, it will return the exception object.
Since
Replace with version info
Parameters
Returns
Also see
External links
Sample
/**************************************************************************** WARNING! You can cause data loss or serious data integrity compromises! You should have a THOROUGH understanding of both SQL and your backend database (and other interfaces that may use that backend) BEFORE YOU USE ANY OF THESE COMMANDS. You should also READ THE DOCUMENTATION BEFORE USING ANY OF THESE COMMANDS Note that when server names have been switched (databasemanager.switchServer),the real server names must be used here, plugins.rawSQL is not transparent to switched servers. ****************************************************************************/ // If the result from a function was false, it will return the exception object. var country = 'NL' var done = plugins.rawSQL.executeSQL("example_data","employees","update employees set country = ?", [country]) if (done) { //flush is required when changes are made in db plugins.rawSQL.flushAllClientsCache("example_data","employees") } else { var msg = plugins.rawSQL.getException().getMessage(); //see exception node for more info about the exception obj plugins.dialogs.showErrorDialog('Error', 'SQL exception: '+msg, 'Ok') }
notifyDataChange
(serverName, tableName, pksDataset, action)
Notify clients about changes in records, based on pk(s). Use with extreme care, its affecting the performance of clients!
Since
Replace with version info
Parameters
serverName
tableName
pksDataset
action
Also see
External links
Sample
/**************************************************************************** WARNING! You can cause data loss or serious data integrity compromises! You should have a THOROUGH understanding of both SQL and your backend database (and other interfaces that may use that backend) BEFORE YOU USE ANY OF THESE COMMANDS. You should also READ THE DOCUMENTATION BEFORE USING ANY OF THESE COMMANDS Note that when server names have been switched (databasemanager.switchServer),the real server names must be used here, plugins.rawSQL is not transparent to switched servers. ****************************************************************************/ // Notify clients about changes in records, based on pk(s). Use with extreme care, its affecting the performance of clients! var action = SQL_ACTION_TYPES.DELETE_ACTION //pks deleted //var action = SQL_ACTION_TYPES.INSERT_ACTION //pks inserted //var action = SQL_ACTION_TYPES.UPDATE_ACTION //pks updates var pksdataset = databaseManager.convertToDataSet(new Array(12,15,16,21)) var ok = plugins.rawSQL.notifyDataChange(controller.getServerName(), 'employees', pksdataset,action)