org.apache.derby.catalog
Class SystemProcedures

java.lang.Object
  extended by org.apache.derby.catalog.SystemProcedures

public class SystemProcedures
extends java.lang.Object

Some system built-in procedures, and help routines. Now used for network server. These procedures are built-in to the SYSIBM schema which match the DB2 SYSIBM procedures. Currently information on those can be found at url: ftp://ftp.software.ibm.com/ps/products/db2/info/vr8/pdf/letter/db2l2e80.pdf

Also used for builtin-routines, such as SYSFUN functions, when direct calls into Java libraries cannot be made.


Field Summary
private static java.lang.String DRIVER_TYPE_OPTION
           
private static double LOG10
          Constant for natural log(10).
private static java.lang.String ODBC_DRIVER_OPTION
           
private static int SQL_BEST_ROWID
           
private static int SQL_ROWVER
           
static java.lang.String SQLERRMC_MESSAGE_DELIMITER
          SQLERRMC_MESSAGE_DELIMITER When message argument tokes are sent, this value separates the tokens for mulitiple error messages
 
Constructor Summary
SystemProcedures()
           
 
Method Summary
private static void checkJarSQLName(java.lang.String sqlName)
           
static double COSH(double value)
          Hyperbolic Cosine function.
static double COT(double value)
          Cotangent function.
private static void createXplainSchema(java.lang.String schemaName)
           
private static void createXplainTable(LanguageConnectionContext lcc, java.lang.String schemaName, XPLAINTableDescriptor t)
           
private static java.sql.Connection getDefaultConn()
          Get the default or nested connection corresponding to the URL jdbc:default:connection.
private static java.sql.DatabaseMetaData getDMD()
          Get the DatabaseMetaData for the current connection for use in mapping the jcc SYSIBM.* calls to the Derby DatabaseMetaData methods
private static java.lang.String getOption(java.lang.String pattern, java.lang.String options)
          Helper for SQLForeignKeys and SQLTables
private static boolean hasSchema(java.sql.Connection conn, java.lang.String schemaName)
           
private static boolean hasTable(java.sql.Connection conn, java.lang.String schemaName, java.lang.String tableName)
           
static void INSTALL_JAR(java.lang.String url, java.lang.String jar, int deploy)
          Install a jar file in the database.
private static boolean isForODBC(java.lang.String options)
          Helper for ODBC metadata calls.
static double LOG10(double value)
          Base 10 log function.
static void METADATA(java.sql.ResultSet[] rs)
           
static double PI()
          Method to return the constant PI.
static double RAND(int seed)
          Pseudo-random number function.
static void REMOVE_JAR(java.lang.String jar, int undeploy)
          Remove a jar file from the database.
private static void removeFromAccessList(java.lang.String listProperty, java.lang.String userName)
          Utility method for SYSCS_SET_USER_ACCESS removes a user from one of the access lists, driven by the property name.
static void REPLACE_JAR(java.lang.String url, java.lang.String jar)
          Replace a jar file in the database.
static int SIGN(double value)
          Method to return the sign of the given value.
static double SINH(double value)
          Hyperbolic Sine function.
