Share:
Developers » Script Objects & Methods » ScriptDatabase

PREVIOUS  |  NEXT

ScriptDatabase


The following table lists the available methods for the ScriptDatabase object:

Return TypeMethodExplanation
ScriptStoreProcedurecreateStoreProcedure(String name)Creates a stored procedure with the entered name
Voidexecute(String sql)Executes a DDL SQL such as create, drop, or alter
List<Map<String, Object>>execute(ScriptStoreProcedure storeProcedure, Map<String, Object> inParams)Executes the stored procedure
Int [ ]batchUpdate(String[ ] sql)

This method supports:

  • Multiple SQL updates on a single JDBC Statement using batching
  • An array of SQL statements that will be executed
Intupdate(String sql)An SQL update operation such as an insert, update or delete statement
Intupdate(String sql, Object[ ] args)An SQL update operation such as an insert, update or delete statement binding the given arguments
List<Map<String, Object>>queryForList(String sql)

This method:

  • Returns a list that contains one Map per row
  • Throws a ScriptException
List<Map<String, Object>>queryForList(String sql, Object[ ] args)

This method:

  • Return a List that contains one Map per row
  • Throws a ScriptException
  • Accepts arguments in an SLQ query
Map<String, Object>queryForMap(String sql)Executes a static SQL query and returns the resulting Map
Map<String, Object>queryForMap(String sql, Object[ ] args)Executes an SQL query with bind parameters and returns a Map as a result (includes one entry for each column, using the column name as the key)