{
/*
** SYSCS_UTIL routines.
*/
UUID routine_uuid = null;
// used to put procedure into the SYSCS_UTIL schema
UUID sysUtilUUID = getSystemUtilSchemaDescriptor().getUUID();
// void SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(
// varchar(128), varchar(Limits.DB2_VARCHAR_MAXWIDTH))
{
// procedure argument names
String[] arg_names = {
"KEY",
"VALUE"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, 128),
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, Limits.DB2_VARCHAR_MAXWIDTH)
};
createSystemProcedureOrFunction(
"SYSCS_SET_DATABASE_PROPERTY",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.MODIFIES_SQL_DATA,
(TypeDescriptor) null,
tc);
}
// void SYSCS_UTIL.SYSCS_COMPRESS_TABLE(varchar(128), varchar(128), SMALLINT)
{
// procedure argument names
String[] arg_names = {"SCHEMANAME", "TABLENAME", "SEQUENTIAL"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, 128),
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, 128),
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.SMALLINT)
};
routine_uuid = createSystemProcedureOrFunction(
"SYSCS_COMPRESS_TABLE",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.MODIFIES_SQL_DATA,
(TypeDescriptor) null,
tc);
createRoutinePermPublicDescriptor(routine_uuid, tc);
}
// void SYSCS_UTIL.SYSCS_CHECKPOINT_DATABASE()
{
createSystemProcedureOrFunction(
"SYSCS_CHECKPOINT_DATABASE",
sysUtilUUID,
null,
null,
0,
0,
RoutineAliasInfo.CONTAINS_SQL,
(TypeDescriptor) null,
tc);
}
// void SYSCS_UTIL.SYSCS_FREEZE_DATABASE()
{
createSystemProcedureOrFunction(
"SYSCS_FREEZE_DATABASE",
sysUtilUUID,
null,
null,
0,
0,
RoutineAliasInfo.CONTAINS_SQL,
(TypeDescriptor) null,
tc);
}
// void SYSCS_UTIL.SYSCS_UNFREEZE_DATABASE()
{
createSystemProcedureOrFunction(
"SYSCS_UNFREEZE_DATABASE",
sysUtilUUID,
null,
null,
0,
0,
RoutineAliasInfo.CONTAINS_SQL,
(TypeDescriptor) null,
tc);
}
// void SYSCS_UTIL.SYSCS_BACKUP_DATABASE(varchar Limits.DB2_VARCHAR_MAXWIDTH)
{
// procedure argument names
String[] arg_names = {"BACKUPDIR"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, Limits.DB2_VARCHAR_MAXWIDTH)
};
createSystemProcedureOrFunction(
"SYSCS_BACKUP_DATABASE",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.MODIFIES_SQL_DATA,
(TypeDescriptor) null,
tc);
}
// void SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
// varchar Limits.DB2_VARCHAR_MAXWIDTH, smallint)
{
// procedure argument names
String[] arg_names = {"BACKUPDIR", "DELETE_ARCHIVED_LOG_FILES"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, Limits.DB2_VARCHAR_MAXWIDTH),
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.SMALLINT)
};
createSystemProcedureOrFunction(
"SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.MODIFIES_SQL_DATA,
(TypeDescriptor) null,
tc);
}
// void SYSCS_UTIL.SYSCS_DISABLE_LOG_ARCHIVE_MODE(smallint)
{
// procedure argument names
String[] arg_names = {"DELETE_ARCHIVED_LOG_FILES"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.SMALLINT)
};
createSystemProcedureOrFunction(
"SYSCS_DISABLE_LOG_ARCHIVE_MODE",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.MODIFIES_SQL_DATA,
(TypeDescriptor) null,
tc);
}
// void SYSCS_UTIL.SYSCS_SET_RUNTIMESTTISTICS(smallint)
{
// procedure argument names
String[] arg_names = {"ENABLE"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.SMALLINT)
};
routine_uuid = createSystemProcedureOrFunction(
"SYSCS_SET_RUNTIMESTATISTICS",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.CONTAINS_SQL,
(TypeDescriptor) null,
tc);
createRoutinePermPublicDescriptor(routine_uuid, tc);
}
// void SYSCS_UTIL.SYSCS_SET_STATISTICS_TIMING(smallint)
{
// procedure argument names
String[] arg_names = {"ENABLE"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.SMALLINT)
};
routine_uuid = createSystemProcedureOrFunction(
"SYSCS_SET_STATISTICS_TIMING",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.CONTAINS_SQL,
(TypeDescriptor) null,
tc);
createRoutinePermPublicDescriptor(routine_uuid, tc);
}
// SYSCS_UTIL functions
//
// TODO (mikem) -
// the following need to be functions when that is supported.
// until then calling them will not work.
// VARCHAR(Limits.DB2_VARCHAR_MAXWIDTH)
// SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY(varchar(128))
{
// procedure argument names
String[] arg_names = {"KEY"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, 128)
};
createSystemProcedureOrFunction(
"SYSCS_GET_DATABASE_PROPERTY",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.READS_SQL_DATA,
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, Limits.DB2_VARCHAR_MAXWIDTH),
tc);
}
// SMALLINT SYSCS_UTIL.SYSCS_CHECK_TABLE(varchar(128), varchar(128))
{
// procedure argument names
String[] arg_names = {"SCHEMANAME", "TABLENAME"};
// procedure argument types
TypeDescriptor[] arg_types = {
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, 128),
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, 128)
};
createSystemProcedureOrFunction(
"SYSCS_CHECK_TABLE",
sysUtilUUID,
arg_names,
arg_types,
0,
0,
RoutineAliasInfo.READS_SQL_DATA,
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.INTEGER),
tc);
}
// CLOB SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()
{
routine_uuid = createSystemProcedureOrFunction(
"SYSCS_GET_RUNTIMESTATISTICS",
sysUtilUUID,
null,
null,
0,
0,
RoutineAliasInfo.CONTAINS_SQL,
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.VARCHAR, Limits.DB2_VARCHAR_MAXWIDTH),
/*
TODO - mikem, wants to be a CLOB, but don't know how to do
that yet. Testing it with varchar for now.
DataTypeDescriptor.getBuiltInDataTypeDescriptor(
Types.CLOB, Limits.DB2_LOB_MAXWIDTH),
*/
tc);
createRoutinePermPublicDescriptor(routine_uuid, tc);
}
/*
** SQLJ routine.
*/
UUID sqlJUUID =
getSchemaDescriptor(
SchemaDescriptor.STD_SQLJ_SCHEMA_NAME, tc, true).getUUID();
// SQLJ.INSTALL_JAR(URL VARCHAR(??), JAR VARCHAR(128), DEPLOY INT)
{