static void SQLCAMESSAGE(int sqlcode, short errmcLen, java.lang.String sqlerrmc, java.lang.String sqlerrp, int errd0, int errd1, int errd2, int errd3, int errd4, int errd5, java.lang.String warn, java.lang.String sqlState, java.lang.String file, java.lang.String localeStr, java.lang.String[] msg, int[] rc)
          Method used by Derby Network Server to get localized message (original call from jcc.
static void SQLCOLPRIVILEGES(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLColPrivileges to EmbedDatabaseMetaData.getColumnPrivileges
static void SQLCOLUMNS(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLColumns to EmbedDatabaseMetaData.getColumns
static void SQLFOREIGNKEYS(java.lang.String pkCatalogName, java.lang.String pkSchemaName, java.lang.String pkTableName, java.lang.String fkCatalogName, java.lang.String fkSchemaName, java.lang.String fkTableName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLForeignKeys to EmbedDatabaseMetaData.getImportedKeys, getExportedKeys, and getCrossReference
static void SQLFUNCTIONPARAMS(java.lang.String catalogName, java.lang.String schemaName, java.lang.String funcName, java.lang.String paramName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLFunctionParameters to EmbedDatabaseMetaData.getFunctionColumns()
static void SQLFUNCTIONS(java.lang.String catalogName, java.lang.String schemaName, java.lang.String funcName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLFunctions to EmbedDatabaseMetaData.getFunctions
static void SQLGETTYPEINFO(short dataType, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLGetTypeInfo to EmbedDatabaseMetaData.getTypeInfo
static void SQLPRIMARYKEYS(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLPrimaryKeys to EmbedDatabaseMetaData.getPrimaryKeys
static void SQLPROCEDURECOLS(java.lang.String catalogName, java.lang.String schemaName, java.lang.String procName, java.lang.String paramName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLProcedureCols to EmbedDatabaseMetaData.getProcedureColumns
static void SQLPROCEDURES(java.lang.String catalogName, java.lang.String schemaName, java.lang.String procName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLProcedures to EmbedDatabaseMetaData.getProcedures
static void SQLSPECIALCOLUMNS(short colType, java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, short scope, short nullable, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLSpecialColumns to EmbedDatabaseMetaData.getBestRowIdentifier and getVersionColumns
static void SQLSTATISTICS(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, short unique, short approximate, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLStatistics to EmbedDatabaseMetaData.getIndexInfo
static void SQLTABLEPRIVILEGES(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLTablePrivileges to EmbedDatabaseMetaData.getTablePrivileges
static void SQLTABLES(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, java.lang.String tableType, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLTables to EmbedDatabaseMetaData.getSchemas, getCatalogs, getTableTypes and getTables, and return the result of the DatabaseMetaData calls.
static void SQLUDTS(java.lang.String catalogName, java.lang.String schemaPattern, java.lang.String typeNamePattern, java.lang.String udtTypes, java.lang.String options, java.sql.ResultSet[] rs)
          Map SQLUDTS to EmbedDatabaseMetaData.getUDTs
static void SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT(java.lang.String backupDir, short deleteOnlineArchivedLogFiles)
          Backup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version backup.
static void SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(java.lang.String backupDir, short deleteOnlineArchivedLogFiles)
          Backup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version of the backup.
static void SYSCS_BACKUP_DATABASE_NOWAIT(java.lang.String backupDir)
          Backup the database to a backup directory.
static void SYSCS_BACKUP_DATABASE(java.lang.String backupDir)
          Backup the database to a backup directory.
static void SYSCS_BULK_INSERT(java.lang.String schemaName, java.lang.String tableName, java.lang.String vtiName, java.lang.String vtiArg)
          Perform bulk insert using the specificed vti .
static int SYSCS_CHECK_TABLE(java.lang.String schema, java.lang.String tablename)
           
static void SYSCS_CHECKPOINT_DATABASE()
           
static void SYSCS_COMPRESS_TABLE(java.lang.String schema, java.lang.String tablename, short sequential)
          Compress the table.
static void SYSCS_DISABLE_LOG_ARCHIVE_MODE(short deleteOnlineArchivedLogFiles)
          Disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.
static void SYSCS_EMPTY_STATEMENT_CACHE()
          Empty as much of the cache as possible.
static void SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(java.lang.String selectStatement, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, java.lang.String lobsFileName)
          Export data from a select statement to given file.
static void SYSCS_EXPORT_QUERY(java.lang.String selectStatement, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset)
          Export data from a select statement to given file.
static void SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(java.lang.String schemaName, java.lang.String tableName, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, java.lang.String lobsFileName)
          Export data from a table to given files.
static void SYSCS_EXPORT_TABLE(java.lang.String schemaName, java.lang.String tableName, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset)
          Export data from a table to given file.
static void SYSCS_FREEZE_DATABASE()
          Freeze the database.
static java.lang.String SYSCS_GET_DATABASE_PROPERTY(java.lang.String key)
          Get the value of a property of the database in current connection.
static java.lang.String SYSCS_GET_RUNTIMESTATISTICS()
           
static java.lang.String SYSCS_GET_USER_ACCESS(java.lang.String userName)
          Get the connection level authorization for a specific user - SYSCS_UTIL.SYSCS_GET_USER_ACCESS.
static int SYSCS_GET_XPLAIN_MODE()
          This procedure returns the current status of the xplain mode.
static java.lang.String SYSCS_GET_XPLAIN_SCHEMA()
          This procedure returns the current set XPLAIN_SCHEMA
static void SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE(java.lang.String schemaName, java.lang.String tableName, java.lang.String insertColumnList, java.lang.String columnIndexes, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, short replace)
          Import data from a given file into the specified table columns from the specified columns in the file.
static void SYSCS_IMPORT_DATA(java.lang.String schemaName, java.lang.String tableName, java.lang.String insertColumnList, java.lang.String columnIndexes, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, short replace)
          Import data from a given file into the specified table columns from the specified columns in the file.
static void SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(java.lang.String schemaName, java.lang.String tableName, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, short replace)
          Import data from a given file to a table.
static void SYSCS_IMPORT_TABLE(java.lang.String schemaName, java.lang.String tableName, java.lang.String fileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, short replace)
          Import data from a given file to a table.
static void SYSCS_INPLACE_COMPRESS_TABLE(java.lang.String schema, java.lang.String tablename, short purgeRows, short defragmentRows, short truncateEnd)
          Implementation of SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE().
static void SYSCS_RELOAD_SECURITY_POLICY()
          Reload the policy file.
static void SYSCS_SET_DATABASE_PROPERTY(java.lang.String key, java.lang.String value)
          Set/delete the value of a property of the database in current connection.
static void SYSCS_SET_RUNTIMESTATISTICS(short enable)
           
static void SYSCS_SET_STATISTICS_TIMING(short enable)
           
static void SYSCS_SET_USER_ACCESS(java.lang.String userName, java.lang.String connectionPermission)
          Set the connection level authorization for a specific user - SYSCS_UTIL.SYSCS_SET_USER_ACCESS.
static void SYSCS_SET_XPLAIN_MODE(int mode)
          this procedure switches between the different xplain modes
static void SYSCS_SET_XPLAIN_SCHEMA(java.lang.String schemaName)
          This procedure sets the current xplain schema.
static void SYSCS_UNFREEZE_DATABASE()
          Unfreeze the database.
static void SYSCS_UPDATE_STATISTICS(java.lang.String schemaname, java.lang.String tablename, java.lang.String indexname)
          Update the statistics for 1)all the indexes or 2)a specific index on a table.
static double TANH(double value)
          Hyperbolic Tangent function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_BEST_ROWID

private static final int SQL_BEST_ROWID
See Also:
Constant Field Values

SQL_ROWVER

private static final int SQL_ROWVER
See Also:
Constant Field Values

DRIVER_TYPE_OPTION

private static final java.lang.String DRIVER_TYPE_OPTION
See Also:
Constant Field Values

ODBC_DRIVER_OPTION

private static final java.lang.String ODBC_DRIVER_OPTION
See Also:
Constant Field Values

SQLERRMC_MESSAGE_DELIMITER

public static final java.lang.String SQLERRMC_MESSAGE_DELIMITER
SQLERRMC_MESSAGE_DELIMITER When message argument tokes are sent, this value separates the tokens for mulitiple error messages


LOG10

private static final double LOG10
Constant for natural log(10).

Constructor Detail

SystemProcedures

public SystemProcedures()
Method Detail

SQLCAMESSAGE

public static void SQLCAMESSAGE(int sqlcode,
                                short errmcLen,
                                java.lang.String sqlerrmc,
                                java.lang.String sqlerrp,
                                int errd0,
                                int errd1,
                                int errd2,
                                int errd3,
                                int errd4,
                                int errd5,
                                java.lang.String warn,
                                java.lang.String sqlState,
                                java.lang.String file,
                                java.lang.String localeStr,
                                java.lang.String[] msg,
                                int[] rc)
Method used by Derby Network Server to get localized message (original call from jcc.

Parameters:
sqlcode - sqlcode, not used.
errmcLen - sqlerrmc length
sqlerrmc - sql error message tokens, variable part of error message (ie., arguments) plus messageId, separated by separator.
sqlerrp - not used
errd0 - not used
errd1 - not used
errd2 - not used
errd3 - not used
errd4 - not used
errd5 - not used
warn - not used
sqlState - 5-char sql state
file - not used
localeStr - client locale in string
msg - OUTPUT parameter, localized error message
rc - OUTPUT parameter, return code -- 0 for success

getDefaultConn

private static java.sql.Connection getDefaultConn()
                                           throws java.sql.SQLException
Get the default or nested connection corresponding to the URL jdbc:default:connection. We do not use DriverManager here as it is not supported in JSR 169. IN addition we need to perform more checks for null drivers or the driver returing null from connect as that logic is in DriverManager.

Returns:
The nested connection
Throws:
java.sql.SQLException - Not running in a SQL statement

getDMD

private static java.sql.DatabaseMetaData getDMD()
                                         throws java.sql.SQLException
Get the DatabaseMetaData for the current connection for use in mapping the jcc SYSIBM.* calls to the Derby DatabaseMetaData methods

Returns:
The DatabaseMetaData object of the current connection
Throws:
java.sql.SQLException

SQLPROCEDURES

public static void SQLPROCEDURES(java.lang.String catalogName,
                                 java.lang.String schemaName,
                                 java.lang.String procName,
                                 java.lang.String options,
                                 java.sql.ResultSet[] rs)
                          throws java.sql.SQLException
Map SQLProcedures to EmbedDatabaseMetaData.getProcedures

Parameters:
catalogName - SYSIBM.SQLProcedures CatalogName varchar(128),
schemaName - SYSIBM.SQLProcedures SchemaName varchar(128),
procName - SYSIBM.SQLProcedures ProcName varchar(128),
options - SYSIBM.SQLProcedures Options varchar(4000))
rs - output parameter, the resultset object containing the result of getProcedures If options contains the string 'DATATYPE='ODBC'', call the ODBC version of this procedure.
Throws:
java.sql.SQLException

SQLFUNCTIONS

public static void SQLFUNCTIONS(java.lang.String catalogName,
                                java.lang.String schemaName,
                                java.lang.String funcName,
                                java.lang.String options,
                                java.sql.ResultSet[] rs)
                         throws java.sql.SQLException
Map SQLFunctions to EmbedDatabaseMetaData.getFunctions

Parameters:
catalogName - SYSIBM.SQLFunctions CatalogName varchar(128),
schemaName - SYSIBM.SQLFunctions SchemaName varchar(128),
funcName - SYSIBM.SQLFunctions ProcName varchar(128),
options - SYSIBM.SQLFunctions Options varchar(4000)) (not used)
rs - output parameter, the resultset object containing the result of getFunctions
Throws:
java.sql.SQLException

SQLTABLES

public static void SQLTABLES(java.lang.String catalogName,
                             java.lang.String schemaName,
                             java.lang.String tableName,
                             java.lang.String tableType,
                             java.lang.String options,
                             java.sql.ResultSet[] rs)
                      throws java.sql.SQLException
Map SQLTables to EmbedDatabaseMetaData.getSchemas, getCatalogs, getTableTypes and getTables, and return the result of the DatabaseMetaData calls.

JCC and DNC overload this method:

Parameters:
catalogName - SYSIBM.SQLTables CatalogName varchar(128),
schemaName - SYSIBM.SQLTables SchemaName varchar(128),
tableName - SYSIBM.SQLTables TableName varchar(128),
tableType - SYSIBM.SQLTables TableType varchar(4000))
options - SYSIBM.SQLTables Options varchar(4000))
rs - output parameter, the resultset object
Throws:
java.sql.SQLException

SQLFOREIGNKEYS

public static void SQLFOREIGNKEYS(java.lang.String pkCatalogName,
                                  java.lang.String pkSchemaName,
                                  java.lang.String pkTableName,
                                  java.lang.String fkCatalogName,
                                  java.lang.String fkSchemaName,
                                  java.lang.String fkTableName,
                                  java.lang.String options,
                                  java.sql.ResultSet[] rs)
                           throws java.sql.SQLException
Map SQLForeignKeys to EmbedDatabaseMetaData.getImportedKeys, getExportedKeys, and getCrossReference

Parameters:
pkCatalogName - SYSIBM.SQLForeignKeys PKCatalogName varchar(128),
pkSchemaName - SYSIBM.SQLForeignKeys PKSchemaName varchar(128),
pkTableName - SYSIBM.SQLForeignKeys PKTableName varchar(128),
fkCatalogName - SYSIBM.SQLForeignKeys FKCatalogName varchar(128),
fkSchemaName - SYSIBM.SQLForeignKeys FKSchemaName varchar(128),
fkTableName - SYSIBM.SQLForeignKeys FKTableName varchar(128),
options - SYSIBM.SQLForeignKeys Options varchar(4000))
rs - output parameter, the resultset object containing the result of the DatabaseMetaData calls JCC overloads this method: If options contains the string 'EXPORTEDKEY=1', call getImportedKeys If options contains the string 'IMPORTEDKEY=1', call getExportedKeys otherwise, call getCrossReference
Throws:
java.sql.SQLException

getOption

private static java.lang.String getOption(java.lang.String pattern,
                                          java.lang.String options)
Helper for SQLForeignKeys and SQLTables

Parameters:
pattern - String containing the option to search for
options - String containing the options to search through
Returns:
option String containing the value for a given option

SQLPROCEDURECOLS

public static void SQLPROCEDURECOLS(java.lang.String catalogName,
                                    java.lang.String schemaName,
                                    java.lang.String procName,
                                    java.lang.String paramName,
                                    java.lang.String options,
                                    java.sql.ResultSet[] rs)
                             throws java.sql.SQLException
Map SQLProcedureCols to EmbedDatabaseMetaData.getProcedureColumns

Parameters:
catalogName - SYSIBM.SQLProcedureCols CatalogName varchar(128),
schemaName - SYSIBM.SQLProcedureCols SchemaName varchar(128),
procName - SYSIBM.SQLProcedureCols ProcName varchar(128),
paramName - SYSIBM.SQLProcedureCols ParamName varchar(128),
options - SYSIBM.SQLProcedureCols Options varchar(4000))
rs - output parameter, the resultset object containing the result of getProcedureColumns If options contains the string 'DATATYPE='ODBC'', call the ODBC version of this procedure.
Throws:
java.sql.SQLException

SQLFUNCTIONPARAMS

public static void SQLFUNCTIONPARAMS(java.lang.String catalogName,
                                     java.lang.String schemaName,
                                     java.lang.String funcName,
                                     java.lang.String paramName,
                                     java.lang.String options,
                                     java.sql.ResultSet[] rs)
                              throws java.sql.SQLException
Map SQLFunctionParameters to EmbedDatabaseMetaData.getFunctionColumns()

Parameters:
catalogName - SYSIBM.SQLFunctionParameters CatalogName varchar(128),
schemaName - SYSIBM.SQLFunctionParameters SchemaName varchar(128),
funcName - SYSIBM.SQLFunctionParameters FuncName varchar(128),
paramName - SYSIBM.SQLFunctionParameters ParamName varchar(128),
options - SYSIBM.SQLFunctionParameters Options varchar(4000))
rs - output parameter, the resultset object containing the result of getFunctionColumns().
Throws:
java.sql.SQLException

SQLCOLUMNS

public static void SQLCOLUMNS(java.lang.String catalogName,
                              java.lang.String schemaName,
                              java.lang.String tableName,
                              java.lang.String columnName,
                              java.lang.String options,
                              java.sql.ResultSet[] rs)
                       throws java.sql.SQLException
Map SQLColumns to EmbedDatabaseMetaData.getColumns

Parameters:
catalogName - SYSIBM.SQLColumns CatalogName varchar(128),
schemaName - SYSIBM.SQLColumns SchemaName varchar(128),
tableName - SYSIBM.SQLColumns TableName varchar(128),
columnName - SYSIBM.SQLColumns ColumnName varchar(128),
options - SYSIBM.SQLColumns Options varchar(4000)) If options contains the string 'DATATYPE='ODBC'', call the ODBC version of this procedure.
rs - output parameter, the resultset object containing the result of getProcedures
Throws:
java.sql.SQLException

SQLCOLPRIVILEGES

public static void SQLCOLPRIVILEGES(java.lang.String catalogName,
                                    java.lang.String schemaName,
                                    java.lang.String tableName,
                                    java.lang.String columnName,
                                    java.lang.String options,
                                    java.sql.ResultSet[] rs)
                             throws java.sql.SQLException
Map SQLColPrivileges to EmbedDatabaseMetaData.getColumnPrivileges

Parameters:
catalogName - SYSIBM.SQLColPrivileges CatalogName varchar(128),
schemaName - SYSIBM.SQLColPrivileges SchemaName varchar(128),
tableName - SYSIBM.SQLColPrivileges ProcName varchar(128),
columnName - SYSIBM.SQLColPrivileges ColumnName varchar(128),
options - SYSIBM.SQLColPrivileges Options varchar(4000))
rs - output parameter, the resultset object containing the result of getColumnPrivileges
Throws:
java.sql.SQLException

SQLTABLEPRIVILEGES

public static void SQLTABLEPRIVILEGES(java.lang.String catalogName,
                                      java.lang.String schemaName,
                                      java.lang.String tableName,
                                      java.lang.String options,
                                      java.sql.ResultSet[] rs)
                               throws java.sql.SQLException
Map SQLTablePrivileges to EmbedDatabaseMetaData.getTablePrivileges

Parameters:
catalogName - SYSIBM.SQLTablePrivileges CatalogName varchar(128),
schemaName - SYSIBM.SQLTablePrivileges SchemaName varchar(128),
tableName - SYSIBM.SQLTablePrivileges ProcName varchar(128),
options - SYSIBM.SQLTablePrivileges Options varchar(4000))
rs - output parameter, the resultset object containing the result of getTablePrivileges
Throws:
java.sql.SQLException

SQLPRIMARYKEYS

public static void SQLPRIMARYKEYS(java.lang.String catalogName,
                                  java.lang.String schemaName,
                                  java.lang.String tableName,
                                  java.lang.String options,
                                  java.sql.ResultSet[] rs)
                           throws java.sql.SQLException
Map SQLPrimaryKeys to EmbedDatabaseMetaData.getPrimaryKeys

Parameters:
catalogName - SYSIBM.SQLPrimaryKeys CatalogName varchar(128),
schemaName - SYSIBM.SQLPrimaryKeys SchemaName varchar(128),
tableName - SYSIBM.SQLPrimaryKeys TableName varchar(128),
options - SYSIBM.SQLPrimaryKeys Options varchar(4000)) If options contains the string 'DATATYPE='ODBC'', call the ODBC version of this procedure.
rs - output parameter, the resultset object containing the result of getPrimaryKeys
Throws:
java.sql.SQLException

SQLGETTYPEINFO

public static void SQLGETTYPEINFO(short dataType,
                                  java.lang.String options,
                                  java.sql.ResultSet[] rs)
                           throws java.sql.SQLException
Map SQLGetTypeInfo to EmbedDatabaseMetaData.getTypeInfo

Parameters:
dataType - SYSIBM.SQLGetTypeInfo DataType smallint,
options - SYSIBM.SQLGetTypeInfo Options varchar(4000)) If options contains the string 'DATATYPE='ODBC'', call the ODBC version of this procedure.
rs - output parameter, the resultset object containing the result of getTypeInfo
Throws:
java.sql.SQLException

SQLSTATISTICS

public static void SQLSTATISTICS(java.lang.String catalogName,
                                 java.lang.String schemaName,
                                 java.lang.String tableName,
                                 short unique,
                                 short approximate,
                                 java.lang.String options,
                                 java.sql.ResultSet[] rs)
                          throws java.sql.SQLException
Map SQLStatistics to EmbedDatabaseMetaData.getIndexInfo

Parameters:
catalogName - SYSIBM.SQLStatistics CatalogName varchar(128),
schemaName - SYSIBM.SQLStatistics SchemaName varchar(128),
tableName - SYSIBM.SQLStatistics TableName varchar(128),
unique - SYSIBM.SQLStatistics Unique smallint; 0=SQL_INDEX_UNIQUE(0); 1=SQL_INDEX_ALL(1),
approximate - SYSIBM.SQLStatistics Approximate smallint; 1=true; 0=false,
options - SYSIBM.SQLStatistics Options varchar(4000)) If options contains the string 'DATATYPE='ODBC'', call the ODBC version of this procedure.
rs - output parameter, the resultset object containing the result of getIndexInfo
Throws:
java.sql.SQLException

