Child pages
  • rawSQL
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 22 Next »

Unknown macro: {div}

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Enter additional information related to this 'class' inside the {div} macro with 'id=description'

Unknown macro: {div}


Unknown macro: {table}

{column:width=80px|padding=0px}{column}{column}{column}

Unknown macro: {tr}
Unknown macro: {th}

Server Property Summary

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}


Unknown macro: {table}

{column:width=80px|padding=0px}{column}{column}{column}

Unknown macro: {tr}
Unknown macro: {th}

Method Summary

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

executeSQL(serverName, tableName, sql)
Execute any SQL, returns true if successful.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

executeSQL(serverName, tableName, sql, sql_args)
Execute any SQL, returns true if successful.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSDataSet

Unknown macro: {td}

executeStoredProcedure(serverName, procedureDeclaration, arguments, inOutDirectionality, maxNumberOfRowsToRetrieve)
Execute a stored procedure.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

flushAllClientsCache(serverName, tableName)
Flush cached database data.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

ServoyException

Unknown macro: {td}

getException()
If the result from a function was false, it will return the exception object.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

notifyDataChange(serverName, tableName, pksDataset, action)
Notify clients about changes in records, based on pk(s).


Unknown macro: {table}

{column:width=100%|padding=0px}{column}

Unknown macro: {tr}
Unknown macro: {th}

Server Property Details

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
servoy.rawSQL.allowClientCacheFlushes
Unknown macro: {tr}
Unknown macro: {td}


Unknown macro: {table}

{column:width=100%|padding=0px}{column}

Unknown macro: {tr}
Unknown macro: {th}

Method Details

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
executeSQL
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

executeSQL

Unknown macro: {span}

(serverName, tableName, sql)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Execute any SQL, returns true if successful.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} serverName – the name of the server
{String} tableName – the name of the table
{String} sql – the sql query to execute

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
/**************************************************************************** 
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.
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
executeSQL
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

executeSQL

Unknown macro: {span}

(serverName, tableName, sql, sql_args)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Execute any SQL, returns true if successful.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
/**************************************************************************** 
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.
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
executeStoredProcedure
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSDataSet

Unknown macro: {span}

executeStoredProcedure

Unknown macro: {span}

(serverName, procedureDeclaration, arguments, inOutDirectionality, maxNumberOfRowsToRetrieve)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Execute a stored procedure.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} serverName
{String} procedureDeclaration
{Object[]} arguments
{Number[]} inOutDirectionality
{Number} maxNumberOfRowsToRetrieve

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSDataSet

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
/**************************************************************************** 
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 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);
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
flushAllClientsCache
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

flushAllClientsCache

Unknown macro: {span}

(serverName, tableName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Flush cached database data. Use with extreme care, its affecting the performance of clients!

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} serverName
{String} tableName

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
/**************************************************************************** 
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.
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getException
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

ServoyException

Unknown macro: {span}

getException

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

If the result from a function was false, it will return the exception object.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

ServoyException

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
/**************************************************************************** 
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.
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
notifyDataChange
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

notifyDataChange

Unknown macro: {span}

(serverName, tableName, pksDataset, action)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Notify clients about changes in records, based on pk(s). Use with extreme care, its affecting the performance of clients!

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} serverName
{String} tableName
{JSDataSet} pksDataset
{Number} action

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
/**************************************************************************** 
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 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(databaseManager.getDataSourceServerName(controller.getDataSource()), 'employees', pksdataset,action)
Unknown macro: {tr}
Unknown macro: {td}
  • No labels