Table Head (thead) |
---|
Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
|
Table Body (tbody) |
---|
id | executeSQL-String_String_String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
executeSQL |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
(serverName, tableName, sql) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Execute any SQL, returns true if successful. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters Div |
---|
| {String} serverName - the name of the server {String} tableName - the name of the table {String} sql - the sql query to execute |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| /****************************************************************************
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 ifsuccessful.
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')
} |
|
|
|
|
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=14DAF76C-6426-4716-BE05-36C8A2EEE31A}{tr:id=name}{td}h6.executeStoredProcedure{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSDataSet]{span}{span:id=iets|style=float: left; font-weight: bold;}executeStoredProcedure{span}{span:id=iets|style=float: left;}\(serverName, procedureDeclaration, arguments[, IODirectionality[, maxNrReturnedRows){span}{td}{tr}{tr:id=des}{td}{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_des|text=|trigger=button}{sub-section}{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_des|trigger=none|class=sIndent}Execute a stored procedure.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_prs|trigger=none}serverName
procedureDeclaration
\[arguments[\]
\[IODirectionality[\]
maxNrReturnedRows
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_ret|text=|trigger=button}{sub-section}{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_ret|trigger=none|class=sIndent}[JSDataSet]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_see|text=|trigger=button}{sub-section}{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_see|text=|trigger=button}{sub-section}{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_sam|text=|trigger=button}{sub-section}{sub-section:14DAF76C-6426-4716-BE05-36C8A2EEE31A_sam|class=sIndent|trigger=none}{code:language=javascript}
/****************************************************************************
WARNING! You can cause
// Note that when this function is used to create a new table in the database, this table will only be seen by
// the Servoy Application Server when the table name starts with 'temp_', otherwise a server restart is needed. |
|
|
|
|
Table Body (tbody) |
---|
id | executeSQL-String_String_String_ObjectArray |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
executeSQL |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
(serverName, tableName, sql, sql_args) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Execute any SQL, returns true if successful. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters Div |
---|
| {String} serverName - the name of the server {String} tableName - the name of the table {String} sql - the sql query to execute {Object[]} sql_args - the arguments for the query |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| /****************************************************************************
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.maxReturnedRows10;//useful to limit number of rows
var procedure_declaration = '{?=calculate_interest_rate(?)}'
var args = new Array()
args[0] = java.sql.Types.NUMERIC
args[1] = 3000
// define the types and direction, in this case a 0 for input data
var typesArray = new Array();
typesArray[0]=1;
typesArray[1]=0;
var dataset = plugins.rawSQL.executeStoredProcedure(controller.getServerName(), procedure_declaration, args, typesArray,maxReturnedRows);
//example to calc a strange total
global_total = 0;
for( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ )
{
global_total = global_total + dataset.getValue(i,1);
}
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=D23E9616-9A97-4000-B9E5-807618AE9FF6}{tr:id=name}{td}h6.flushAllClientsCache{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}flushAllClientsCache{span}{span:id=iets|style=float: left;}\(serverName, tableName){span}{td}{tr}{tr:id=des}{td}{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_des|text=|trigger=button}{sub-section}{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_des|trigger=none|class=sIndent}Flush cached database data. Use with extreme care, its affecting the performance of clients!{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_prs|trigger=none}serverName
tableName
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_ret|text=|trigger=button}{sub-section}{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_see|text=|trigger=button}{sub-section}{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_see|text=|trigger=button}{sub-section}{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_sam|text=|trigger=button}{sub-section}{sub-section:D23E9616-9A97-4000-B9E5-807618AE9FF6_sam|class=sIndent|trigger=none}{code:language=javascript}
/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')
}
// Note that when this function is used to create a new table in the database, this table will only be seen by
// the Servoy Application Server when the table name starts with 'temp_', otherwise a server restart is needed. |
|
|
|
|
Table Body (tbody) |
---|
id | executeStoredProcedure-String_String_ObjectArray_NumberArray_Number |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
executeStoredProcedure |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
| executeStoredProcedure |
Span |
---|
(serverName, procedureDeclaration, arguments, inOutDirectionality, maxNumberOfRowsToRetrieve) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Execute a stored procedure. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| /****************************************************************************
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.
**************************************************************************** |
|
|
|
| *****
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')
}
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE}{tr:id=name}{td}h6.getException{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[ServoyException]{span}{span:id=iets|style=float: left; font-weight: bold;}getException{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_des|text=|trigger=button}{sub-section}{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_des|trigger=none|class=sIndent}If the result from a function was false, it will return the exception object.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_ret|text=|trigger=button}{sub-section}{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_ret|trigger=none|class=sIndent}[ServoyException]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_see|text=|trigger=button}{sub-section}{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_see|text=|trigger=button}{sub-section}{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_sam|text=|trigger=button}{sub-section}{sub-section:3FBA9ACD-C0C6-4E74-97F5-A722469EC1CE_sam|class=sIndent|trigger=none}{builder-show:permission=edit}{code:language=javascript}
{code}{builder-show}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=73C7AD14-A703-4BA0-BC59-55B3306F60DB}{tr:id=name}{td}h6.notifyDataChange{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}notifyDataChange{span}{span:id=iets|style=float: left;}\(serverName, tableName, pksDataset, action){span}{td}{tr}{tr:id=des}{td}{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_des|text=|trigger=button}{sub-section}{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_des|trigger=none|class=sIndent}Notify clients about changes in records, based on pk(s). Use with extreme care, its affecting the performance of clients!{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_prs|trigger=none}serverName
tableName
pksDataset
action
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_ret|text=|trigger=button}{sub-section}{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_see|text=|trigger=button}{sub-section}{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_see|text=|trigger=button}{sub-section}{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_sam|text=|trigger=button}{sub-section}{sub-section:73C7AD14-A703-4BA0-BC59-55B3306F60DB_sam|class=sIndent|trigger=none}{code:language=javascript}
/
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(databaseManager.getDataSourceServerName(controller.getDataSource()), procedure_declaration, args, typesArray, maxReturnedRows);
var interest_rate = dataset.getValue(1, 1); |
|
|
|
|
Table Body (tbody) |
---|
id | flushAllClientsCache-String_String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
flushAllClientsCache |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
(serverName, tableName) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Flush cached database data. Use with extreme care, its affecting the performance of clients! |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| /****************************************************************************
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.
****************************************************************************/
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')
}
// Note that when this function is used to create a new table in the database, this table will only be seen by
// the Servoy Application Server when the table name starts with 'temp_', otherwise a server restart is needed. |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getException |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| If the result from a function was false, it will return the exception object. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| /****************************************************************************
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.
****************************************************************************/
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')
}
// Note that when this function is used to create a new table in the database, this table will only be seen by
// the Servoy Application Server when the table name starts with 'temp_', otherwise a server restart is needed. |
|
|
|
|
Table Body (tbody) |
---|
id | notifyDataChange-String_String_JSDataSet_Number |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
notifyDataChange |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
(serverName, tableName, pksDataset, action) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Notify clients about changes in records, based on pk(s). Use with extreme care, its affecting the performance of clients! |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| /****************************************************************************
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.
****************************************************************************/
|
|
|
|
| //Notifyclientsaboutchanges in records, based on pk(s). Use with extreme care, its affecting the performance of clients!
var action = 1= SQL_ACTION_TYPES.DELETE_ACTION //pks deleted
//var action = |
|
|
|
| 2SQL_ACTION_TYPES.INSERT_ACTION //pks inserted
//var action = |
|
|
|
| 3SQL_ACTION_TYPES.UPDATE_ACTION //pks updates
var pksdataset = databaseManager.convertToDataSet(new Array(12,15,16,21))
var ok = plugins.rawSQL.notifyDataChange(databaseManager.getDataSourceServerName(controller. |
|
|
|
| getServerNamegetDataSource()), 'employees', pksdataset,action) |
|
|
|
|
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table} |