SQLSPECIALCOLUMNS

public static void SQLSPECIALCOLUMNS(short colType,
                                     java.lang.String catalogName,
                                     java.lang.String schemaName,
                                     java.lang.String tableName,
                                     short scope,
                                     short nullable,
                                     java.lang.String options,
                                     java.sql.ResultSet[] rs)
                              throws java.sql.SQLException
Map SQLSpecialColumns to EmbedDatabaseMetaData.getBestRowIdentifier and getVersionColumns

Parameters:
colType - SYSIBM.SQLSpecialColumns ColType smallint, where 1 means getBestRowIdentifier and 2 getVersionColumns was called.
catalogName - SYSIBM.SQLSpecialColumns CatalogName varchar(128),
schemaName - SYSIBM.SQLSpecialColumns SchemaName varchar(128),
tableName - SYSIBM.SQLSpecialColumns TableName varchar(128),
scope - SYSIBM.SQLSpecialColumns Scope smallint,
nullable - SYSIBM.SQLSpecialColumns Nullable smallint; 0=false, 1=true,
options - SYSIBM.SQLSpecialColumns Options varchar(4000)) If options contains the string 'DATATYPE='ODBC'', call the ODBC version of this procedure.
rs - output parameter, the resultset object containing the result of the DatabaseMetaData call
Throws:
java.sql.SQLException

SQLUDTS

public static void SQLUDTS(java.lang.String catalogName,
                           java.lang.String schemaPattern,
                           java.lang.String typeNamePattern,
                           java.lang.String udtTypes,
                           java.lang.String options,
                           java.sql.ResultSet[] rs)
                    throws java.sql.SQLException
Map SQLUDTS to EmbedDatabaseMetaData.getUDTs

Parameters:
catalogName - SYSIBM.SQLUDTS CatalogName varchar(128),
schemaPattern - SYSIBM.SQLUDTS Schema_Name_Pattern varchar(128),
typeNamePattern - SYSIBM.SQLUDTS Type_Name_Pattern varchar(128),
udtTypes - SYSIBM.SQLUDTS UDTTypes varchar(128),
options - SYSIBM.SQLUDTS Options varchar(4000))
rs - output parameter, the resultset object containing the result of getUDTs, which will be empty
Throws:
java.sql.SQLException

METADATA

public static void METADATA(java.sql.ResultSet[] rs)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

isForODBC

private static boolean isForODBC(java.lang.String options)
Helper for ODBC metadata calls.

Parameters:
options - String containig the options to search through.
Returns:
True if options contain ODBC indicator; false otherwise.

SYSCS_SET_DATABASE_PROPERTY

public static void SYSCS_SET_DATABASE_PROPERTY(java.lang.String key,
                                               java.lang.String value)
                                        throws java.sql.SQLException
Set/delete the value of a property of the database in current connection.

Will be called as SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY.

Parameters:
key - The property key.
value - The new value, if null the property is deleted.
Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_GET_DATABASE_PROPERTY

public static java.lang.String SYSCS_GET_DATABASE_PROPERTY(java.lang.String key)
                                                    throws java.sql.SQLException
Get the value of a property of the database in current connection.

Will be called as SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY.

Parameters:
key - The property key.
Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_UPDATE_STATISTICS

public static void SYSCS_UPDATE_STATISTICS(java.lang.String schemaname,
                                           java.lang.String tablename,
                                           java.lang.String indexname)
                                    throws java.sql.SQLException
Update the statistics for 1)all the indexes or 2)a specific index on a table.

Calls either "alter table tablename all update statistics " sql or "alter table tablename update statistics indexname" sql This routine will be called when an application calls: SYSCS_UTIL.SYSCS_UPDATE_STATISTICS

Parameters:
schemaname - schema name of the index(es) whose statistics will be updated. Must be non-null, no default is used.
tablename - table name of the index(es) whose statistics will be updated. Must be non-null.
indexname - Can be null. If not null or emptry string then the user wants to update the statistics for only this index. If null, then update the statistics for all the indexes for the given table name.
Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_COMPRESS_TABLE

public static void SYSCS_COMPRESS_TABLE(java.lang.String schema,
                                        java.lang.String tablename,
                                        short sequential)
                                 throws java.sql.SQLException
Compress the table.

Calls the "alter table compress {sequential}" sql. This syntax is not db2 compatible so it mapped by a system routine. This routine will be called when an application calls: SYSCS_UTIL.SYSCS_COMPRESS_TABLE

Parameters:
schema - schema name of the table to compress. Must be non-null, no default is used.
tablename - table name of the table to compress. Must be non-null.
sequential - if non-zero then rebuild indexes sequentially, if 0 then rebuild all indexes in parallel.
Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_FREEZE_DATABASE

public static void SYSCS_FREEZE_DATABASE()
                                  throws java.sql.SQLException
Freeze the database.

Call internal routine to freeze the database so that a backup can be made.

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_UNFREEZE_DATABASE

public static void SYSCS_UNFREEZE_DATABASE()
                                    throws java.sql.SQLException
Unfreeze the database.

Call internal routine to unfreeze the database, which was "freezed" by calling SYSCS_FREEZE_DATABASE(). can be made.

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_CHECKPOINT_DATABASE

public static void SYSCS_CHECKPOINT_DATABASE()
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

SYSCS_BACKUP_DATABASE

public static void SYSCS_BACKUP_DATABASE(java.lang.String backupDir)
                                  throws java.sql.SQLException
Backup the database to a backup directory. This procedure will throw error, if there are any unlogged operation executed in the same transaction backup is started. If there any unlogged operations in progess in other transaction, it will wait until those transactions are completed before starting the backup. Examples of unlogged operations include: create index and bulk insert. Note that once the backup begins these operations will not block, instead they are automatically converted into logged operations.

Parameters:
backupDir - the name of the directory where the backup should be stored. This directory will be created if it does not exist.
Throws:
StandardException - thrown on error
java.sql.SQLException

SYSCS_BACKUP_DATABASE_NOWAIT

public static void SYSCS_BACKUP_DATABASE_NOWAIT(java.lang.String backupDir)
                                         throws java.sql.SQLException
Backup the database to a backup directory. This procedure will throw error, if there are any uncommitted unlogged operation before stating the backup. It will not wait for the unlogged operations to complete. Examples of unlogged operations include: create index and bulk insert. Note that once the backup begins these operations will not block, instead they are automatically converted into logged operations.

Parameters:
backupDir - the name of the directory where the backup should be stored. This directory will be created if it does not exist.
Throws:
StandardException - thrown on error
java.sql.SQLException

SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE

public static void SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(java.lang.String backupDir,
                                                                     short deleteOnlineArchivedLogFiles)
                                                              throws java.sql.SQLException
Backup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version of the backup. This procedure will throw error if there are any unlogged operation executed in the same transaction backup is started. If there any unlogged operations in progess in other transaction, it will wait until those transactions are completed before starting the backup. Examples of unlogged operations include: create index and bulk insert. Note that once the backup begins these operations will not block, instead they are automatically converted into logged operations.

Parameters:
backupDir - the name of the directory where the backup should be stored. This directory will be created if not it does not exist.
deleteOnlineArchivedLogFiles - If non-zero deletes online archived log files that exist before this backup, delete will occur only after the backup is complete.
Throws:
StandardException - thrown on error.
java.sql.SQLException

SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT

public static void SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT(java.lang.String backupDir,
                                                                            short deleteOnlineArchivedLogFiles)
                                                                     throws java.sql.SQLException
Backup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version backup. This procedure will throw error, if there are any uncommitted unlogged operation before stating the backup. It will not wait for the unlogged operations to complete. Examples of unlogged operations include: create index and bulk insert. Note that once the backup begins these operations will not block, instead they are automatically converted into logged operations.

Parameters:
backupDir - the name of the directory where the backup should be stored. This directory will be created if not it does not exist.
deleteOnlineArchivedLogFiles - If non-zero deletes online archived log files that exist before this backup, delete will occur only after the backup is complete.
Throws:
StandardException - thrown on error.
java.sql.SQLException

SYSCS_DISABLE_LOG_ARCHIVE_MODE

public static void SYSCS_DISABLE_LOG_ARCHIVE_MODE(short deleteOnlineArchivedLogFiles)
                                           throws java.sql.SQLException
Disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.

Parameters:
deleteOnlineArchivedLogFiles - If non-zero deletes all the online archived log files that exist before this call immediately.
Throws:
StandardException - Thrown on error
java.sql.SQLException

SYSCS_SET_RUNTIMESTATISTICS

public static void SYSCS_SET_RUNTIMESTATISTICS(short enable)
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

SYSCS_SET_STATISTICS_TIMING

public static void SYSCS_SET_STATISTICS_TIMING(short enable)
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

SYSCS_CHECK_TABLE

public static int SYSCS_CHECK_TABLE(java.lang.String schema,
                                    java.lang.String tablename)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

SYSCS_INPLACE_COMPRESS_TABLE

public static void SYSCS_INPLACE_COMPRESS_TABLE(java.lang.String schema,
                                                java.lang.String tablename,
                                                short purgeRows,
                                                short defragmentRows,
                                                short truncateEnd)
                                         throws java.sql.SQLException
Implementation of SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE().

Code which implements the following system procedure: void SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE( IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN PURGE_ROWS SMALLINT, IN DEFRAGMENT_ROWS SMALLINT, IN TRUNCATE_END SMALLINT)

Use the SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE system procedure to reclaim unused, allocated space in a table and its indexes. Typically, unused allocated space exists when a large amount of data is deleted from a table, and there have not been subsequent inserts to use the space freed by the deletes. By default, Derby does not return unused space to the operating system. For example, once a page has been allocated to a table or index, it is not automatically returned to the operating system until the table or index is destroyed. SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE allows you to return unused space to the operating system.

This system procedure can be used to force 3 levels of in place compression of a SQL table: PURGE_ROWS, DEFRAGMENT_ROWS, TRUNCATE_END. Unlike SYSCS_UTIL.SYSCS_COMPRESS_TABLE() all work is done in place in the existing table/index.

Syntax: SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE( IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN PURGE_ROWS SMALLINT, IN DEFRAGMENT_ROWS SMALLINT, IN TRUNCATE_END SMALLINT)

SCHEMANAME: An input argument of type VARCHAR(128) that specifies the schema of the table. Passing a null will result in an error.

TABLENAME: An input argument of type VARCHAR(128) that specifies the table name of the table. The string must exactly match the case of the table name, and the argument of "Fred" will be passed to SQL as the delimited identifier 'Fred'. Passing a null will result in an error.

PURGE_ROWS: If PURGE_ROWS is set to non-zero then a single pass is made through the table which will purge committed deleted rows from the table. This space is then available for future inserted rows, but remains allocated to the table. As this option scans every page of the table, it's performance is linearly related to the size of the table.

DEFRAGMENT_ROWS: If DEFRAGMENT_ROWS is set to non-zero then a single defragment pass is made which will move existing rows from the end of the table towards the front of the table. The goal of the defragment run is to empty a set of pages at the end of the table which can then be returned to the OS by the TRUNCATE_END option. It is recommended to only run DEFRAGMENT_ROWS, if also specifying the TRUNCATE_END option. This option scans the whole table and needs to update index entries for every base table row move, and thus execution time is linearly related to the size of the table.

TRUNCATE_END: If TRUNCATE_END is set to non-zero then all contiguous pages at the end of the table will be returned to the OS. Running the PURGE_ROWS and/or DEFRAGMENT_ROWS passes options may increase the number of pages affected. This option itself does no scans of the table, so performs on the order of a few system calls.

SQL example: To compress a table called CUSTOMER in a schema called US, using all available compress options: call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('US', 'CUSTOMER', 1, 1, 1); To quickly just return the empty free space at the end of the same table, this option will run much quicker than running all phases but will likely return much less space: call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('US', 'CUSTOMER', 0, 0, 1); Java example: To compress a table called CUSTOMER in a schema called US, using all available compress options: CallableStatement cs = conn.prepareCall ("CALL SYSCS_UTIL.SYSCS_COMPRESS_TABLE(?, ?, ?, ?, ?)"); cs.setString(1, "US"); cs.setString(2, "CUSTOMER"); cs.setShort(3, (short) 1); cs.setShort(4, (short) 1); cs.setShort(5, (short) 1); cs.execute(); To quickly just return the empty free space at the end of the same table, this option will run much quicker than running all phases but will likely return much less space: CallableStatement cs = conn.prepareCall ("CALL SYSCS_UTIL.SYSCS_COMPRESS_TABLE(?, ?, ?, ?, ?)"); cs.setString(1, "US"); cs.setString(2, "CUSTOMER"); cs.setShort(3, (short) 0); cs.setShort(4, (short) 0); cs.setShort(5, (short) 1); cs.execute();

It is recommended that the SYSCS_UTIL.SYSCS_COMPRESS_TABLE procedure is issued in auto-commit mode. Note: This procedure acquires an exclusive table lock on the table being compressed. All statement plans dependent on the table or its indexes are invalidated. For information on identifying unused space, see the Derby Server and Administration Guide. TODO LIST: o defragment requires table level lock in nested user transaction, which will conflict with user lock on same table in user transaction.

Throws:
java.sql.SQLException

SYSCS_GET_RUNTIMESTATISTICS

public static java.lang.String SYSCS_GET_RUNTIMESTATISTICS()
                                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

INSTALL_JAR

public static void INSTALL_JAR(java.lang.String url,
                               java.lang.String jar,
                               int deploy)
                        throws java.sql.SQLException
Install a jar file in the database. SQLJ.INSTALL_JAR

Parameters:
url - URL of the jar file to be installed in the database.
jar - SQL name jar will be installed as.
deploy - Ignored.
Throws:
java.sql.SQLException - Error installing jar file.

REPLACE_JAR

public static void REPLACE_JAR(java.lang.String url,
                               java.lang.String jar)
                        throws java.sql.SQLException
Replace a jar file in the database. SQLJ.REPLACE_JAR

Parameters:
url - URL of the jar file to be installed in the database.
jar - SQL name of jar to be replaced.
Throws:
java.sql.SQLException - Error replacing jar file.

REMOVE_JAR

public static void REMOVE_JAR(java.lang.String jar,
                              int undeploy)
                       throws java.sql.SQLException
Remove a jar file from the database.

Parameters:
jar - SQL name of jar to be replaced.
undeploy - Ignored.
Throws:
java.sql.SQLException - Error removing jar file.

checkJarSQLName

private static void checkJarSQLName(java.lang.String sqlName)
                             throws StandardException
Throws:
StandardException

SYSCS_EXPORT_TABLE

public static void SYSCS_EXPORT_TABLE(java.lang.String schemaName,
                                      java.lang.String tableName,
                                      java.lang.String fileName,
                                      java.lang.String columnDelimiter,
                                      java.lang.String characterDelimiter,
                                      java.lang.String codeset)
                               throws java.sql.SQLException
Export data from a table to given file.

Will be called by system procedure: SYSCS_EXPORT_TABLE(IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN FILENAME VARCHAR(32672) , IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1) , IN CODESET VARCHAR(128))

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE

public static void SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(java.lang.String schemaName,
                                                      java.lang.String tableName,
                                                      java.lang.String fileName,
                                                      java.lang.String columnDelimiter,
                                                      java.lang.String characterDelimiter,
                                                      java.lang.String codeset,
                                                      java.lang.String lobsFileName)
                                               throws java.sql.SQLException
Export data from a table to given files. Large objects are exported to an external file and the reference to it is written in the main export file.

Will be called by system procedure: SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN FILENAME VARCHAR(32672) , IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1) , IN CODESET VARCHAR(128), IN LOBSFILENAME VARCHAR(32672))

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_EXPORT_QUERY

public static void SYSCS_EXPORT_QUERY(java.lang.String selectStatement,
                                      java.lang.String fileName,
                                      java.lang.String columnDelimiter,
                                      java.lang.String characterDelimiter,
                                      java.lang.String codeset)
                               throws java.sql.SQLException
Export data from a select statement to given file.

Will be called as SYSCS_EXPORT_QUERY(IN SELECTSTATEMENT VARCHAR(32672), IN FILENAME VARCHAR(32672) , IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1) , IN CODESET VARCHAR(128))

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE

public static void SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(java.lang.String selectStatement,
                                                      java.lang.String fileName,
                                                      java.lang.String columnDelimiter,
                                                      java.lang.String characterDelimiter,
                                                      java.lang.String codeset,
                                                      java.lang.String lobsFileName)
                                               throws java.sql.SQLException
Export data from a select statement to given file. Large objects are exported to an external file and the reference to it is written in the main export file.

Will be called as SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(IN SELECTSTATEMENT VARCHAR(32672), IN FILENAME VARCHAR(32672) , IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1) , IN CODESET VARCHAR(128), IN LOBSFILENAME VARCHAR(32672))

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_IMPORT_TABLE

public static void SYSCS_IMPORT_TABLE(java.lang.String schemaName,
                                      java.lang.String tableName,
                                      java.lang.String fileName,
                                      java.lang.String columnDelimiter,
                                      java.lang.String characterDelimiter,
                                      java.lang.String codeset,
                                      short replace)
                               throws java.sql.SQLException
Import data from a given file to a table.

Will be called by system procedure as SYSCS_IMPORT_TABLE(IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN FILENAME VARCHAR(32672) , IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1) , IN CODESET VARCHAR(128), IN REPLACE SMALLINT)

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE

public static void SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(java.lang.String schemaName,
                                                        java.lang.String tableName,
                                                        java.lang.String fileName,
                                                        java.lang.String columnDelimiter,
                                                        java.lang.String characterDelimiter,
                                                        java.lang.String codeset,
                                                        short replace)
                                                 throws java.sql.SQLException
Import data from a given file to a table. Data for large object columns is in an external file, the reference to it is in the main input file. Read the lob data from the external file using the lob location info in the main import file.

Will be called by system procedure as SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN FILENAME VARCHAR(32672) , IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1) , IN CODESET VARCHAR(128), IN REPLACE SMALLINT)

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_IMPORT_DATA

public static void SYSCS_IMPORT_DATA(java.lang.String schemaName,
                                     java.lang.String tableName,
                                     java.lang.String insertColumnList,
                                     java.lang.String columnIndexes,
                                     java.lang.String fileName,
                                     java.lang.String columnDelimiter,
                                     java.lang.String characterDelimiter,
                                     java.lang.String codeset,
                                     short replace)
                              throws java.sql.SQLException
Import data from a given file into the specified table columns from the specified columns in the file.

Will be called as SYSCS_IMPORT_DATA (IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN INSERTCOLUMNLIST VARCHAR(32762), IN COLUMNINDEXES VARCHAR(32762), IN FILENAME VARCHAR(32762), IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1), IN CODESET VARCHAR(128), IN REPLACE SMALLINT)

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE

public static void SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE(java.lang.String schemaName,
                                                       java.lang.String tableName,
                                                       java.lang.String insertColumnList,
                                                       java.lang.String columnIndexes,
                                                       java.lang.String fileName,
                                                       java.lang.String columnDelimiter,
                                                       java.lang.String characterDelimiter,
                                                       java.lang.String codeset,
                                                       short replace)
                                                throws java.sql.SQLException
Import data from a given file into the specified table columns from the specified columns in the file. Data for large object columns is in an external file, the reference to it is in the main input file. Read the lob data from the external file using the lob location info in the main import file.

Will be called as SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE(IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN INSERTCOLUMNLIST VARCHAR(32762), IN COLUMNINDEXES VARCHAR(32762), IN FILENAME VARCHAR(32762), IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1), IN CODESET VARCHAR(128), IN REPLACE SMALLINT)

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_BULK_INSERT

public static void SYSCS_BULK_INSERT(java.lang.String schemaName,
                                     java.lang.String tableName,
                                     java.lang.String vtiName,
                                     java.lang.String vtiArg)
                              throws java.sql.SQLException
Perform bulk insert using the specificed vti .

Will be called as SYSCS_BULK_INSERT (IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN VTINAME VARCHAR(32762), IN VTIARG VARCHAR(32762))

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

SYSCS_RELOAD_SECURITY_POLICY

public static void SYSCS_RELOAD_SECURITY_POLICY()
                                         throws java.sql.SQLException
Reload the policy file.

System procedure called thusly: SYSCS_UTIL.SYSCS_RELOAD_SECURITY_POLICY()

Throws:
java.sql.SQLException

PI

public static double PI()
Method to return the constant PI. SYSFUN.PI().

Returns:
PI

LOG10

public static double LOG10(double value)
Base 10 log function. SYSFUN.LOG10 Calculated by log(value) / log(10) where log is the natural log.


COT

public static double COT(double value)
Cotangent function. SYSFUN.COT

Returns:
1 / tan(x)
See Also:
HyperbolicFunctions

COSH

public static double COSH(double value)
Hyperbolic Cosine function. SYSFUN.COSH

Returns:
1/2 (e^x + e^-x)
See Also:
HyperbolicFunctions

SINH

public static double SINH(double value)
Hyperbolic Sine function. SYSFUN.SINH

Returns:
1/2 (e^x - e^-x)
See Also:
HyperbolicFunctions

TANH

public static double TANH(double value)
Hyperbolic Tangent function. SYSFUN.TANH

Returns:
(e^x - e^-x) / (e^x + e^-x)
See Also:
HyperbolicFunctions

SIGN

public static int SIGN(double value)
Method to return the sign of the given value. SYSFUN.SIGN().

Returns:
0, 1 or -1

RAND

public static double RAND(int seed)
Pseudo-random number function.

Returns:
a random number

SYSCS_SET_USER_ACCESS

public static void SYSCS_SET_USER_ACCESS(java.lang.String userName,
                                         java.lang.String connectionPermission)
                                  throws java.sql.SQLException
Set the connection level authorization for a specific user - SYSCS_UTIL.SYSCS_SET_USER_ACCESS.

Parameters:
userName - name of the user in its normal form (not a SQL identifier).
connectionPermission -
Throws:
java.sql.SQLException - Error setting the permission

removeFromAccessList

private static void removeFromAccessList(java.lang.String listProperty,
                                         java.lang.String userName)
                                  throws java.sql.SQLException,
                                         StandardException
Utility method for SYSCS_SET_USER_ACCESS removes a user from one of the access lists, driven by the property name.

Throws:
java.sql.SQLException
StandardException

SYSCS_GET_USER_ACCESS

public static java.lang.String SYSCS_GET_USER_ACCESS(java.lang.String userName)
                                              throws java.sql.SQLException
Get the connection level authorization for a specific user - SYSCS_UTIL.SYSCS_GET_USER_ACCESS.

Parameters:
userName - name of the user in its normal form (not a SQL identifier).
Throws:
java.sql.SQLException

SYSCS_EMPTY_STATEMENT_CACHE

public static void SYSCS_EMPTY_STATEMENT_CACHE()
                                        throws java.sql.SQLException
Empty as much of the cache as possible. It is not guaranteed that the cache is empty after this call, as statements may be kept by currently executing queries, activations that are about to be garbage collected.

Throws:
java.sql.SQLException

SYSCS_SET_XPLAIN_MODE

public static void SYSCS_SET_XPLAIN_MODE(int mode)
                                  throws java.sql.SQLException,
                                         StandardException
this procedure switches between the different xplain modes

Parameters:
mode - either 0 for explain only, or 1 for explain & execute (default)
Throws:
java.sql.SQLException
StandardException

SYSCS_GET_XPLAIN_MODE

public static int SYSCS_GET_XPLAIN_MODE()
                                 throws java.sql.SQLException,
                                        StandardException
This procedure returns the current status of the xplain mode. If the XPLAIN mode is non-zero, meaning that it is ON, then statements are being XPLAIN'd only, not executed.

Returns:
0 if XPLAIN mode is off, non-zero if on.
Throws:
java.sql.SQLException
StandardException

SYSCS_SET_XPLAIN_SCHEMA

public static void SYSCS_SET_XPLAIN_SCHEMA(java.lang.String schemaName)
                                    throws java.sql.SQLException,
                                           StandardException
This procedure sets the current xplain schema. If the schema is not set, runtime statistics are captured as a textual stream printout. If it is set, statisitcs information is stored in that schema in user tables.

Parameters:
schemaName - May be an empty string.
Throws:
java.sql.SQLException
StandardException

hasSchema

private static boolean hasSchema(java.sql.Connection conn,
                                 java.lang.String schemaName)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

hasTable

private static boolean hasTable(java.sql.Connection conn,
                                java.lang.String schemaName,
                                java.lang.String tableName)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

createXplainSchema

private static void createXplainSchema(java.lang.String schemaName)
                                throws java.sql.SQLException
Throws:
java.sql.SQLException

createXplainTable

private static void createXplainTable(LanguageConnectionContext lcc,
                                      java.lang.String schemaName,
                                      XPLAINTableDescriptor t)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

SYSCS_GET_XPLAIN_SCHEMA

public static java.lang.String SYSCS_GET_XPLAIN_SCHEMA()
                                                throws java.sql.SQLException,
                                                       StandardException
This procedure returns the current set XPLAIN_SCHEMA

Returns:
schema name, may be blank if no schema currently set.
Throws:
java.sql.SQLException
StandardException

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.