public class Util extends java.lang.Object implements UpgConstants
Click here for an overview of the most commonly-used data structures.
Modifier and Type | Field and Description |
---|---|
java.lang.String[] |
attrAttrs
The attribute names on maxattribute (except objectname, attributename, and changed).
|
java.lang.String[] |
attrCfgNPAttrs
The non-persistent attribute names on maxattributecfg.
|
java.lang.String[] |
attrTransAttrs
The translatable attribute names on maxattribute ("mlinuse" = 1).
|
int |
dbIn
The database platform we are connected to.
|
int |
dbOut
The database platform we are writing output for.
|
int |
MAX_NAME_LENGTH
Maximum object name length
|
java.lang.String[] |
objectAttrs
The attribute names on maxobject (except objectname and changed).
|
java.lang.String[] |
objectCfgNPAttrs
The non-persistent attribute names on maxobjectcfg.
|
java.lang.String[] |
objTransAttrs
The translatable attribute names on maxobject ("mlinuse" = 1).
|
boolean |
post602
After release 6.0.2, some of the metadata attributes where changed from alphanumeric to YORN:
maxtable/maxtablecfg (restoredata), maxsysindexes (uniquerule),
maxsyskeys (ordering removed, replaced by ascending).
|
static int |
ssDELETEAUTH
SqlServer constant for Delete privilege (196).
|
static int |
ssGRANTED
SqlServer constant indicating that a privilege has been granted (205).
|
static int |
ssINSERTAUTH
SqlServer constant for Insert privilege (195).
|
static int |
ssSELECTAUTH
SqlServer constant for Select privilege (193).
|
static int |
ssUPDATEAUTH
SqlServer constant for Update privilege (197).
|
java.lang.String[] |
viewAttrs
The attribute names on maxview (including viewname).
|
java.lang.String[] |
viewColAttrs
The attribute names on maxviewcolumn (except viewname, viewcolumnname, and changed).
|
DB2, doNotUpdateACTION, doNotUpdateALNDOMAIN, doNotUpdateAPPLICATIONAUTH, doNotUpdateAUTOKEY, doNotUpdateCONDITION, doNotUpdateCONTRACTPROPERTY, doNotUpdateCONTRACTTYPE, doNotUpdateCROSSOVERDOMAIN, doNotUpdateDOCTYPES, doNotUpdateLANGUAGE, doNotUpdateMAXAPPS, doNotUpdateMAXCONDDETAIL, doNotUpdateMAXCONTROLVALUE, doNotUpdateMAXDOMAIN, doNotUpdateMAXLOGAPPENDER, doNotUpdateMAXLOGGER, doNotUpdateMAXMENU, doNotUpdateMAXMESSAGES, doNotUpdateMAXMODULES, doNotUpdateMAXPROP, doNotUpdateMAXPROPVALUE, doNotUpdateMAXROLE, doNotUpdateMAXSEQUENCE, doNotUpdateMAXSERSECURITY, doNotUpdateMAXSERVICE, doNotUpdateMAXTABLEDOMAIN, doNotUpdateMAXVARS, doNotUpdateMAXVARTYPE, doNotUpdateMXCOLLAB, doNotUpdateMXCOLLABREF, doNotUpdateNUMERICDOMAIN, doNotUpdateNUMRANGEDOMAIN, doNotUpdatePORTLET, doNotUpdatePRICALC, doNotUpdateSECURITYRESTRICT, doNotUpdateSIGOPTION, doNotUpdateSYNONYMDOMAIN, doNotUpdateTAXTYPE, doNotUpdateWORKPRIORITY, doNotUpdateWORKTYPE, doNotUpdateWPEDITSETTING, messageCache, NEWONLY, OLDANDNEW, OLDONLY, ORACLE, SQLINET, SQLMICROSOFT, SQLSERVER, SYSDATATABLES, SYSTEMTABLES, UNKNOWN
Constructor and Description |
---|
Util(java.sql.Connection conparam,
java.io.PrintStream outparam,
java.lang.String schemaOwnerparam)
Calls
Util with last param True. |
Util(java.sql.Connection conparam,
java.io.PrintStream outparam,
java.lang.String schemaOwnerparam,
boolean reloadAttrs)
This constructor does the following.
|
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<java.lang.String> |
activateRichTextSearch(java.util.ArrayList<java.lang.String> list,
java.lang.String tbname,
boolean doCheck)
Activate text search for a specified table.
|
java.util.ArrayList<java.lang.String> |
addIndex(java.lang.String tbname,
java.lang.String[] names,
java.lang.String startWith,
boolean addUnique,
java.lang.String storagepartition)
Generates sql for creating a new index with the specified column names.
|
java.util.List<java.lang.String> |
addTenantid(java.lang.String tablename,
java.lang.String uniqueColumnName,
MTStorageType storageType)
Add tenantid column to table if MT Enabled.
|
java.util.ArrayList<java.lang.String> |
addTenantIDIndex(java.lang.String tbname,
java.lang.String storagepartition,
MTStorageType storageType)
Generates sql for creating a multi-tenancy index with tenantid column name.
|
java.util.ArrayList<java.lang.String> |
addTenantidToTable(java.lang.String tabName,
MTStorageType storageType)
Adds tenantid to table based on storagtype
|
java.lang.String |
adjustNativeSql(java.lang.String origSql)
Called from Maxinst and UpdateDB, when intercepting a native Sql
statement (create table or alter table).
|
java.util.ArrayList<java.lang.String> |
adjustPrimaryKeyColSeq(java.util.TreeMap indexMeta)
Adjust the value of primarykeycolseq in the column metadata (maxattribute and maxattributecfg)
to reflect the actual columns used in the primary unique index.
|
java.util.ArrayList<java.lang.String> |
adjustViewMeta(java.lang.String viewname)
Adjust view metadata by removing obsolete persistent attributes and
adding new persistent attributes.
|
java.util.ArrayList<java.lang.String> |
adjustViewMeta(java.lang.String viewname,
boolean addP,
boolean addNP)
Adjust view metadata by removing obsolete persistent attributes and
adding new persistent and/or non-persistent attributes.
|
java.util.ArrayList<java.lang.String> |
attrRefresh(int tenantid,
boolean mtEnabled)
Refresh all the attribute metadata for all objects.
|
java.lang.String |
buildChangeCaseStatement(java.lang.String tbname,
java.lang.String name,
java.lang.String oldMaxtype,
java.lang.String newMaxtype)
If changing maxtype to LOWER or UPPER from another alphanumeric type, output the Sql
statement to convert the data.
|
java.util.ArrayList<java.lang.String> |
buildChangeCaseStatement(java.lang.String tbname,
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> oldCols,
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> newCols)
Loop through the columns for this table to see if any need case change to lower or upper.
|
java.lang.String |
buildColumnLine(java.util.HashMap colInfo,
boolean doDefault,
boolean alter)
Build a line defining a particular column.
|
java.lang.String |
buildColumnLine(java.util.HashMap colInfo,
boolean doDefault,
boolean doNullClause,
boolean alter)
Build a line defining a particular column.
|
java.lang.String |
buildCreateTableStatement(java.util.HashMap tableInfo,
boolean doColDefault,
boolean includeDroppedCols,
java.lang.String dbstoragepartition,
boolean specifyStorage)
Build "create table" statement.
|
java.lang.String |
buildCreateTableStatement(java.lang.String tbname,
java.util.TreeMap tableCols,
boolean doColDefault,
boolean includeDroppedCols,
java.lang.String dbstoragepartition,
boolean addRowstamp,
java.lang.String storageClause)
Build "create table" statement.
|
java.util.ArrayList<java.lang.String> |
buildCreateViewStatement(java.util.HashMap viewInfo,
boolean includeDroppedCols,
boolean forceDropStmt)
Build "create view" statement.
|
java.lang.String |
buildDefaultDataStatement(java.lang.String tbname,
java.util.HashMap newColInfo,
java.util.HashMap oldColInfo)
Output statement "update table set column = value where column is null".
|
java.util.ArrayList<java.lang.String> |
buildDefaultDataStatement(java.lang.String tbname,
java.util.TreeMap newTableCols,
java.lang.String colNameList,
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> oldTableCols)
Output an array of update statements in the format
"update table set column = value where column is null".
|
java.util.ArrayList<java.lang.String> |
buildGrants(java.lang.String tbname,
boolean outputSchema,
boolean maxusersOnly)
Create an array where each element is a "grant" statement.
|
java.lang.String |
buildIndexStatement(java.util.HashMap ixInfo,
boolean specifySchema,
boolean specifyStorage)
Construct a "create index" statement using index metadata.
|
java.lang.String |
buildIndexStatement(java.lang.String tbname,
java.util.TreeMap tableCols,
java.lang.String dbstoragepartition)
Uses primarykeycolseq in metadata to build a "create unique index" statement.
|
java.lang.String |
buildInsertStatementPrefix(java.lang.String tbname,
java.util.TreeMap tableCols,
boolean doRowstamp,
boolean includeDroppedCols)
Builds the beginning of an insert statement in the format
"insert into tbname (col1, col2, col3, ...)", with line breaks.
|
java.lang.String |
buildInsertStatementPrefix(java.lang.String tbname,
java.util.TreeMap tableCols,
boolean doRowstamp,
boolean includeDroppedCols,
java.lang.String colNameList,
boolean doLineBreaks) |
java.lang.String |
buildInsertStatementPrefix(java.lang.String tbname,
java.util.TreeMap tableCols,
boolean doRowstamp,
boolean includeDroppedCols,
java.lang.String colNameList,
boolean doLineBreaks,
boolean addTenantid)
Builds the beginning of an insert statement in the format
"insert into tbname (col1, col2, col3, ...)".
|
java.util.TreeMap |
buildInsertValuesStatement(java.lang.String prefix,
java.sql.ResultSet rs,
java.util.TreeMap tableCols,
boolean includeDroppedCols,
java.lang.String rowstampValue) |
java.util.TreeMap<java.lang.Integer,java.lang.String> |
buildInsertValuesStatement(java.lang.String prefix,
java.sql.ResultSet rs,
java.util.TreeMap tableCols,
boolean includeDroppedCols,
java.lang.String rowstampValue,
boolean psFormat)
Build one complete insert statement in the format
"insert into tbname (col1, col2, col3, ...) values (val1, val2, val3,...)".
|
java.util.TreeMap<java.lang.Integer,java.lang.String> |
buildInsertValuesStatement(java.lang.String prefix,
java.sql.ResultSet rs,
java.util.TreeMap tableCols,
boolean includeDroppedCols,
java.lang.String rowstampValue,
boolean psFormat,
java.util.Map<java.lang.String,java.lang.String> allSeq) |
java.util.TreeMap<java.lang.Integer,java.lang.String> |
buildInsertValuesStatement(java.lang.String prefix,
java.sql.ResultSet rs,
java.util.TreeMap tableCols,
boolean includeDroppedCols,
java.lang.String rowstampValue,
boolean psFormat,
java.util.Map<java.lang.String,java.lang.String> allSeq,
int tenantid)
Build one complete insert statement in the format
"insert into tbname (col1, col2, col3, ...) values (val1, val2, val3,...)".
|
java.lang.String |
buildSelectStatement(java.lang.String tbname,
java.util.TreeMap tableCols,
boolean includeDroppedCols,
boolean addRowstamp)
Builds a select statement in the format "select col1, col2, col3, ...
|
java.lang.String |
buildSelectStatement(java.lang.String tbname,
java.util.TreeMap tableCols,
boolean includeDroppedCols,
boolean addRowstamp,
boolean addTenantID)
Builds a select statement in the format "select col1, col2, col3, ...
|
java.lang.String |
buildSelectStatement(java.lang.String tbname,
java.util.TreeMap tableCols,
boolean includeDroppedCols,
boolean addRowstamp,
boolean addtenantID,
java.lang.String colNameList)
Builds a select statement in the format "select col1, col2, col3, ...
|
java.lang.String |
buildSelectStatementForRestore(java.lang.String tempTbName,
java.util.TreeMap newTableCols,
boolean addRowstamp,
java.lang.String colNameList,
boolean doLineBreaks)
Builds a select statement in the format "select col1, col2, col3, ...
|
java.util.ArrayList<java.lang.String> |
buildSequences(java.util.HashSet sequences,
boolean doMaxseq)
Returns sql statements for dropping and recreating all the sequences for Oracle and DB2.
|
java.util.ArrayList<java.lang.String> |
buildSequences(java.util.HashSet sequences,
java.util.Map<java.lang.String,java.lang.Long> alreadyDone,
boolean doMaxseq)
Returns sql statements for dropping and recreating all the sequences for Oracle and DB2.
|
java.util.ArrayList<java.lang.String> |
buildShortenStringStatement(java.lang.String tbname,
java.util.TreeMap newTableCols,
java.util.TreeMap oldTableCols)
Output an array of update statements in the (pseudocode) format
"update table set column = substring(column) where length of column > target length".
|
int |
bytesSpaceNeeded(java.lang.String spaceName)
Deprecated.
Replaced by
spaceNeeded . |
boolean |
canAlterForLengthChange(java.lang.String tablename,
java.lang.String columnname,
int oldLength,
int newLength)
Called from
canAlterTable to determine whether table can be altered for
a column length change. |
boolean |
canAlterTable(java.lang.String tablename,
java.util.HashMap newAttr,
java.util.HashMap oldAttr,
java.lang.String upgradeDir)
Given that one attribute is being added, modified or dropped,
and we're not adding or dropping the entire table, this method identifies
whether that change can be done in
ConfigDB
via an "alter table" statement. |
boolean |
canAnalyzeTable()
Identifies whether
getAnalyzeTableStatement
would normally return anything. |
java.util.ArrayList<java.lang.String> |
changeAmountFormat(int newLength,
int newScale)
Change the format for Amount fields.
|
java.util.ArrayList<java.lang.String> |
changeStorageType(java.lang.String tabName,
java.lang.String uniqueName,
MTStorageType oldType,
MTStorageType newType,
java.lang.String userName,
java.lang.String adminUser,
boolean isInternal)
Rebuild triggers as secure, and activae row level control for all tables
|
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> |
changeTreeKey(java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> oldMap,
java.lang.String keyAttr)
Given a TreeMap of metadata, output a new TreeMap that is the
same except for its key.
|
java.util.ArrayList<java.lang.String> |
cleanStatisticNames()
If this is SqlServer and native statistics exist with the same name as an entry
in maxsysindexes, then drop the statistics.
|
void |
clearAlreadyDidUsingMultiSchema()
Sets
alreadyDidUsingMultiSchema
to False so that usingMultiSchema will
recalculate the value next time it is called. |
boolean |
columnIsEmpty(java.lang.String tbname,
java.lang.String name)
Identifies whether all rows for this table have null values for this column.
|
boolean |
configInProcess()
Determine whether configuration is currently in process (ConfigDB and RestoreFromBackup).
|
void |
copyData(java.lang.String tabName,
java.lang.String uniqueColumn,
int toTenantid,
int storageType,
boolean delete,
java.io.PrintStream out)
Copy all template data for a table from template (TENANTID = 0)
to a tenant
|
java.util.List<java.lang.String> |
createExtensionView(java.lang.String objectName,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> extendedTables,
java.sql.Connection masterCon,
int tenantId,
boolean deleteOnly,
boolean mtEnabled)
Calls
createTable
for each extension table to be created. |
java.util.ArrayList<java.lang.String> |
createOneSequenceFromMaxSequence(java.lang.String sequenceName)
Returns sql statement for creating one sequence from values specified in maxsequence table.
|
java.util.List<java.lang.String> |
createPermission(java.lang.String tabName,
java.lang.String uniqueName,
java.lang.String newTenantUser,
java.lang.String landlordUser,
MTStorageType type)
Create permissions for Multitenancy
|
java.util.List<java.lang.String> |
createPermission(java.lang.String tabName,
java.lang.String uniqueName,
java.lang.String newTenantUser,
java.lang.String landlordUser,
MTStorageType type,
boolean addProcessUser)
Create permissions for Multitenancy
|
java.sql.Statement |
createStatement()
Return a Statement created with the appropriate parameters for this platform.
|
java.util.List<java.lang.String> |
createTenantidTriggeres(java.lang.String tbname,
MTStorageType storageType,
boolean secureRowlevelTriggers,
boolean dropInsert,
boolean dropUpdateDelete,
boolean createDeltaTriggers)
For DB2, the trigger names are tbname + "_M", tbname + "_D" and tbname + "_E".
|
java.util.ArrayList<java.lang.String> |
db2textAlterIndexes() |
java.util.ArrayList<java.lang.String> |
db2textAlterIndexes(boolean updateNow)
For DB2, read through the vector of index names populated
by
enableRichTextSearch
and return array of "db2ts alter index" statements specifying Update Frequency. |
java.util.ArrayList<java.lang.String> |
deleteObjectDelta(int tenantId)
Return "delete from maxobjectcfg where exists".
|
boolean |
descendingIndexesSupported()
Identifies whether descending indexes are supported by this database platform.
|
java.util.ArrayList<java.lang.String> |
disableMTPermission(java.lang.String tabName,
MTStorageType storageType)
deactivate row level control for a table
|
java.util.ArrayList<java.lang.String> |
disableRichTextSearch(java.lang.String tbname,
java.lang.String colName,
java.lang.String handleColName)
Return the Sql statements needed to disable rich text searching for a given column.
|
java.util.ArrayList<java.lang.String> |
dropDeltaTriggers()
Rebuild triggers as secure, and activae row level control for all tables
|
boolean |
dupIndexNamesExist(java.lang.String tbname,
java.lang.String ixname)
Determine whether the same index name is used on more than one table on the
native database.
|
java.util.ArrayList<java.lang.String> |
enableForMultiTenancy(java.lang.String tabName,
java.lang.String uniqueName,
java.lang.String userName,
java.lang.String adminUser,
MTStorageType storageType)
Rebuild triggers as secure, and activae row level control for all tables
|
java.util.ArrayList<java.lang.String> |
enableRichTextSearch(java.util.HashMap objInfo,
java.util.TreeMap tbIndexes,
boolean doCheck,
boolean skipDb2Connect)
Enable rich text search for a table and any attributes that are flagged for it.
|
java.util.ArrayList<java.lang.String> |
enableRichTextSearch(java.lang.String tbname,
java.lang.String colName,
java.lang.String handleColName,
java.util.HashMap ixInfo,
boolean skipCreateUniqueIndex)
Call
enableRichTextSearch
with last param (startIxNum) = 1. |
java.util.ArrayList<java.lang.String> |
enableRichTextSearch(java.lang.String tbname,
java.lang.String colName,
java.lang.String handleColName,
java.util.HashMap ixInfo,
boolean skipCreateUniqueIndex,
int startIxNum)
Call other version of this method with skipDb2Connect param false.
|
java.util.ArrayList<java.lang.String> |
enableRichTextSearch(java.lang.String tbname,
java.lang.String colName,
java.lang.String handleColName,
java.util.HashMap ixInfo,
boolean skipCreateUniqueIndex,
int startIxNum,
boolean skipDb2Connect)
Return the Sql statements needed to enable rich text searching for a given table or column.
|
boolean |
explicitConversionSupported(java.lang.String newType,
java.lang.String oldType)
Identifies whether explicit datatype conversion is supported for SqlServer or DB2 datatype change.
|
java.util.ArrayList<java.lang.String> |
fixMetadataForDescendingKeys(java.lang.String tbname,
java.lang.String ixname)
This method should be called immediately after executing the Sql from
getSysIndexRefresh on an Oracle platform. |
java.lang.String |
getAddRowstampSql(java.lang.String tbname)
Return the "alter table" statement for adding the rowstamp column.
|
java.util.ArrayList<java.lang.String> |
getAnalyzeTableStatement(java.lang.String tbname)
Output "analyze table compute statistics" statement(s) for Oracle.
|
java.util.ArrayList<java.lang.String> |
getApplyTenantChanges(int tenantid,
boolean mtEnabled)
Generate Sql statements to remove configuration changes that have not yet been implemented.
|
java.util.ArrayList<java.lang.String> |
getAttributeCfgRefresh()
Return "insert into maxattributecfg (col1, col2, ...) select col1, col2, ...
|
java.util.ArrayList<java.lang.String> |
getAttributeCfgRefresh(int tenantId,
boolean mtEnabled)
Return "insert into maxattributecfg (col1, col2, ...) select col1, col2, ...
|
java.util.HashMap |
getAttributeForMaxViewColumn(java.lang.String viewName,
java.util.HashMap viewcolInfo,
java.util.TreeMap distinctAttrs)
Given a row from MaxViewColumn and a set from MaxAttribute, find the
row in MaxAttribute that corresponds to this MaxViewColumn.
|
java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>>> |
getAttributeMeta(java.lang.String objectname,
boolean getCfg,
boolean orderByName,
boolean getPersistentOnly,
boolean getChangedOnly,
boolean selectView,
java.lang.String entityName)
Get attribute metadata (maxattributes and maxviewcolumns) for an object.
|
java.lang.String |
getAttributeName(java.lang.String objectname,
java.lang.String tablename,
java.lang.String columnname)
Get attributename for a given column.
|
java.util.ArrayList<java.lang.String> |
getAttributeRefresh()
Return "insert into maxattribute (col1, col2, ...) select col1, col2, ...
|
java.util.ArrayList<java.lang.String> |
getAttributeRefresh(int tenantId,
boolean mtEnabled,
java.lang.String objectName)
Return "insert into maxattribute (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getBackupTableName(java.lang.String tbname)
Get the name of the backup table.
|
java.util.HashMap |
getColumnInfo(java.util.TreeMap tableCols,
java.lang.String name)
Given a TreeMap of columns in a table that is keyed by attribute number (attributeno), find the
HashMap for the specified column name and return it.
|
java.lang.String[] |
getColumnName(java.lang.String objectname,
java.lang.String attributename)
Get tablename and columnname for a given attribute.
|
java.lang.String |
getColumnNames(java.util.TreeMap tableCols,
boolean doLineBreaks,
boolean includeDroppedCols)
Calls
getColumnNames
with the colNameList parameter null, and the useAlias parameter False. |
java.lang.String |
getColumnNames(java.util.TreeMap tableCols,
boolean doLineBreaks,
boolean includeDroppedCols,
java.lang.String colNameList,
boolean useAlias)
For a table, output the persistent column names (lower case) delimited by commas.
|
java.lang.String[] |
getColumnNamesForExtendedView(java.util.TreeMap tableCols,
java.lang.String tableName,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> extendedTables,
java.lang.String uniqueColumnName,
java.lang.String isView,
boolean mtEnabled)
For a table, output the persistent column names (lower case) delimited by commas.
|
java.lang.String |
getColumnNamesNative(java.lang.String tbname)
Get comma-delimited list of lowercase column names from the native metadata for the specified table.
|
java.lang.String |
getCurrentNativeSchema()
Get the current session's default schema from the native system tables.
|
java.util.TreeMap |
getData(java.lang.String tbname,
java.util.TreeMap tableCols,
java.lang.String where)
Output the data in the table to a TreeMap.
|
java.lang.String |
getDatabaseName()
Get the database name from system tables depending on database type.
|
java.lang.String |
getDB2ConvertString(java.lang.String oldNativeType,
java.lang.String newNativeType,
java.lang.String colName)
If a DB2 function can convert the oldNativeType to the newNativeType, return the function.
|
java.lang.String |
getDB2TextIndexSpace()
Get the index space for DB2 text search indexes.
|
int |
getDB2Version()
If
dbIn is DB2, this method returns the first part of the database
version (8, 9, etc.). |
double |
getDB2Version(boolean getPoint)
If
dbIn is DB2, this method returns the database version. |
java.lang.String |
getDBHostName()
Get the host name where database is installed from system tables depending on database type.
|
java.util.ArrayList<java.lang.String> |
getDBStoragePartitions()
Get the names of the storagepartitions from the valuelist
DBSTORAGEPARTITION.
|
java.lang.String |
getDefaultStoragePartition(boolean checkValuelist)
Get the name of the default storagepartition.
|
java.lang.String |
getDefaultString(java.lang.String tbname,
java.util.HashMap colInfo)
Return a string in format for use in a Sql statement for the designated column.
|
java.lang.String |
getDefaultString(java.lang.String tbname,
java.lang.String colName,
java.lang.String maxtype,
java.lang.String metaDefaultValue,
java.lang.String domainid) |
java.lang.String |
getDefaultString(java.lang.String tbname,
java.lang.String colName,
java.lang.String maxtype,
java.lang.String metaDefaultValue,
java.lang.String domainid,
java.lang.String sequenceName,
int uidRule,
int seqRule,
int autoRule,
int mboRule,
int appRule,
boolean outputQuotes,
boolean assignIfNoMeta)
This method is the central respository for database utilities (other than upgrade and Mbo framework)
to get an attribute's default value.
|
java.util.List<java.lang.String> |
getDeltaTriggerSql(java.lang.String tbname)
Rebuild triggers as secure, and activate row level control for all tables.
|
java.lang.String |
getDisableTriggerStatement(java.lang.String triggerName,
java.lang.String tbname)
Return a "disable trigger" statement for the specified trigger.
|
java.util.ArrayList<java.lang.String> |
getDisallowPageLocks()
Return the Sql statements to disallow page locks for the indexes on Maximo tables
that are not already disallowed.
|
java.util.ArrayList<java.lang.String> |
getDropStatisticsStatements(java.lang.String tbname,
java.lang.String colname)
Return "drop statistics" statement(s) for SqlServer platform only.
|
java.util.ArrayList |
getDropStatisticsStatementsForConfig(java.lang.String entityname)
Get the "drop statistics" statements for all columns that are pending ConfigDB.
|
java.lang.String |
getEnableDisableTriggersAll(java.lang.String tbname,
boolean enable)
Return the Sql command for enabling or disabling all triggers on a specified table.
|
java.lang.String |
getEnableTriggerStatement(java.lang.String triggerName,
java.lang.String tbname)
Return a "enable trigger" statement for the specified trigger.
|
java.lang.String |
getExtendedUniqueColumnForView(java.lang.String viewName,
java.lang.String extTableName)
This method gets unique column name for the view and extended table name.
|
static java.lang.String |
getFileText(java.io.InputStream fileStrm)
Get the content of the file
|
java.util.HashMap<java.lang.String,int[]> |
getGrants(java.lang.String username,
java.lang.String entityname)
Determine what objects the user has read, insert, update, or delete access to.
|
java.lang.String |
getGrantSql(java.lang.String dbUserID,
java.lang.String entityname,
java.lang.String privilege,
boolean grant)
Grant or revoke native database access for a given user and table/view.
|
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> |
getIndexMeta(java.lang.String tbname,
boolean getChangedOnly) |
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> |
getIndexMeta(java.lang.String tbname,
boolean getChangedOnly,
boolean getPrimary) |
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> |
getIndexMeta(java.lang.String tbname,
boolean getChangedOnly,
boolean getPrimary,
boolean includeDeleted)
Get metadata for indexes.
|
java.util.ArrayList<java.lang.String> |
getIndexNamesForColumn(java.lang.String tbname,
java.lang.String colName)
Get the names of indexes that exist in the metadata and contain the specified column.
|
java.lang.String |
getInternalSearchType(java.lang.String externalSearchType)
Given the external value of searchtype, return the internal value from synonymdomain table.
|
java.lang.String |
getInternalSiteOrgType(java.lang.String externalSiteOrgType)
Given the external value of siteorgtype, return the internal value from synonymdomain table.
|
int |
getJdbcType(java.lang.String nativeType,
int dbPlatform)
Get the JDBC Type (java.sql.Types) for the native datatype.
|
java.lang.String |
getKeyAttribute(java.lang.String objectname,
java.lang.String tablename)
This method identifies the "key attribute" (i.e., the unique column within siteid or orgid) so
that ConfigDB can determine whether the table has an attribute that can be autonumbered (canautonum = True).
|
java.util.TreeMap<java.lang.String,java.lang.String> |
getKeyColumns(java.util.TreeMap indexMeta,
java.util.TreeMap tableCols,
java.lang.String indexToSkip)
Determine the columns in a table's primary key.
|
java.lang.String |
getLangColumnName(java.lang.String tbname)
Get the name of the language column for a given table.
|
boolean |
getLocDefault(java.lang.String objectName,
java.lang.String attributeName,
java.util.HashMap attrInfo,
java.util.HashMap sameasAttrInfo)
Identifies the default value for "localizable" for the specified attribute.
|
int |
getMaxColno(java.lang.String objectname,
boolean getCfg,
java.lang.String where)
Get the maximum value of "attributeno" from the metadata for this object.
|
int |
getMaxColumnLength(java.lang.String tbname,
java.lang.String name)
Get the maximum actual data length for this column.
|
int |
getMaxEAuditTransID()
Get the maximum value of "eaudittransid" from all of the eaudit tables.
|
int |
getMaximumColumnNameLength()
Get the maximum length of a column name.
|
int |
getMaxLengthColumnInIndex()
Get the maximum allowed for the length of any one column in an index.
|
int |
getMaxLengthIndex()
Get the maximum allowed for the sum of lengths of all columns in an index.
|
java.lang.String[] |
getMaxTableAttrs()
Loads the attributes of the MaxTable table.
|
java.lang.String |
getMaxType(java.lang.String nativeType)
Return the Maximo datatype for the specified native datatype.
|
java.lang.String |
getMaxUpgVersion()
Return the value of
maxUpgVersion (the maxvar value for MAXUPG),
initialized via the constructor. |
java.lang.String |
getMaxvar(java.lang.String varname,
boolean getDefault)
Get value of maxvar from database.
|
int |
getMaxVarcharLength()
Get the maximum allowed for the length a varchar column.
|
java.util.HashSet<java.lang.String[]> |
getMetadataSequenceNames()
Get description of the sequences used on the metadata tables for objects, attributes, tables and views.
|
java.lang.String |
getNativeDateDefault()
Return the native command for getting the current system date.
|
java.lang.String |
getNativePartition(java.lang.String tbname)
Return the native storage partition for the specified table.
|
java.lang.String |
getNativeType(java.lang.String maxType,
java.lang.String length,
int dbPlatform)
Return the native datatype for the specified Maximo datatype.
|
java.lang.String |
getNativeTypeForColumn(java.lang.String tbname,
java.lang.String name)
Return the native datatype from the system tables for the specified column.
|
java.lang.String |
getNewIndexName(java.lang.String tbname,
int startWith)
Identify an index name that can be used for creating a new index on this table.
|
int |
getNextAttrNo(java.lang.String tablename)
Rebuild triggers as secure, and activae row level control for all tables
|
long |
getNextSequenceNo(java.lang.String sequenceName)
Get the next value for this sequence.
|
java.lang.String |
getNextSequenceValueForSqlServer(java.lang.String seqName)
This method gets the next value from maxsequence and updates maxsequence.
|
java.lang.String |
getNo()
Return the value of
sNo . |
java.util.ArrayList<java.lang.String> |
getObjectCfgRefresh()
Return "insert into maxobjectcfg (col1, col2, ...) select col1, col2, ...
|
java.util.ArrayList<java.lang.String> |
getObjectCfgRefresh(int tenantId,
boolean mtEnabled)
Return "insert into maxobjectcfg (col1, col2, ...) select col1, col2, ...
|
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> |
getObjectMeta(java.lang.String objectname,
boolean getCfg,
boolean getPersistentOnly,
boolean getChangedOnly,
boolean getColumns,
boolean colsOrderByName,
boolean getTablesOnly,
boolean getViewsOnly)
Get metadata for an object (table or view).
|
java.lang.String |
getObjectName(java.lang.String entityname,
boolean useIsViewConstraint,
boolean isView)
Get objectname for a given table or view.
|
java.util.ArrayList<java.lang.String> |
getObjectRefresh()
Return "insert into maxobject (col1, col2, ...) select col1, col2, ...
|
java.util.ArrayList<java.lang.String> |
getObjectRefresh(int tenantId,
boolean mtEnabled,
java.lang.String objectName)
Return "insert into maxobject (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getOldBackupTables(java.lang.String tbname)
Return a Sql statement that checks for the existence of old backup tables.
|
java.lang.String |
getOracleConvertString(java.lang.String oldNativeType,
java.lang.String newNativeType,
java.lang.String colName)
If an Oracle function can convert the oldNativeType to the newNativeType, return the function.
|
int |
getOracleVersion()
If
dbIn is Oracle, this method returns the first part of the database
version (8, 9, etc.). |
double |
getOracleVersion(boolean getPoint)
If
dbIn is Oracle, this method returns the database version. |
java.util.TreeMap<java.lang.String,java.lang.String> |
getOrgs(boolean includeDisabled)
Identify the organizations on the database.
|
java.util.ArrayList<java.lang.String> |
getPartitionRefresh()
Output the Sql statements needed to update dbstoragepartition on maxtable and maxtablecfg
with the actual native partition name.
|
java.util.TreeMap<java.lang.String,java.lang.String> |
getPrimaryKeys(java.lang.String objname,
boolean getCfg) |
java.util.ArrayList<java.lang.String> |
getRemoveChanges()
Generate Sql statements to remove configuration changes that have not yet been implemented.
|
java.util.ArrayList<java.lang.String> |
getRemoveTenantChanges(int tenantid,
boolean mtEnabled)
Generate Sql statements to remove configuration changes that have not yet been implemented.
|
java.lang.String |
getRenameTableStatement(java.lang.String oldTbname,
java.lang.String newTbname)
Return a "rename table" statement for the specified table.
|
java.util.ArrayList<java.lang.String> |
getRowstampTriggerSql(java.lang.String tbname,
boolean dropIfExists)
Return the "create or replace trigger" statement(s) for populating the rowstamp column.
|
java.util.ArrayList<java.lang.String> |
getRowstampTriggerSql(java.lang.String tbname,
boolean dropIfExists,
boolean makeSecure)
Return the "create or replace trigger" statement(s) for populating the rowstamp column.
|
java.lang.String |
getSchemaName()
Get the schema name from system tables depending on database type.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getSequences(java.lang.String tableName)
Cache the sequences for later use in
createSequences . |
java.lang.String |
getSiteOrgType(java.lang.String objectname)
Get internal siteorgtype for a given table.
|
java.util.TreeMap<java.lang.String,java.lang.String> |
getSites(boolean includeDisabled)
Identify the sites on the database.
|
int |
getSqlServerCompatLevel()
If
dbIn is SqlServer, this method returns the database compatibility level. |
java.lang.String |
getSqlServerConvertString(java.lang.String oldTbname,
java.lang.String newTbname,
java.util.HashMap newColInfo)
Return SqlServer sql for "convert" from datatype for a specified column.
|
int |
getSqlServerVersion()
If
dbIn is SqlServer, this method returns the first part of the database
version (8, 9, etc.). |
double |
getSqlServerVersion(boolean getPoint)
If
dbIn is SqlServer, this method returns the database version. |
java.lang.String |
getStorageClause(java.lang.String name,
boolean isTable)
Get the "storage" clause to use when creating a table or index.
|
java.lang.String |
getStoragePartition(java.lang.String tbname)
Get storagepartition for a given table.
|
MTStorageType |
getStorageType(java.lang.String tableName)
Get storage type for a given table.
|
java.util.ArrayList<java.lang.String> |
getSysIndexRefresh(java.lang.String tbname,
java.lang.String ixname)
Create an array of "insert into maxsysindexes" and "insert into maxsyskeys"
statements based on the actual existing native indexes.
|
java.lang.String |
getTableCfgRefresh()
Return "insert into maxtablecfg (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getTableCfgRefresh(int tenantId,
boolean mtEnabled)
Return "insert into maxtablecfg (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getTableName(java.lang.String objectname)
Get tablename for a given object.
|
java.lang.String |
getTableRefresh()
Return "insert into maxtable (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getTableRefresh(int tenantId,
boolean mtEnabled,
java.lang.String tableName)
Return "insert into maxtable (col1, col2, ...) select col1, col2, ...
|
java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> |
getTenantAttributeMeta(java.lang.String objectname,
int tenantId)
Get attribute metadata (maxattributes and maxviewcolumns) for an object.
|
java.util.ArrayList<java.lang.String> |
getTenantCodeMetadata()
Retrieve datatype and length for TENANTCODE from maxattributecfg talbe TENANTREG
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> |
getTenantExtAttributes(java.sql.Connection conn,
java.lang.String objectName,
int tenantId)
Returns the attributes for the given tenant and/or object.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
gettenantSameAsExtendedAtributes(int tenantId)
Get attribute metadata (maxattributes and maxviewcolumns) for an object.
|
java.util.HashMap |
getTextSearchIndexForColumn(java.lang.String tbname,
java.lang.String colName,
java.util.TreeMap tbIndexes)
Get the index metadata for the text search index for the specified table and column.
|
java.util.ArrayList<java.lang.String> |
getTriggerNames(java.lang.String tbname,
boolean getEnabled,
boolean getDisabled,
boolean includeRowstamp)
Get the names of triggers that satisfy the specified parameters.
|
java.lang.String |
getTrigRoot(java.lang.String tbname)
Gets the trigger name root for the table.
|
java.lang.String |
getUniqueColumnName(java.lang.String tbname)
Get the name of the unique column for a given table, from our metadata.
|
java.lang.String |
getUniqueColumnNameNative(java.lang.String tbname)
Get the name of the unique column for a given table, from the native db (NOT our metadata).
|
java.lang.String |
getUniqueIndexSpace(java.lang.String tbname,
java.lang.String tbPartition)
This method is intended for building DB2 "create table" statements.
|
java.lang.String |
getUnrestoredTables(java.lang.String tbname)
Return a Sql statement that checks for the existence of tables where
maxtablecfg.restoredata = True.
|
java.util.ArrayList<java.lang.String> |
getUpdateStatistics(java.util.TreeMap tableMap,
java.util.TreeMap indexMap)
Generate "dbms_stats.gather_table_stats" (for Oracle)
or "update statistics" (for SqlServer) statements for the specified tables/indexes;
does not include an index if it is being dropped.
|
java.util.ArrayList |
getUpdateTenantDelta(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String[]>>> changedObjects,
int tenantId,
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> cfgAttrs,
java.util.Vector<java.lang.String[]> skipList)
THis method will store all attributes which were changed by System Admistrator.
|
java.lang.String |
getUserFromProperties(boolean getLandlordUser)
Rebuild triggers as secure, and activae row level control for all tables
|
int |
getVarcharMultiple()
Return the value of varchar multiple.
|
java.lang.String |
getViewCfgRefresh()
Return "insert into maxviewcfg (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getViewCfgRefresh(int tenantId,
boolean mtEnabled)
Return "insert into maxviewcfg (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getViewColumnCfgRefresh()
Return "insert into maxviewcolumncfg (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getViewColumnCfgRefresh(int tenantId,
boolean mtEnabled)
Return "insert into maxviewcolumncfg (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getViewColumnRefresh()
Return "insert into maxviewcolumn (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getViewColumnRefresh(int tenantId,
boolean mtEnabled)
Return "insert into maxviewcolumn (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getViewName(java.lang.String objectname)
Get viewname for a given object.
|
java.lang.String |
getViewRefresh()
Return "insert into maxview (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getViewRefresh(int tenantId,
boolean mtEnabled)
Return "insert into maxview (col1, col2, ...) select col1, col2, ...
|
java.lang.String |
getYes()
Return the value of
sYes . |
boolean |
implicitConversionSupported(java.lang.String newType,
java.lang.String oldType)
Identifies whether implicit datatype conversion is supported for SqlServer datatype change.
|
boolean |
indexMetaExistsForPrikeycolseq(java.lang.String objname,
java.lang.String tbname,
boolean getCfg)
Determine whether index metadata exists for the primarykeycolseq for
the specified table.
|
boolean |
isHandleColumn(java.lang.String colName,
java.util.TreeMap attrs)
Determines whether the specified column is a "handle column" for text search, based on our metadata.
|
boolean |
isLocAllowed(java.lang.String objectName,
java.lang.String attributeName,
java.util.HashMap attrInfo,
java.util.HashMap sameasAtrInfo)
Identifies whether "localizable" allowed to be True for the specified attribute.
|
boolean |
isMTEnabled()
Given the name of a column on maxtablecfg, maxattributecfg, maxsysindexes, or maxsyskeys,
identify whether this is a YORN attribute.
|
boolean |
isNickname(java.lang.String name)
Determine whether the given name is a nickname.
|
boolean |
isObjectLocked(java.lang.String entityname)
Identifies whether an object has been locked in the native database.
|
boolean |
isReorgPending(java.lang.String tbname)
Specifies whether reorg is pending for this table (DB2 only).
|
boolean |
isReservedWord(java.lang.String testWord)
Identifies whether the testWord is a reserved word on the native database.
|
boolean |
isRichTextSupported(java.lang.String tbname,
java.lang.String name)
This method identifies whether rich text functionality is supported in this database.
|
boolean |
isRTSupportedForDB()
Is Text Search supported for this database platform and Maximo parameters?
Same as isRichTextSupported(null, null) but optimized for performance.
|
boolean |
isSpecialDefaultValue(java.lang.String value)
Identify whether the give value is one of the special reserved words for defaultvalue (e.g.
|
boolean |
isSysNumeric(java.lang.String attrName)
Given the name of a column on maxtablecfg, maxattributecfg, maxsysindexes, or maxsyskeys,
identify whether this is a numeric attribute.
|
boolean |
isSysYORN(java.lang.String attrName)
Given the name of a column on maxtablecfg, maxattributecfg, maxsysindexes, or maxsyskeys,
identify whether this is a YORN attribute.
|
boolean |
isTable(java.util.HashMap tableInfo)
Quickly identifies whether this is a table or a view.
|
boolean |
lockMaximoTables(java.lang.String tbname,
boolean lock)
Deprecated.
The logic for SqlServer is not working consistently. This method may be removed.
|
boolean |
longIndexNamesExist(java.lang.String tbname)
Identified whether native indexes exist whose index name is longer than that allowed by Maximo.
|
java.util.ArrayList<java.lang.String> |
makeSpace(java.lang.String spaceName,
int numBytes)
Deprecated.
Replaced by
makeSpace |
java.util.ArrayList<java.lang.String> |
makeSpace(java.lang.String spaceName,
int numBytes,
java.lang.String multiplier)
Return Sql statements that will effectively determine whether space can be extended
for the specified number of bytes.
|
boolean |
mxServerIsUp(java.lang.String serverName)
Determine whether MXServer is running.
|
boolean |
nameInList(java.lang.String name,
java.lang.String list)
Does the name exist in the list?
Called from
getColumnNames . |
boolean |
nativeColumnExists(java.lang.String tbname,
java.lang.String name)
Determine whether the native column exists.
|
boolean |
nativeColumnIsNullable(java.lang.String tbname,
java.lang.String name)
Determine whether the native column is nullable.
|
java.util.ArrayList<java.lang.String> |
nativeDefaultConstraintExists(java.lang.String tbname,
java.lang.String name)
Identifies whether the given column has a default constraint in SqlServer.
|
boolean |
nativeIndexExists(java.lang.String ixname,
java.lang.String tbname)
Determine whether the native index exists.
|
java.util.ArrayList<java.lang.String> |
nativeIndexExistsForColumn(java.lang.String tbname,
java.lang.String name)
Identifies whether the given column participates in a native index for the given table.
|
java.lang.String |
nativeIndexExistsForColumns(java.lang.String tbname,
java.lang.Object[] names)
Call
nativeIndexExistsForColumns
with last parameter false. |
java.lang.String |
nativeIndexExistsForColumns(java.lang.String tbname,
java.lang.Object[] names,
boolean ignoreTS)
Identifies whether an index exists on the given table with the given sequence of columns.
|
boolean |
nativeIndexIsPrimaryKey(java.lang.String ixname)
Identifies whether an index is a native primary key for DB2.
|
boolean |
nativeIndexIsUnique(java.lang.String ixname)
Identifies whether an index is unique on the native database.
|
boolean |
nativeSequenceExists(java.lang.String name)
Determine whether the native sequence exists.
|
boolean |
nativeSpaceExists(java.lang.String name)
For Oracle and DB2, checks to see whether the native tablespace exists.
|
boolean |
nativeTableExists(java.lang.String tbname)
Determine whether the native table exists.
|
boolean |
nativeTriggerExists(java.lang.String trigname)
Determine whether the native trigger exists.
|
boolean |
nativeTypesAreCompatible(java.lang.String oldNativeType,
java.lang.String newNativeType)
Identifies whether data can be copied from old table to new table without any conversion activity.
|
boolean |
nativeViewExists(java.lang.String vname)
Determine whether the native view exists.
|
boolean |
needLength(java.lang.String maxtype,
java.lang.String nativeType)
For the specified datatype, identifies whether the column definition needs a length
(for example, in a "create table" statement).
|
boolean |
needScale(java.lang.String maxtype,
java.lang.String nativeType)
For the specified datatype, identifies whether the column definition needs a scale
(for example, in a "create table" statement).
|
boolean |
nullValueExists(java.lang.String tbname,
java.lang.String name)
Identifies whether any row for this table has null value for this column.
|
java.util.ArrayList<java.lang.String> |
objAttrDelRefresh(int tenantid,
boolean mtEnabled) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Return a prepared Statement created with the appropriate parameters for this platform.
|
void |
processTemplateData(int toTenantid,
boolean delete,
java.lang.String maxUserGroup,
java.lang.String allUserGroup,
java.lang.String newUserGroup,
java.io.PrintStream out)
Copy all template data (STORAGETYPE = 3) from template (TENANTID = 0)
to a tenant
|
java.util.ArrayList<java.lang.String> |
rebuildIndexes(java.util.TreeMap indexMeta,
boolean alwaysDrop,
boolean neverDrop,
boolean specifySchema,
boolean specifyStorage)
Output sql to drop and recreate the indexes.
|
java.util.ArrayList<java.lang.String> |
rebuildMetadataSequences()
Rebuild the native sequence and update maxsequence table for the sequences used
by the Maximo metadata tables.
|
void |
rebuildPermissions(java.lang.String processUser)
Rebuild triggers as secure, and activate row level control for all tables
|
java.util.List<java.lang.String> |
rebuildProcessUserVariable(java.lang.String adminUser)
Rebuilds variable GV_MTPRCUSR for new user
|
java.lang.String |
reEvaluateAttributeChanged(java.lang.String entityname,
java.util.HashMap newAttr,
java.util.HashMap oldAttr,
java.lang.String upgradeDir,
boolean isView)
Call
reEvaluateTableAttributeChanged
or reEvaluateViewAttributeChanged ,
depending on whether this is a table or a view. |
java.lang.String |
reEvaluateAttributeChangedQuickGL(java.lang.String entityname,
java.lang.String columnname,
boolean isView,
int oldLength,
int newLength,
boolean persistent,
java.lang.String origChanged)
This method is used for quick evaluation of the "changed" attribute for an attribute,
when changing ONLY the length of the attribute for the purposes of GL account configuration.
|
java.lang.String |
reEvaluateObjectChanged(java.util.HashMap newObject,
java.util.HashMap oldObject,
boolean useAttrChanged,
java.lang.String upgradeDir)
Look through the metadata for maxobjectcfg and maxattributecfg (old and new),
and determine the proper value for maxobjectcfg changed.
|
java.lang.String |
reEvaluateObjectChanged(java.util.HashMap newObject,
java.util.HashMap oldObject,
boolean useAttrChanged,
java.lang.String upgradeDir,
java.lang.String langcode) |
java.lang.String |
reEvaluateObjectChangedQuickGL(java.lang.String entityname,
boolean isView,
java.util.HashMap attrs,
boolean persistent,
java.lang.String origChanged)
For quick calculation of new value of "changed" when the only change being made is to
GL Configure.
|
java.lang.String |
reEvaluateTableAttributeChanged(java.lang.String tablename,
java.util.HashMap newAttr,
java.util.HashMap oldAttr,
java.lang.String upgradeDir)
For table attributes, look through the metadata for maxattributecfg (old and new) and determine the
proper value for maxattributecfg changed.
|
java.lang.String |
reEvaluateViewAttributeChanged(java.lang.String viewname,
java.util.HashMap newAttr,
java.util.HashMap oldAttr,
java.lang.String upgradeDir)
For view attributes, look through the metadata for maxattributecfg (old and new) and determine the
proper value for maxattributecfg changed.
|
java.util.List<java.lang.String> |
registerTableFromTemplate(java.lang.String tbname,
java.util.TreeMap tableCols,
java.lang.String whereClause)
Output to the print stream a series of "insert into..." statements so that
the table can be rebuilt.
|
void |
reloadAttributeList()
This builds the lists of metadata attributes to support instanciating Util for
a database from a different release than the installed source code, which may have a
different metadata structure.
|
java.util.ArrayList<java.lang.String> |
renumberAttributeNumber(java.lang.String objectname,
java.util.TreeMap attrs) |
java.util.ArrayList<java.lang.String> |
renumberExtAttributeNumber(java.lang.String objectname,
java.util.Map extTables,
int start,
java.util.ArrayList<java.lang.String> sqlList) |
java.util.ArrayList<java.lang.String> |
renumberExtendedAttributes(int tenantId,
java.util.Map<java.lang.String,java.lang.Integer> lastNumbers,
java.util.ArrayList<java.lang.String> list)
This method will store all attributes which were changed by System Admistrator.
|
void |
reorgBeforeDB2TSUpdate()
Reorg tables that have DB2 TS indexes to avoid exceptions
while updating TS indexes.
|
java.util.ArrayList<java.lang.String> |
reorgTable(java.lang.String tbname,
boolean redoTriggers)
Call Reorg and related commands for a given table.
|
java.util.ArrayList<java.lang.String> |
revalidateTextSearchIndexes(java.lang.String tbname)
Get statements for revalidating text search indexes (DB2).
|
boolean |
rowFound(java.lang.String sql)
General purpose utility to test whether something exists.
|
java.lang.String |
selectString(java.lang.String sql)
General purpose utility to select one String value from database.
|
java.lang.String |
setConfigInProcess(boolean inProcess)
Return Sql for setting Config in process (maxvar
CONFIGURING ). |
void |
setConnection(java.sql.Connection connection)
Set the database connection
con , used for retrieving data. |
void |
setDB2tsPreferSysproc(boolean val)
Set the preference for SYSPROC.TS vs "db2ts" CLP commands.
|
void |
setDBOut(int platform)
Identify how output should be formatted.
|
void |
setPrintStream(java.io.PrintStream outstream)
Set the output print stream
out . |
void |
setVarcharMultiple(int val)
This is used when the native length of a varchar column should be adjusted
by some multiple of the length defined on maxattribute and the value cannot
be loaded via the constructor (e.g.
|
void |
setVargraphic(boolean val)
This is used in DB2 platform when native datatype "vargraphic"
should be used instead of "varchar".
|
java.lang.String |
singleToDoubleQuotes(java.lang.String in)
Scan input string to see if it contains any single quotes,
and replace any single quote with two single quotes.
|
java.lang.String[] |
spaceCheckForDBConfig()
Using the metadata in maxattributecfg, determine whether adequate space is or can be made
available for running ConfigDB.
|
boolean |
spaceIsActive(java.lang.String spaceName)
Determine whether the specified tablespace is available.
|
boolean |
spaceIsSysManaged(java.lang.String spaceName)
Determine whether the specified tablespace is system-managed.
|
java.lang.Object[] |
spaceNeeded(java.lang.String spaceName)
Determine how much space is needed from the specified
tablespace name to run ConfigDB.
|
void |
storeChangedAttributes(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String[]>>> changedObjects,
java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> attrs,
java.lang.String objectname)
THis method will store all attributes which were changed by System Admistrator.
|
boolean |
tableIsEmpty(java.lang.String tbname)
Identifies whether there are any rows on this table.
|
java.lang.String |
toggleStringConcat(java.lang.String inString,
java.lang.String inConcat,
java.lang.String outConcat)
Scan input string and change the concatenator character.
|
java.util.List<java.lang.String> |
updateDMSource()
Return sql to update Deployment Manager tables with new source value.
|
void |
updateGroupName(java.lang.String tabName,
java.lang.String maxUserGroup,
java.lang.String allUserGroup,
java.lang.String newUserGroup,
int toTenantid)
Copy all template data for a table from template (TENANTID = 0)
to a tenant
|
java.util.List<java.lang.String> |
updateIndexRequired()
Sets the MaxSysIndexes Required flag for all indexes.
|
java.util.ArrayList<java.lang.String> |
updateMaxSequence(java.util.HashSet sequences)
Returns sql statements for updating MaxSequence MaxReserved.
|
java.util.ArrayList<java.lang.String> |
updateMaxSequence(java.util.HashSet sequences,
java.util.Map<java.lang.String,java.lang.Long> lastNumbers)
Returns sql statements for updating MaxSequence MaxReserved.
|
java.util.ArrayList<java.lang.String> |
updateViewMetaDataForExtendedAttr(java.sql.Connection conn,
java.lang.String objectName,
java.lang.String viewName,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> extAttr,
int tenantId) |
boolean |
upgradeDefaultExists(java.lang.String tbname,
java.lang.String name,
java.lang.String upgradeDir)
If this is the upgrade process (upgradeDir is not null), this method identifies
whether the upgrade provides a default value for the specified column.
|
boolean |
useQuotes(java.lang.String maxtype)
Return True if quotation marks need to surround the column's value in a SQL statement.
|
boolean |
useVargraphic()
Return the value of useVargraphic.
|
boolean |
usingMultiSchema()
Does this database use multi-schema?
|
void |
writeDumpTable(java.lang.String tbname,
java.util.TreeMap tableCols,
java.io.PrintStream out) |
int |
writeDumpTable(java.lang.String tbname,
java.util.TreeMap tableCols,
java.io.PrintStream out,
int maxLines,
int numLines,
Unlcvt unlcvt,
boolean psFormat)
Output to the print stream a series of "insert into..." statements so that
the table can be rebuilt.
|
public int MAX_NAME_LENGTH
public java.lang.String[] objectAttrs
public java.lang.String[] attrAttrs
public java.lang.String[] viewAttrs
public java.lang.String[] viewColAttrs
public java.lang.String[] objectCfgNPAttrs
public java.lang.String[] attrCfgNPAttrs
public java.lang.String[] attrTransAttrs
public java.lang.String[] objTransAttrs
public static int ssSELECTAUTH
public static int ssINSERTAUTH
public static int ssDELETEAUTH
public static int ssUPDATEAUTH
public static int ssGRANTED
public int dbIn
setConnection
.
Valid values are specified in UpgConstants
.UpgConstants.ORACLE
,
UpgConstants.SQLSERVER
,
UpgConstants.DB2
,
dbOut
public int dbOut
dbIn
.
This is assigned a value in the constructor and in setDBOut
.
Valid values are specified in UpgConstants
.UpgConstants.ORACLE
,
UpgConstants.SQLSERVER
,
UpgConstants.DB2
,
dbIn
public boolean post602
public Util(java.sql.Connection conparam, java.io.PrintStream outparam, java.lang.String schemaOwnerparam) throws java.lang.Exception
Util
with last param True.
This is the normal way to instanciate this class.java.lang.Exception
public Util(java.sql.Connection conparam, java.io.PrintStream outparam, java.lang.String schemaOwnerparam, boolean reloadAttrs) throws java.lang.Exception
setConnection
,
which assigns a values to dbIn
.
setPrintStream
,
which assigns a value to out
.
maxUpgVersion
.
reloadAttributeList
if reloadAttrs param is True.
conparam
- Database connection. Required.outparam
- Output print stream. Can be null.schemaOwnerparam
- Schema owner. If this param is null, this class will try to determine the proper value.reloadAttrs
- True to reload metadata attribute lists, else False. Normally this should always be True!
However, there are some methods in ConfigureService that need to quickly instanciate (and discard) this class,
and that will never need accurate metadata, so these methods can instanciate Util with this param False.java.lang.Exception
setConnection(java.sql.Connection)
,
setPrintStream(java.io.PrintStream)
,
getMaxvar(java.lang.String, boolean)
,
reloadAttributeList()
,
getCurrentNativeSchema()
,
setVarcharMultiple(int)
,
setVargraphic(boolean)
public java.lang.String[] getMaxTableAttrs() throws java.sql.SQLException
java.sql.SQLException
maxTableAttrs
public void reloadAttributeList() throws java.lang.Exception
It is conceivable that there may be some methods that still may not work on an exceedingly old database.
java.lang.Exception
objectAttrs
,
#tableAttrs
,
attrAttrs
,
viewAttrs
,
viewColAttrs
,
sysYORNattrs
,
sysNumattrs
,
psdi.upgrade.BuildUpgMetadata
,
Created to load/reload MaxTable attributes.
public java.lang.String getCurrentNativeSchema() throws java.lang.Exception
java.lang.Exception
getSchemaName()
public void writeDumpTable(java.lang.String tbname, java.util.TreeMap tableCols, java.io.PrintStream out) throws java.lang.Exception
java.lang.Exception
writeDumpTable(String, TreeMap, PrintStream, int, int, Unlcvt, boolean)
public int writeDumpTable(java.lang.String tbname, java.util.TreeMap tableCols, java.io.PrintStream out, int maxLines, int numLines, Unlcvt unlcvt, boolean psFormat) throws java.lang.Exception
If this is Oracle, the rowstamp value is set to "maxseq.nextval".
Depending on the platform, there will be a semicolon (";") or "go" after the statement, so that it can be run via a script.
Any encrypted datatypes (such as password) will be set to a foobar value, as encrypted data cannot be output to a print file.
tbname
- The table name (must be a persistent table).tableCols
- The column attributes for persistent columns. Can be null.
If null, this method calls getAttributeMeta
.out
- The output print stream.numLines
- The number of lines that have been written to the current
output file.maxLines
- The maximum number of lines that can be written to an output file.
This parameter enables Unlcvt to output multiple files.
If there is no maximum, this will equal 0.unlcvt
- Instance of Unlcvt that invoked this method. Used only when maxLines > 0.psFormat
- If this is true then output will support use of PreparedStatement when script is
run by Maxinst. This is set to true by using the -b param when running Unlcvt.java.lang.Exception
getAttributeMeta(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String)
,
buildSelectStatement(java.lang.String, java.util.TreeMap, boolean, boolean)
,
buildInsertStatementPrefix(java.lang.String, java.util.TreeMap, boolean, boolean)
,
buildInsertValuesStatement(java.lang.String, java.sql.ResultSet, java.util.TreeMap, boolean, java.lang.String)
public java.util.TreeMap getData(java.lang.String tbname, java.util.TreeMap tableCols, java.lang.String where) throws java.lang.Exception
tbname
- The table name (must be a persistent table).tableCols
- The column attributes for persistent columns. Can be null.
If null, this method calls getAttributeMeta
and then gets
"$MAXATTRIBUTES".where
- The Where clause (not including the word "where"). This is optional.
If null, no Where clause will be applied.java.lang.Exception
getAttributeMeta(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String)
,
getKeyColumns(java.util.TreeMap, java.util.TreeMap, java.lang.String)
,
buildSelectStatement(java.lang.String, java.util.TreeMap, boolean, boolean)
public boolean isTable(java.util.HashMap tableInfo)
tableInfo
- HashMap of table and column attributes, see getObjectMeta
.public java.lang.String buildCreateTableStatement(java.util.HashMap tableInfo, boolean doColDefault, boolean includeDroppedCols, java.lang.String dbstoragepartition, boolean specifyStorage)
tableInfo
- HashMap of table and column attributes, see getObjectMeta
.doColDefault
- True to include "default" info for the columns (if specified in tableCols),
else False to skip it.includeDroppedCols
- True to include columns whose "changed" attribute equals "R",
else False to exclude them.dbstoragepartition
- If this param is not null, the "create table" statment will specify the storageparition.
If this param is null, that clause will be omitted.specifyStorage
- True to include a storage clause. If True, the clause is
retrieved from tableInfo "$STORAGECLAUSE".buildCreateTableStatement(String, TreeMap, boolean, boolean, String, boolean, String)
public java.lang.String buildCreateTableStatement(java.lang.String tbname, java.util.TreeMap tableCols, boolean doColDefault, boolean includeDroppedCols, java.lang.String dbstoragepartition, boolean addRowstamp, java.lang.String storageClause)
buildCreateTableStatement
,
except this has a separate parameter for the table name and an indicator for adding rowstamp.
The statement will not include the "handle" columns used for DB2 text search.
The handle column is created via db2ts
(see enableRichTextSearch
).
tbname
- Table name.tableCols
- Column attributes, see getAttributeMeta
.doColDefault
- True to include "default" info for the columns (if specified in tableCols),
else False to skip it.includeDroppedCols
- True to include columns whose "changed" attribute equals "R",
else False to exclude them.dbstoragepartition
- If this param is not null, the "create table" statment will specify the storageparition.
If this param is null, that clause will be omitted.addRowstamp
- True if the rowstamp column should be included, else False.storageClause
- If non-null, this will be appended as the storage clause.buildColumnLine(java.util.HashMap, boolean, boolean)
,
isHandleColumn(java.lang.String, java.util.TreeMap)
public java.util.ArrayList<java.lang.String> buildCreateViewStatement(java.util.HashMap viewInfo, boolean includeDroppedCols, boolean forceDropStmt) throws java.sql.SQLException, java.lang.Exception
viewInfo
- HashMap of object, view, viewcolumn, and attributes, see getObjectMeta
.includeDroppedCols
- True to include attributes whose "changed" attribute equals "R",
else False to exclude them.forceDropStmt
- If non-Oracle and this is True, then a "drop view" statement will always be included
whether or not the view actually exists at the time this is run. If non-Oracle and this
is False, the "drop view" statement will be included only if the view actually exists.
Not relevant for Oracle.java.sql.SQLException
java.lang.Exception
getAttributeForMaxViewColumn(java.lang.String, java.util.HashMap, java.util.TreeMap)
,
toggleStringConcat(java.lang.String, java.lang.String, java.lang.String)
public java.util.HashMap getAttributeForMaxViewColumn(java.lang.String viewName, java.util.HashMap viewcolInfo, java.util.TreeMap distinctAttrs) throws java.lang.Exception
viewName
- The view name.viewcolInfo
- The entry from MaxViewColumn (or MaxViewColumnCfg)distinctAttrs
- The set of MaxAttribute (or MaxAttributeCfg) for this view.java.lang.Exception
public java.lang.String buildColumnLine(java.util.HashMap colInfo, boolean doDefault, boolean alter)
eqnum varchar2 (8) not null
buildColumnLine
with the "doNullClause" parameter True.
This is useful when building a "create table" or "alter table" statement.
colInfo
- The HashMap of attributes for one column, see getAttributeMeta
.doDefault
- True to include "default" value info, else False to skip it.alter
- True if altering the column,
False otherwise (such as for "create table" or adding the column).buildColumnLine(HashMap, boolean, boolean, boolean)
public java.lang.String buildColumnLine(java.util.HashMap colInfo, boolean doDefault, boolean doNullClause, boolean alter)
eqnum varchar2 (8) not null
This is useful when building a "create table" or "alter table" statement.
Note, if maxvar VARCHARMULTIPLE
is greater than 1 and this is
a varchar/varchar2 column, the native length will be a multiple of the
length specified in maxattribute.
Also, if maxvar USEVARGRAPHIC
is True and this is normally
a varchar/varchar2 column, the native datatype will be vargraphic.
colInfo
- The HashMap of attributes for one column, see getAttributeMeta
.doDefault
- True to include "default" value info, else False to skip it.doNullClause
- True to include the "not null" clause where needed, False to omit it.
This is used when we first need to create the columns, then assign a value, then
alter it to not allow nulls.alter
- True if altering the column,
False otherwise (such as for "create table" or adding the column).
(When altering the column, sometimes the null/notnull clause should be
omitted, even if "doNullClause" parameter is True, depending on the
platform.)getDefaultString(String,String,String,String,String,String,int,int,int,int,int,boolean,boolean)
public java.util.ArrayList<java.lang.String> buildDefaultDataStatement(java.lang.String tbname, java.util.TreeMap newTableCols, java.lang.String colNameList, java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> oldTableCols) throws java.lang.Exception
Programmer's note: If the logic in canAlterTable
changes, it may be necessary to change this method as well. For example, currently,
YORN columns default to N even if "nullwithdefault" is No. These two methods have
to be in synch.
tbname
- Table name to use in the update statementnewTableCols
- Column attributes to use to evaluate the column.
For a column to be included in the array, the "changed"
attribute must not equal "N".colNameList
- Can be null. If this parameter is not null, it should be
a comma-delimited list of column names, and a column name will
be included in the output only if it exists in both the
tableCols TreeMap and in the colNameList. If this parameter is null
then this comparison is not performed.
For building this list, see getColumnNames
and getColumnNamesNative
.oldTableCols
- Original column attributes to use to evaluate the column.
For a column to be included in the array, the "changed"
attribute must not equal "N".java.lang.Exception
buildDefaultDataStatement(String, HashMap, HashMap)
public java.lang.String buildDefaultDataStatement(java.lang.String tbname, java.util.HashMap newColInfo, java.util.HashMap oldColInfo) throws java.lang.Exception
If this is a non-nullable column (required = True) and no default value is specified, this method will assume default values in the following situations. (This is to support the upgrade.)
tbname
- Table name to use in the update statementnewColInfo
- Column attributes to use to evaluate the column.
For a statement to be generated, the column must
not allow nulls (required = True), must have nullwithdefault = True,
have a defaultvalue specified, and be persistent.oldColInfo
- Original column attributes to use to evaluate the column.java.lang.Exception
nativeTypesAreCompatible(java.lang.String, java.lang.String)
,
getDefaultString(String,String,String,String,String,String,int,int,int,int,int,boolean,boolean)
public java.util.ArrayList<java.lang.String> buildShortenStringStatement(java.lang.String tbname, java.util.TreeMap newTableCols, java.util.TreeMap oldTableCols) throws java.lang.Exception
tbname
- Table name to use in the update statementnewTableCols
- Column attributes to use to evaluate the column.
For a column to be included in the array, the "changed"
attribute must not equal "N", the new length must be less
than the old length, and the new and old datatypes must be
ALN, UPPER, LOWER, or GL.oldTableCols
- Original column attributes.java.lang.Exception
getColumnInfo(java.util.TreeMap, java.lang.String)
public java.util.ArrayList<java.lang.String> buildChangeCaseStatement(java.lang.String tbname, java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> oldCols, java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> newCols) throws java.lang.Exception
tbname
- Table on which to perform the conversion.oldCols
- Original columns and their attributes, in attributeno sequence.newCols
- New columns and their attributes, in attributeno sequence.java.lang.Exception
changeTreeKey(java.util.TreeMap<java.lang.String, java.util.HashMap<java.lang.String, java.lang.String>>, java.lang.String)
,
buildChangeCaseStatement(String, String, String, String)
public java.lang.String buildChangeCaseStatement(java.lang.String tbname, java.lang.String name, java.lang.String oldMaxtype, java.lang.String newMaxtype) throws java.lang.Exception
tbname
- Table on which to perform the conversion.name
- Name of the column to be converted.oldMaxtype
- Original maxtype of the column.newMaxtype
- New maxtype of the column.java.lang.Exception
public java.lang.String buildSelectStatement(java.lang.String tbname, java.util.TreeMap tableCols, boolean includeDroppedCols, boolean addRowstamp)
buildSelectStatement
with null for the colNameList parameter.
If you need a "where" clause, you can append it separately.
Besides being used for Select statements, this can be used with
buildInsertStatementPrefix
to create an Insert statement.
#buildSelectStatement(String, TreeMap, boolean, boolean, String)
public java.lang.String buildSelectStatement(java.lang.String tbname, java.util.TreeMap tableCols, boolean includeDroppedCols, boolean addRowstamp, boolean addTenantID)
buildSelectStatement
with null for the colNameList parameter.
If you need a "where" clause, you can append it separately.
Besides being used for Select statements, this can be used with
buildInsertStatementPrefix
to create an Insert statement.
#buildSelectStatement(String, TreeMap, boolean, boolean, String)
public java.lang.String buildSelectStatement(java.lang.String tbname, java.util.TreeMap tableCols, boolean includeDroppedCols, boolean addRowstamp, boolean addtenantID, java.lang.String colNameList)
If you need a "where" clause, you can append it separately.
Besides being used for Select statements, this can be used with
buildInsertStatementPrefix
to create an Insert statement.
tbname
- Table name (must be persistent).tableCols
- Column info, see getAttributeMeta
.includeDroppedCols
- True to include columns whose "changed" attribute equals "R",
else False to exclude them.addRowstamp
- True if the rowstamp column should be included in the statement, else False.colNameList
- Can be null. If this parameter is not null, it should be
a comma-delimited list of column names, and a column name will
be included in the output string only if it exists in both the
tableCols TreeMap and in the colNameList. If this parameter is null
then this comparison is not performed.
For building this list, see getColumnNames
and getColumnNamesNative
.public java.lang.String buildSelectStatementForRestore(java.lang.String tempTbName, java.util.TreeMap newTableCols, boolean addRowstamp, java.lang.String colNameList, boolean doLineBreaks) throws java.lang.Exception, java.sql.SQLException
If you need a "where" clause, you can append it separately.
Besides being used for Select statements, this can be used with
buildInsertStatementPrefix
to create an Insert statement.
tempTbName
- Table name (must be persistent). This is the name of the table containing the data
to be copied to the new base table; for example, XXTOOL.newTableCols
- Column info for new base table, see getAttributeMeta
.addRowstamp
- True if the rowstamp column should be included in the statement, else False.colNameList
- Can be null. If this parameter is not null, it should be
a comma-delimited list of column names, and a column name will
be included in the output string only if it exists in both the
tableCols TreeMap and in the colNameList. If this parameter is null
then this comparison is not performed.
For building this list, see getColumnNames
and getColumnNamesNative
.doLineBreaks
- If true, a line break will be inserted after every 5 column names.java.lang.Exception
java.sql.SQLException
getNativeTypeForColumn(java.lang.String, java.lang.String)
,
getNativeType(java.lang.String, java.lang.String, int)
,
nullValueExists(java.lang.String, java.lang.String)
,
explicitConversionSupported(java.lang.String, java.lang.String)
,
getSqlServerConvertString(java.lang.String, java.lang.String, java.util.HashMap)
,
getOracleConvertString(java.lang.String, java.lang.String, java.lang.String)
,
getDB2ConvertString(java.lang.String, java.lang.String, java.lang.String)
,
getDefaultString(String,HashMap)
,
nativeTypesAreCompatible(java.lang.String, java.lang.String)
public java.lang.String getDefaultString(java.lang.String tbname, java.util.HashMap colInfo) throws java.lang.Exception
Also see getSqlServerConvertString
,
getOracleConvertString
, and
getDB2ConvertString
.
tbname
- Table namecolInfo
- from getAttributeMetajava.lang.Exception
getDefaultString(String, String, String, String, String)
public java.lang.String getDefaultString(java.lang.String tbname, java.lang.String colName, java.lang.String maxtype, java.lang.String metaDefaultValue, java.lang.String domainid) throws java.lang.Exception
tbname
- Table namecolName
- Column namemaxtype
- Value of maxattribute(cfg) maxtype.metaDefaultValue
- Value of maxattribute(cfg) defaultvalue.domainid
- Value of maxattribute(cfg) domainid.java.lang.Exception
getDefaultString(String,String,String,String,String,String,int,int,int,int,int,boolean,boolean)
public java.lang.String getDefaultString(java.lang.String tbname, java.lang.String colName, java.lang.String maxtype, java.lang.String metaDefaultValue, java.lang.String domainid, java.lang.String sequenceName, int uidRule, int seqRule, int autoRule, int mboRule, int appRule, boolean outputQuotes, boolean assignIfNoMeta) throws java.lang.Exception
tbname
- Table namecolName
- Column namemaxtype
- Value of maxattribute(cfg) maxtype.metaDefaultValue
- Value of maxattribute(cfg) defaultvalue.domainid
- Value of maxattribute(cfg) domainid.sequenceName
- Sequence name. If null, method will try to select from maxsequence.uidRule
- For &UNIQUEID& -- 1 = skip , 2 = 0, 3 = nextvalseqRule
- For &SEQUENCE& -- 1 = skip , 2 = 0, 3 = nextval.autoRule
- For &AUTOKEY& -- 1 = skip , 2 = 0mboRule
- For &OWNER& and &MBONAME& -- 1 = skip , 2 = "MBO"appRule
- For &APPNAME& -- 1 = skip , 2 = "STARTCNTR"outputQuotes
- True will surround output string with single quotes, if alphanumeric datatype.
Otherwise, no quotes are added.assignIfNoMeta
- If true and metaDefaultValue is null, then numeric fields will default to 0
and date fields will default to sysdate. Otherwise no default will be assigned.java.lang.Exception
public boolean isSpecialDefaultValue(java.lang.String value) throws java.lang.Exception
value
- java.lang.Exception
public java.lang.String getOracleConvertString(java.lang.String oldNativeType, java.lang.String newNativeType, java.lang.String colName) throws java.lang.Exception
Also see implicitConversionSupported
.
oldNativeType
- newNativeType
- colName
- java.lang.Exception
public java.lang.String getSqlServerConvertString(java.lang.String oldTbname, java.lang.String newTbname, java.util.HashMap newColInfo) throws java.lang.Exception
Also see implicitConversionSupported
and
explicitConversionSupported
.
oldTbname
- Old table name we are copying data from. This table must exist.newTbname
- New table name we are copying data to. This table must exist.newColInfo
- Metadata for the column on the new tablejava.lang.Exception
public java.lang.String getDB2ConvertString(java.lang.String oldNativeType, java.lang.String newNativeType, java.lang.String colName) throws java.lang.Exception
Also see implicitConversionSupported
and
explicitConversionSupported
.
oldNativeType
- newNativeType
- colName
- java.lang.Exception
public boolean nativeTypesAreCompatible(java.lang.String oldNativeType, java.lang.String newNativeType) throws java.lang.Exception
oldNativeType
- Old native datatypenewNativeType
- New native datatypejava.lang.Exception
public java.lang.String buildInsertStatementPrefix(java.lang.String tbname, java.util.TreeMap tableCols, boolean doRowstamp, boolean includeDroppedCols) throws java.sql.SQLException
buildInsertStatementPrefix
with null value for the colNameList parameter.
This can be used with buildSelectStatement
,
buildInsertValuesStatement
, etc. to create a
complete Insert statement.
java.sql.SQLException
buildInsertStatementPrefix(String, TreeMap, boolean, boolean, String, boolean )
public java.lang.String buildInsertStatementPrefix(java.lang.String tbname, java.util.TreeMap tableCols, boolean doRowstamp, boolean includeDroppedCols, java.lang.String colNameList, boolean doLineBreaks) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String buildInsertStatementPrefix(java.lang.String tbname, java.util.TreeMap tableCols, boolean doRowstamp, boolean includeDroppedCols, java.lang.String colNameList, boolean doLineBreaks, boolean addTenantid) throws java.sql.SQLException
This can be used with buildSelectStatement
,
buildConvertSelectStatement
,
buildInsertValuesStatement
, etc. to create a
complete Insert statement.
tbname
- Table name (must be persistent).tableCols
- Column info, see getAttributeMeta
.doRowstamp
- True to include the rowstamp in the statement.includeDroppedCols
- True to include columns whose "changed" attribute equals "R",
else False to exclude them.colNameList
- Can be null. If this parameter is not null, it should be
a comma-delimited list of column names, and a column name will
be included in the output string only if it exists in both the
tableCols TreeMap and in the colNameList. If this parameter is null
then this comparison is not performed.
For building this list, see getColumnNames
and getColumnNamesNative
.doLineBreaks
- If true, a line break will be inserted after every 5 column names.java.sql.SQLException
public java.util.TreeMap buildInsertValuesStatement(java.lang.String prefix, java.sql.ResultSet rs, java.util.TreeMap tableCols, boolean includeDroppedCols, java.lang.String rowstampValue) throws java.sql.SQLException
java.sql.SQLException
buildInsertValuesStatement(String, ResultSet, TreeMap, boolean, String, boolean)
public java.util.TreeMap<java.lang.Integer,java.lang.String> buildInsertValuesStatement(java.lang.String prefix, java.sql.ResultSet rs, java.util.TreeMap tableCols, boolean includeDroppedCols, java.lang.String rowstampValue, boolean psFormat) throws java.sql.SQLException
For an example of how this can be used, see writeDumpTable
.
Any encrypted datatypes (such as password) will be set to a foobar value, as encrypted data cannot be output to a print file.
prefix
- "insert into" part of the statement, see buildInsertStatementPrefix
.rs
- ResultSet, where you have already called "next" to get a row.
It is presumed that the Select statement specified the column names in the
same sequence as tableCols.
See buildSelectStatement
.tableCols
- Column info, see getAttributeMeta
.
These must be in the same sequence as the columns listed in the prefix,
presumed to be in sequence by attributeno.includeDroppedCols
- True to include columns whose "changed" attribute equals "R",
else False to exclude them.rowstampValue
- String to specify in the statement for rowstamp value
(for example, maxseq.nextval
or '12345'
).
If no rowstamp should be included, this should be null.psFormat
- If true, output will support use of PreparedStatement in Maxinst.
If false, output will be normal string format for use in a Sql statement.java.sql.SQLException
useQuotes(java.lang.String)
,
singleToDoubleQuotes(java.lang.String)
,
getChunkUpdates(java.lang.String, int, java.lang.String, java.lang.String, java.sql.ResultSet, java.lang.Object)
public java.util.TreeMap<java.lang.Integer,java.lang.String> buildInsertValuesStatement(java.lang.String prefix, java.sql.ResultSet rs, java.util.TreeMap tableCols, boolean includeDroppedCols, java.lang.String rowstampValue, boolean psFormat, java.util.Map<java.lang.String,java.lang.String> allSeq) throws java.sql.SQLException
java.sql.SQLException
public java.util.TreeMap<java.lang.Integer,java.lang.String> buildInsertValuesStatement(java.lang.String prefix, java.sql.ResultSet rs, java.util.TreeMap tableCols, boolean includeDroppedCols, java.lang.String rowstampValue, boolean psFormat, java.util.Map<java.lang.String,java.lang.String> allSeq, int tenantid) throws java.sql.SQLException
For an example of how this can be used, see writeDumpTable
.
Any encrypted datatypes (such as password) will be set to a foobar value, as encrypted data cannot be output to a print file.
prefix
- "insert into" part of the statement, see buildInsertStatementPrefix
.rs
- ResultSet, where you have already called "next" to get a row.
It is presumed that the Select statement specified the column names in the
same sequence as tableCols.
See buildSelectStatement
.tableCols
- Column info, see getAttributeMeta
.
These must be in the same sequence as the columns listed in the prefix,
presumed to be in sequence by attributeno.includeDroppedCols
- True to include columns whose "changed" attribute equals "R",
else False to exclude them.rowstampValue
- String to specify in the statement for rowstamp value
(for example, maxseq.nextval
or '12345'
).
If no rowstamp should be included, this should be null.psFormat
- If true, output will support use of PreparedStatement in Maxinst.
If false, output will be normal string format for use in a Sql statement.java.sql.SQLException
useQuotes(java.lang.String)
,
singleToDoubleQuotes(java.lang.String)
,
getChunkUpdates(java.lang.String, int, java.lang.String, java.lang.String, java.sql.ResultSet, java.lang.Object)
public java.util.TreeMap<java.lang.String,java.lang.String> getKeyColumns(java.util.TreeMap indexMeta, java.util.TreeMap tableCols, java.lang.String indexToSkip) throws java.lang.Exception
indexMeta
- The indexes on this table. Can be null, if tableCols is provided.tableCols
- The columns on this table. Can be null, if indexMeta is provided.indexToSkip
- Normally this param should be null. If this is non-null, then the
index named by this param will NOT be included in the output, unless no other
unique indexes are found, and the param index is identified by primarykeycolseq,
and tableCols param was provided.
This param can be used when the table has more than one unique index, and you
do not want one of them (for example, if it's the index for uniquecolumnname).
You can find the index to be skipped by calling
nativeIndexExistsForColumns
.java.lang.Exception
public java.lang.String getColumnNames(java.util.TreeMap tableCols, boolean doLineBreaks, boolean includeDroppedCols)
getColumnNames
with the colNameList parameter null, and the useAlias parameter False.public java.lang.String getColumnNames(java.util.TreeMap tableCols, boolean doLineBreaks, boolean includeDroppedCols, java.lang.String colNameList, boolean useAlias)
colNameList
parameter in
buildDefaultDataStatement
,
buildSelectStatement
,
buildInsertStatementPrefix
, and for this
very method.
This method will NOT output columns that are "handle" columns used for DB2 text search.
These columns must be created via db2ts
(see enableRichTextSearch
).
tableCols
- Column attributes, see getAttributeMeta
.doLineBreaks
- If true, a line break will be inserted after every 5 column names.includeDroppedCols
- True to include columns whose "changed" attribute equals "R",
else False to exclude them.colNameList
- Can be null. If this parameter is not null, it should be
a comma-delimited list of column names, and a column name will
be included in the output string only if it exists in both the
tableCols TreeMap and in the colNameList. If this parameter is null
then this comparison is not performed.
For building this list, see getColumnNames
and getColumnNamesNative
.useAlias
- If True, use the alias name (colalias).
If False, use the regular column name.isHandleColumn(java.lang.String, java.util.TreeMap)
public void processTemplateData(int toTenantid, boolean delete, java.lang.String maxUserGroup, java.lang.String allUserGroup, java.lang.String newUserGroup, java.io.PrintStream out) throws java.lang.Exception
tenantid
- tenant Idjava.lang.Exception
public void copyData(java.lang.String tabName, java.lang.String uniqueColumn, int toTenantid, int storageType, boolean delete, java.io.PrintStream out) throws java.lang.Exception
tenantid
- tenant IdtabName
- Table Namejava.lang.Exception
public void updateGroupName(java.lang.String tabName, java.lang.String maxUserGroup, java.lang.String allUserGroup, java.lang.String newUserGroup, int toTenantid) throws java.lang.Exception
tenantid
- tenant IdtabName
- Table Namejava.lang.Exception
public java.lang.String getColumnNamesNative(java.lang.String tbname) throws java.sql.SQLException
getColumnNames
.tbname
- Table namejava.sql.SQLException
public java.util.HashMap getColumnInfo(java.util.TreeMap tableCols, java.lang.String name)
tableCols
- The columns on this table, keyed by attributeno.
It will also work if sorted by columnname, but in that scenario it would not
be necessary to use this method, as you could simply retrieve the entry using
the key.name
- The column name to search for.public java.lang.String getAddRowstampSql(java.lang.String tbname) throws java.lang.Exception
tbname
- Table namejava.lang.Exception
public java.util.ArrayList<java.lang.String> getRowstampTriggerSql(java.lang.String tbname, boolean dropIfExists) throws java.lang.Exception
For Oracle, the trigger name is tbname + "_T". For DB2, the trigger names are tbname + "_T" and tbname + "_U".
tbname
- Table namedropIfExists
- If this is DB2 and this param is True, then if the trigger exists,
a "drop trigger" will be included in the output before the create. Otherwise,
the output does not include a "drop trigger" statement.java.lang.Exception
public java.util.ArrayList<java.lang.String> getRowstampTriggerSql(java.lang.String tbname, boolean dropIfExists, boolean makeSecure) throws java.lang.Exception
For Oracle, the trigger name is tbname + "_T". For DB2, the trigger names are tbname + "_T" and tbname + "_U".
tbname
- Table namedropIfExists
- If this is DB2 and this param is True, then if the trigger exists,
a "drop trigger" will be included in the output before the create. Otherwise,
the output does not include a "drop trigger" statement.java.lang.Exception
public java.lang.String getTrigRoot(java.lang.String tbname) throws java.lang.Exception
tbname
- The name of the table.java.lang.Exception
public java.util.ArrayList<java.lang.String> buildGrants(java.lang.String tbname, boolean outputSchema, boolean maxusersOnly) throws java.lang.Exception
tbname
- Table nameoutputSchema
- True if the schema owner should be specified in the output Sql.
False to omit the schema owner.maxusersOnly
- True to include only those native users who are also Maximo users.
False to include all native users, whether or not authorized for Maximo.java.lang.Exception
public java.util.HashMap<java.lang.String,int[]> getGrants(java.lang.String username, java.lang.String entityname) throws java.lang.Exception
username
- User Name on native database (databaseuserid).entityname
- Table or view name, if only one is to be queried.
If this is null then all maximo entities will be queried.java.lang.Exception
public java.lang.String getGrantSql(java.lang.String dbUserID, java.lang.String entityname, java.lang.String privilege, boolean grant) throws java.lang.Exception
dbUserID
- User Name on the native database (databaseuserid).entityname
- Table or view name.privilege
- READ, INSERT, UPDATE, or DELETEgrant
- True to grant, False to revokejava.lang.Exception
public java.util.ArrayList<java.lang.String> getTriggerNames(java.lang.String tbname, boolean getEnabled, boolean getDisabled, boolean includeRowstamp) throws java.lang.Exception
tbname
- Table namegetEnabled
- True to get enabled triggers, False to not get them.getDisabled
- True to get disabled triggers, False to not get them.includeRowstamp
- True to include the Maximo rowstamp trigger in the output
(if it exists and satisfies the other parameters), else False.
Does not pertain to SqlServer.java.lang.Exception
public java.lang.String getEnableTriggerStatement(java.lang.String triggerName, java.lang.String tbname) throws java.lang.Exception
triggerName
- The name of the trigger to be enabled.tbname
- The table name for this trigger. This is required only for SqlServer.java.lang.Exception
public java.lang.String getDisableTriggerStatement(java.lang.String triggerName, java.lang.String tbname) throws java.lang.Exception
triggerName
- The name of the trigger to be disabled.tbname
- The table name for this trigger. This is required only for SqlServer.java.lang.Exception
public java.lang.String getEnableDisableTriggersAll(java.lang.String tbname, boolean enable) throws java.lang.Exception
tbname
- Table nameenable
- True for enable all triggers, False for disable all triggers.java.lang.Exception
public java.util.ArrayList<java.lang.String> changeAmountFormat(int newLength, int newScale) throws java.lang.Exception
AMOUNT
.
newLength
- New length for amount fields (value for maxvar AMTLENGTH
).newScale
- New scale for amount fields (value for maxvar AMTSCALE
).java.lang.Exception
public boolean isRichTextSupported(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
Depending on the input parameters, this method will check for the following:
Oracle databases always support rich text, thus check #1 above will always return True for Oracle.
tbname
- Table name (optional). See above for usage.name
- Column name (optional). See above for usage.java.lang.Exception
public boolean isHandleColumn(java.lang.String colName, java.util.TreeMap attrs)
colName
- The coumn name to search forattrs
- All the columns on the table ("$MAXATTRIBUTES").public java.util.ArrayList<java.lang.String> enableRichTextSearch(java.util.HashMap objInfo, java.util.TreeMap tbIndexes, boolean doCheck, boolean skipDb2Connect) throws java.lang.Exception
objInfo
- Attributes for the object/table and its columns.
See getObjectMeta
.tbIndexes
- Index metadata for this table. Can be null.
Used for Oracle to get the index name for a text-enabled column.
If this is not provided, we will create an index.doCheck
- Input to activateRichTextSearch
.skipDb2Connect
- Do not print "db2ts connect" and "db2ts quit" statements.
This param is true only for Unlcvt when outputting in DB2 format.java.lang.Exception
enableRichTextSearch(String, String, String, HashMap, boolean)
,
activateRichTextSearch(java.util.ArrayList<java.lang.String>, java.lang.String, boolean)
public java.util.ArrayList<java.lang.String> enableRichTextSearch(java.lang.String tbname, java.lang.String colName, java.lang.String handleColName, java.util.HashMap ixInfo, boolean skipCreateUniqueIndex) throws java.lang.Exception
enableRichTextSearch
with last param (startIxNum) = 1.java.lang.Exception
enableRichTextSearch(String, String, String, HashMap, boolean, int)
public java.util.ArrayList<java.lang.String> enableRichTextSearch(java.lang.String tbname, java.lang.String colName, java.lang.String handleColName, java.util.HashMap ixInfo, boolean skipCreateUniqueIndex, int startIxNum) throws java.lang.Exception
java.lang.Exception
enableRichTextSearch(String, String, String, HashMap, boolean, int, boolean)
public java.lang.String getDB2TextIndexSpace()
public java.util.ArrayList<java.lang.String> enableRichTextSearch(java.lang.String tbname, java.lang.String colName, java.lang.String handleColName, java.util.HashMap ixInfo, boolean skipCreateUniqueIndex, int startIxNum, boolean skipDb2Connect) throws java.lang.Exception
This assumes that rich text searching is already enabled for the database as a whole (where needed). See comments printed at the header of the Unlcvt output for how to enable the database for text search. Enabling the database need be done only once.
For DB2, after you are done running this method for one or more tables, you should then call
db2textAlterIndexes
.
tbname
- Table namecolName
- Column namehandleColName
- Handle column name (used only for DB2)ixInfo
- Index info, used for index name and storage clause in Oracle.
Can be null, in which case we will assign a new index name and omit the storage clause.skipCreateUniqueIndex
- True if the calling method is looping and an earlier iteration of this method
has already issued a "create unique index" statement. This will prevent later iterations of this method
from issuing a duplicate statement.startIxNum
- The index number to start when getting a new index name from getNewIndexName
.skipDb2Connect
- Do not print "db2ts connect" and "db2ts quit" statements.
This param is true only for Unlcvt when outputting in DB2 format.java.lang.Exception
isRichTextSupported(java.lang.String, java.lang.String)
,
#getRichTextCreateIndexStatement
,
getNextSequenceValueForSqlServer(java.lang.String)
public boolean isRTSupportedForDB() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> revalidateTextSearchIndexes(java.lang.String tbname) throws java.lang.Exception
tbname
- java.lang.Exception
public boolean isReorgPending(java.lang.String tbname) throws java.lang.Exception
tbname
- java.lang.Exception
public java.util.ArrayList<java.lang.String> reorgTable(java.lang.String tbname, boolean redoTriggers) throws java.lang.Exception
tbname
- redoTriggers
- java.lang.Exception
getRowstampTriggerSql(java.lang.String, boolean)
,
revalidateTextSearchIndexes(java.lang.String)
public java.util.ArrayList<java.lang.String> db2textAlterIndexes() throws java.lang.Exception
java.lang.Exception
db2textAlterIndexes(boolean)
public java.util.ArrayList<java.lang.String> db2textAlterIndexes(boolean updateNow) throws java.lang.Exception
enableRichTextSearch
and return array of "db2ts alter index" statements specifying Update Frequency.updateNow
- True when called from Maxinst and we need to do an initial update.java.lang.Exception
public java.util.ArrayList<java.lang.String> activateRichTextSearch(java.util.ArrayList<java.lang.String> list, java.lang.String tbname, boolean doCheck) throws java.lang.Exception
list
- The ArrayList to be appended totbname
- The table namedoCheck
- Indicates whether to include statements to start change tracking and start
background updates, based on whether they are already in effect.
If this param is False then these statements are always included.
If this param is True then we check first before including them.java.lang.Exception
public java.util.ArrayList<java.lang.String> disableRichTextSearch(java.lang.String tbname, java.lang.String colName, java.lang.String handleColName) throws java.lang.Exception
tbname
- Table namecolName
- Column namehandleColName
- Handle column name (used only for DB2)java.lang.Exception
isRichTextSupported(java.lang.String, java.lang.String)
public java.util.HashMap getTextSearchIndexForColumn(java.lang.String tbname, java.lang.String colName, java.util.TreeMap tbIndexes) throws java.lang.Exception
tbname
- Table namecolName
- Column nametbIndexes
- Index metadata for this table. If null, this method will retrieve from database.java.lang.Exception
public java.lang.String getRenameTableStatement(java.lang.String oldTbname, java.lang.String newTbname) throws java.lang.Exception
oldTbname
- The original table name.newTbname
- The new table name.java.lang.Exception
public java.util.ArrayList getDropStatisticsStatementsForConfig(java.lang.String entityname) throws java.lang.Exception
entityname
- If entityname is specified, drop statements will be retrieved
only for that entity. Otherwise they will get retrieved for all entities/columns
with pending changes. Statistics for column that are not pending configuration
will not be affected (unless they also pertain to an affected column).java.lang.Exception
getDropStatisticsStatements(java.lang.String, java.lang.String)
public java.util.ArrayList<java.lang.String> getDropStatisticsStatements(java.lang.String tbname, java.lang.String colname) throws java.lang.Exception
tbname
- The table name for which to drop statistics. This cannot be null.colname
- The column name for which to drop statistics.
If null, will drop statistics pertaining to all columns on the specified table.java.lang.Exception
public boolean canAnalyzeTable() throws java.lang.Exception
getAnalyzeTableStatement
would normally return anything.
This is used when determining whether the corresponding menu option in the Config
UI should be enabled (optionname ANALYZE
, Update Table Statistics).getAnalyzeTableStatement
is applicable to this db platform, else False. Currently, this is supported
only for Oracle.java.lang.Exception
public java.util.ArrayList<java.lang.String> getAnalyzeTableStatement(java.lang.String tbname) throws java.lang.Exception
ANALYZE
(Update Table Statistics).tbname
- Table name (optional). If not provided, this outputs a statement
for each persistent Maximo table. Otherwise, analyzes only the specified table.java.lang.Exception
public java.util.ArrayList<java.lang.String> getDisallowPageLocks() throws java.lang.Exception
sp_indexoption
).
If not SqlServer, this will be empty.java.lang.Exception
public boolean lockMaximoTables(java.lang.String tbname, boolean lock) throws java.lang.Exception
Oracle and DB2 tables remain locked until a Commit or Rollback. Thus, if the program does interim commits, you may have to re-lock for Oracle. SqlServer tables remain locked until the lock is explicitly released or the session is terminated.
The method mxServerIsUp
can be used to
determine whether MXServer is up.
tbname
- The table name (optional). If provided, lock/unlock only the specified
table, else do all persistent Maximo tables.lock
- True to lock, False to unlock.
(False is not allowed for Oracle or DB2. To release locks for these platforms,
issue a Commit or Rollback.)java.lang.Exception
public boolean isObjectLocked(java.lang.String entityname) throws java.lang.Exception
java.lang.Exception
public boolean isReservedWord(java.lang.String testWord) throws java.lang.Exception
testWord
- The word to be testedjava.lang.Exception
public java.util.ArrayList<java.lang.String> getAttributeRefresh() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getAttributeRefresh(int tenantId, boolean mtEnabled, java.lang.String objectName) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getAttributeCfgRefresh() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getAttributeCfgRefresh(int tenantId, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewColumnRefresh() throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewColumnRefresh(int tenantId, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewColumnCfgRefresh() throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewColumnCfgRefresh(int tenantId, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
public java.lang.String getTableRefresh() throws java.lang.Exception
java.lang.Exception
public java.lang.String getTableRefresh(int tenantId, boolean mtEnabled, java.lang.String tableName) throws java.lang.Exception
java.lang.Exception
public java.lang.String getTableCfgRefresh() throws java.lang.Exception
java.lang.Exception
public java.lang.String getTableCfgRefresh(int tenantId, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewRefresh() throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewRefresh(int tenantId, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewCfgRefresh() throws java.lang.Exception
java.lang.Exception
public java.lang.String getViewCfgRefresh(int tenantId, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> deleteObjectDelta(int tenantId) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getObjectRefresh() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getObjectRefresh(int tenantId, boolean mtEnabled, java.lang.String objectName) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getObjectCfgRefresh() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getObjectCfgRefresh(int tenantId, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getSysIndexRefresh(java.lang.String tbname, java.lang.String ixname) throws java.lang.Exception
adjustPrimaryKeyColSeq
to do so).
If this is Oracle, then immediately after executing the returned array,
call fixMetadataForDescendingKeys
and execute its returned array so that descending keys are accurately specified
in Maximo metadata.
tbname
- The table name (optional). If provided, the index metadata is
rebuilt only for the specified table. If the tbname and ixname
parameters are both null, the index metadata
is rebuilt for ALL the persistent Maximo tables.ixname
- The index name (optional). If provided, the index metadata is
rebuilt only for the specified index.java.lang.Exception
descendingIndexesSupported()
,
getNextSequenceValueForSqlServer(java.lang.String)
,
fixMetadataForDescendingKeys(java.lang.String, java.lang.String)
public java.util.List<java.lang.String> updateIndexRequired()
This method is used for all versions Merlin and later.
public boolean longIndexNamesExist(java.lang.String tbname) throws java.lang.Exception
tbname
- Tablename (optional). Null to check all tables that are defined in maxtable.java.lang.Exception
public boolean dupIndexNamesExist(java.lang.String tbname, java.lang.String ixname) throws java.lang.Exception
tbname
- Table name if only one table name is to be checked.
If null, all tables will be checked.ixname
- Index name if only one index name is to be checked.
If null, all index names will be checked.java.lang.Exception
public boolean descendingIndexesSupported() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getPartitionRefresh() throws java.lang.Exception
java.lang.Exception
public int getOracleVersion() throws java.lang.Exception
dbIn
is Oracle, this method returns the first part of the database
version (8, 9, etc.). For example, if the database version is 9.0.1.1.1, this method
will return 9.java.lang.Exception
public double getOracleVersion(boolean getPoint) throws java.lang.Exception
dbIn
is Oracle, this method returns the database version.getPoint
- If true, will return the first and second parts of the database version.
For example, database version 10.2.0.1.0 will return 10.2 when this is True.
If false, will return only the integer portion; for example, database version
10.2.0.1.0 will return 10 when this is False.java.lang.Exception
public int getDB2Version() throws java.lang.Exception
dbIn
is DB2, this method returns the first part of the database
version (8, 9, etc.). For example, if the database version is 9.1, this method
will return 9.java.lang.Exception
public double getDB2Version(boolean getPoint) throws java.lang.Exception
dbIn
is DB2, this method returns the database version.getPoint
- If true, will return the first and second parts of the database version.
For example, database version 9.1. will return 9.1 when this is True.
If false, will return only the integer portion; for example, database version
9.1 will return 9 when this is False.java.lang.Exception
public int getSqlServerVersion() throws java.lang.Exception
dbIn
is SqlServer, this method returns the first part of the database
version (8, 9, etc.). For example, if the database version is 9.00.3054.00, this method
will return 9.
For SqlServer 2000, version is 8, and for SqlServer 2005, version is 9.
Also see getSqlServerCompatLevel
.
java.lang.Exception
public double getSqlServerVersion(boolean getPoint) throws java.lang.Exception
dbIn
is SqlServer, this method returns the database version.
Also see getSqlServerCompatLevel
.getPoint
- If true, will return the first and second parts of the database version.
For example, if the database version is 9.02.3054.00, this method
will return 9.02.
If false, will return only the integer portionjava.lang.Exception
public int getSqlServerCompatLevel() throws java.lang.Exception
dbIn
is SqlServer, this method returns the database compatibility level.
Also see getSqlServerVersion
.java.lang.Exception
public java.util.ArrayList<java.lang.String> getUpdateStatistics(java.util.TreeMap tableMap, java.util.TreeMap indexMap) throws java.lang.Exception
STATISTICS
(Update Index Statistics).
Important note re: Oracle: To run these under jdbc, you need to create a CallableStatement
and separately identify each parameter. Therefore, you cannot simply run these statements
via Statement execute. See updateStatistics
.
tableMap
- TreeMap of object metata, for Oracle. (Null or empty for SqlServer.)indexMap
- TreeMap of index metadata for SqlServer. (Null or empty for Oracle.)java.lang.Exception
nativeIndexExists(java.lang.String, java.lang.String)
public java.util.ArrayList<java.lang.String> getRemoveChanges() throws java.lang.Exception
java.lang.Exception
getTableCfgRefresh()
,
getAttributeCfgRefresh()
,
getIndexMeta(java.lang.String, boolean)
,
nativeIndexExists(java.lang.String, java.lang.String)
,
getSysIndexRefresh(java.lang.String, java.lang.String)
,
fixMetadataForDescendingKeys(java.lang.String, java.lang.String)
public java.util.ArrayList<java.lang.String> getRemoveTenantChanges(int tenantid, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
getTableCfgRefresh()
,
getAttributeCfgRefresh()
,
getIndexMeta(java.lang.String, boolean)
,
nativeIndexExists(java.lang.String, java.lang.String)
,
getSysIndexRefresh(java.lang.String, java.lang.String)
,
fixMetadataForDescendingKeys(java.lang.String, java.lang.String)
public java.util.ArrayList<java.lang.String> getApplyTenantChanges(int tenantid, boolean mtEnabled) throws java.lang.Exception
java.lang.Exception
getTableCfgRefresh()
,
getAttributeCfgRefresh()
,
getIndexMeta(java.lang.String, boolean)
,
nativeIndexExists(java.lang.String, java.lang.String)
,
getSysIndexRefresh(java.lang.String, java.lang.String)
,
fixMetadataForDescendingKeys(java.lang.String, java.lang.String)
public java.util.ArrayList<java.lang.String> objAttrDelRefresh(int tenantid, boolean mtEnabled)
public java.util.ArrayList<java.lang.String> attrRefresh(int tenantid, boolean mtEnabled) throws java.lang.Exception
upgradeCallout
is called in the following place:
("refreshAttributes", null, null)
tenantid
- mtEnabled
- java.lang.Exception
public java.util.ArrayList<java.lang.String> renumberAttributeNumber(java.lang.String objectname, java.util.TreeMap attrs) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> renumberExtAttributeNumber(java.lang.String objectname, java.util.Map extTables, int start, java.util.ArrayList<java.lang.String> sqlList) throws MXException
MXException
public java.util.TreeMap<java.lang.String,java.lang.String> getPrimaryKeys(java.lang.String objname, boolean getCfg) throws java.lang.Exception
java.lang.Exception
public boolean indexMetaExistsForPrikeycolseq(java.lang.String objname, java.lang.String tbname, boolean getCfg) throws java.lang.Exception
This method is used in ConfigDB when creating a new table so that when the index is specified by both primarykeycolseq and by the index metadata, the index is created only once, using the index metadata. (The metadata takes priority because it includes the index name.)
objname
- Object nametbname
- Table namegetCfg
- If true, gets column metadata from the configuration table
(maxattributecfg), else gets from maxattribute.java.lang.Exception
public java.lang.String buildIndexStatement(java.lang.String tbname, java.util.TreeMap tableCols, java.lang.String dbstoragepartition) throws java.lang.Exception
tbname
- Table nametableCols
- TreeMap of columns for the specified tabledbstoragepartition
- The storage partition on which to create the index.
If this is not provided, that clause will be omitted from the statement.java.lang.Exception
public java.lang.String buildIndexStatement(java.util.HashMap ixInfo, boolean specifySchema, boolean specifyStorage) throws java.lang.Exception
ixInfo
- Metadata from maxsysindexes and maxsyskeys, for one index.
This can be derived from the TreeMap from getIndexMeta
.specifySchema
- True to specify the schema or tablespace, False to omit it.
If True, this method will use the value identified in the HashMap ixInfo.
If this is a SqlServer clustered index, the index's schema should equal the
table's schema. This method does not verify whether the maxsysindexes value
of storagepartition is valid.specifyStorage
- True to include a storage clause. If True, the clause is
retrieved from ixInfo "$STORAGECLAUSE".java.lang.Exception
descendingIndexesSupported()
public java.util.ArrayList<java.lang.String> rebuildIndexes(java.util.TreeMap indexMeta, boolean alwaysDrop, boolean neverDrop, boolean specifySchema, boolean specifyStorage) throws java.lang.Exception
indexMeta
- Index metadata, from getIndexMeta
.alwaysDrop
- True to always include the "drop index" statement,
False to include it only if the native index exists.neverDrop
- True to NEVER include the "drop index" statement.specifySchema
- True to specify the schema or tablespace in the "create index" statement.
False to omit it.specifyStorage
- True to specify the storage clause, False to omit it.java.lang.Exception
nativeIndexExists(java.lang.String, java.lang.String)
,
buildIndexStatement(HashMap, boolean, boolean)
public java.util.ArrayList<java.lang.String> adjustPrimaryKeyColSeq(java.util.TreeMap indexMeta) throws java.lang.Exception
indexMeta
- The index metadata for all the indexes being changed.
This can be for one or more tables.java.lang.Exception
indexMetaExistsForPrikeycolseq(java.lang.String, java.lang.String, boolean)
,
getIndexMeta(java.lang.String, boolean)
,
getKeyColumns(java.util.TreeMap, java.util.TreeMap, java.lang.String)
public java.util.ArrayList<java.lang.String> buildSequences(java.util.HashSet sequences, boolean doMaxseq) throws java.lang.Exception
sequences
- HashSet of sequences to be built.
Entry is string array of sequenceName, tbName, columnName.doMaxseq
- True to update the "maxseq" sequence (it will not be in the HashSet).
False to do only what's specified in the HashSet.java.lang.Exception
getMaxEAuditTransID()
public java.util.ArrayList<java.lang.String> buildSequences(java.util.HashSet sequences, java.util.Map<java.lang.String,java.lang.Long> alreadyDone, boolean doMaxseq) throws java.lang.Exception
sequences
- HashSet of sequences to be built.
Entry is string array of sequenceName, tbName, columnName.doMaxseq
- True to update the "maxseq" sequence (it will not be in the HashSet).
False to do only what's specified in the HashSet.java.lang.Exception
getMaxEAuditTransID()
public java.util.ArrayList<java.lang.String> updateMaxSequence(java.util.HashSet sequences) throws java.lang.Exception
sequences
- HastSet of sequences to be built.
Entry is string array of sequenceName, tbName, columnName.java.lang.Exception
getMaxEAuditTransID()
public java.util.ArrayList<java.lang.String> updateMaxSequence(java.util.HashSet sequences, java.util.Map<java.lang.String,java.lang.Long> lastNumbers) throws java.lang.Exception
sequences
- HastSet of sequences to be built.
Entry is string array of sequenceName, tbName, columnName.lastNumbers
- Map of number to be used as a start to build sequences.java.lang.Exception
getMaxEAuditTransID()
public long getNextSequenceNo(java.lang.String sequenceName) throws java.lang.Exception
sequenceName
- java.lang.Exception
nativeSequenceExists(java.lang.String)
public java.util.ArrayList<java.lang.String> rebuildMetadataSequences() throws java.lang.Exception
java.lang.Exception
getMetadataSequenceNames()
,
buildSequences(java.util.HashSet, boolean)
,
updateMaxSequence(java.util.HashSet)
public java.util.HashSet<java.lang.String[]> getMetadataSequenceNames() throws java.lang.Exception
rebuildMetadataSequences
,
buildSequences
, and
updateMaxSequence
.java.lang.Exception
public int getMaxEAuditTransID() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> createOneSequenceFromMaxSequence(java.lang.String sequenceName) throws java.lang.Exception
sequenceName
- The name of the sequencejava.lang.Exception
public java.lang.String getUnrestoredTables(java.lang.String tbname) throws java.lang.Exception
It should be restored using RestoreFromBackup
.
The method getOldBackupTables
checks for tables
that have been restored, but whose backup tables have not been deleted.
tbname
- Table name to check for (e.g. ITEM
).
Usually, this parameter will be null, and the Sql will get all table names
that need to be restored. However, if a table name is specified in this parameter,
the Sql will check for this table name only.java.lang.Exception
ConfigDB
,
RestoreFromBackup
,
DropBackup
public java.lang.String getBackupTableName(java.lang.String tbname) throws java.lang.Exception
tbname
- Base table namejava.lang.Exception
public java.lang.String getOldBackupTables(java.lang.String tbname) throws java.lang.Exception
ITEM
if the
backup table XXITEM
exists).
If the Sql returns any rows, it is assumed that the base tables were earlier
modified via ConfigDB, and the original data was saved to a backup table and
copied back to the new base table, but the old backup table
named "XX" + tbname still exists on the database.
It should be dropped using DropBackup
.
The method getUnrestoredTables
checks for tables
that need to be restored, but have not yet been restored.
tbname
- Table name to check for (e.g. ITEM
).
Usually, this parameter will be null, and the Sql will get all table names
that are old backup. However, if a table name is specified in this parameter,
the Sql will check for this table name only.java.lang.Exception
ConfigDB
,
RestoreFromBackup
,
DropBackup
public void clearAlreadyDidUsingMultiSchema()
alreadyDidUsingMultiSchema
to False so that usingMultiSchema
will
recalculate the value next time it is called.public boolean usingMultiSchema() throws java.lang.Exception
java.lang.Exception
alreadyDidUsingMultiSchema
,
bUsingMultiSchema
,
clearAlreadyDidUsingMultiSchema()
public java.util.TreeMap<java.lang.String,java.lang.String> getSites(boolean includeDisabled) throws java.lang.Exception
includeDisabled
- If True, this will return all sites, whether disabled or not.
If False, this will get only "live" sites.java.lang.Exception
public java.util.TreeMap<java.lang.String,java.lang.String> getOrgs(boolean includeDisabled) throws java.lang.Exception
includeDisabled
- If True, this will return all organizations, whether disabled or not.
If False, this will get only "live" organizations.java.lang.Exception
public java.lang.String getSiteOrgType(java.lang.String objectname) throws java.lang.Exception
getObjectMeta
could also be used, but this is a
simpler method if the only attribute needed is siteorgtype.objectname
- The name of the object.java.lang.Exception
public java.lang.String getStoragePartition(java.lang.String tbname) throws java.lang.Exception
getObjectMeta
, but this is a simpler method
if all you need is storagepartition.tbname
- The name of the table.java.lang.Exception
public java.lang.String getUniqueIndexSpace(java.lang.String tbname, java.lang.String tbPartition) throws java.lang.Exception
tbname
- Table nametbPartition
- Table's storage partitionjava.lang.Exception
public java.lang.String getLangColumnName(java.lang.String tbname) throws java.lang.Exception
getObjectMeta
, but this is a simpler method
if all you need is language column name.tbname
- The name of the table.java.lang.Exception
public java.lang.String getUniqueColumnName(java.lang.String tbname) throws java.lang.Exception
getObjectMeta
, but this is a simpler method
if all you need is unique column name.tbname
- The name of the table.java.lang.Exception
public java.lang.String getUniqueColumnNameNative(java.lang.String tbname) throws java.lang.Exception
tbname
- The name of the table.java.lang.Exception
getColumnNamesNative(java.lang.String)
,
nativeIndexExistsForColumns(java.lang.String, java.lang.Object[])
,
nativeIndexIsUnique(java.lang.String)
public java.lang.String getObjectName(java.lang.String entityname, boolean useIsViewConstraint, boolean isView) throws java.lang.Exception
getObjectMeta
, but this is a simpler method
if all you need is objectname.entityname
- The name of the table or view.useIsViewConstraint
- True is a constraint shouold be applied per the isView param.isView
- True if this is a view, False if a table. This constraint is applied only if
the useIsViewConstraintparam is True.java.lang.Exception
public java.lang.String getTableName(java.lang.String objectname) throws java.lang.Exception
getObjectMeta
, but this is a simpler method
if all you need is objectname.objectname
- The name of the object.java.lang.Exception
public MTStorageType getStorageType(java.lang.String tableName) throws java.sql.SQLException
tableName
- The name of the table.java.sql.SQLException
public java.lang.String getViewName(java.lang.String objectname) throws java.lang.Exception
getObjectMeta
, but this is a simpler method
if all you need is objectname.objectname
- The name of the object.java.lang.Exception
public java.lang.String getAttributeName(java.lang.String objectname, java.lang.String tablename, java.lang.String columnname) throws java.lang.Exception
getAttributeMeta
, but this is a simpler method
if all you need is attributename.objectname
- The name of the object.tablename
- The name of the table.columnname
- The name of the column.java.lang.Exception
public java.lang.String[] getColumnName(java.lang.String objectname, java.lang.String attributename) throws java.lang.Exception
getAttributeMeta
, but this is a simpler method
if all you need is attributename.objectname
- The name of the object.attributename
- The name of the attribute.java.lang.Exception
public java.lang.String getKeyAttribute(java.lang.String objectname, java.lang.String tablename) throws java.lang.Exception
getUniqueColumnName
).
The "key attribute" is determined as follows:
In theory, if this is the main object for an application, the attribute name should equal the maxapps keycolumn. However, this method does not check or validate against maxapps.
This method attempts to use maxsysindexes and maxsyskeys (not maxattribute) when determining the index. However, if there is NO data in maxsysindexes for this table, then this method will use primarykeycolseq on maxattributecfg.
To get the names and sequence of all columns in a table's unique index, use the
getKeyColumns
method.
objectname
- The object name.tablename
- The table name (entityname).java.lang.Exception
getSiteOrgType(java.lang.String)
,
getUniqueColumnName(java.lang.String)
public java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> getObjectMeta(java.lang.String objectname, boolean getCfg, boolean getPersistentOnly, boolean getChangedOnly, boolean getColumns, boolean colsOrderByName, boolean getTablesOnly, boolean getViewsOnly) throws java.sql.SQLException
objectname
- The object name (optional). If null, gets all objects, else gets
only the specified object.getCfg
- If true, gets metadata from the configuration tables
(maxobjectcfg, maxtablecfg, etc.).
Otherwise, gets the active metadata.getPersistentOnly
- If true, gets only persistent objects and attributes. Else gets them all.getChangedOnly
- If true, gets only objects where the value of "changed" is not "N".getColumns
- If true, gets attribute metadata and stores under key "$ATTRIBUTES".
(Gets all attributes, whether changed or not.)
Otherwise, does not get attribute metadata.colsOrderByName
- If getColumns is True, then if colsOrderByName is True, the
attributes will be in sequence by attributename; if False, they will be in
sequence by attributeno.getTablesOnly
- True to get only tables, else False.getViewsOnly
- True to get only views, else False.
The entry "$STORAGECLAUSE" will contain the storage clause (if any) for an Oracle table;
otherwise, this is the empty string (see getStorageClause
).
Also, if we are getting attributes, there will be an entry "$ATTRIBUTES"
whose value is a TreeMap of the attributes (see getAttributeMeta
).
java.sql.SQLException
getAttributeMeta(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String)
,
getStorageClause(java.lang.String, boolean)
public java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>>> getAttributeMeta(java.lang.String objectname, boolean getCfg, boolean orderByName, boolean getPersistentOnly, boolean getChangedOnly, boolean selectView, java.lang.String entityName) throws java.sql.SQLException
objectname
- The object name.getCfg
- If true, gets metadata from the configuration table(s).
Otherwise, gets the active metadata.orderByName
- If true, the key to the "$MAXATTRIBUTES" TreeMap is attribute name (uppercase).
Otherwise, the key to this TreeMap is attribute number
(4-character String with leading zeroes).getPersistentOnly
- If true, gets only persistent attributes. Else gets them all.getChangedOnly
- If true, gets only attributes where the value of "changed" is not "N".selectView
- True if we want to try to retrieve View metadata (i.e., this is a view, or
we are not sure whether this is a table or view).entityName
- The entityname (if known). This is important when selecting view attributes
from maxviewcolumn. Otherwise, it is OK for this to be null.key[0] = "$MAXATTRIBUTES" with all data from maxattribute (or maxattributecfg) for this object. Under this key, there will be stored another TreeMap, key = attributename (uppercase) or attribute number, value = HashMap. The HashMap has an entry for each attribute in the maxattribute metadata, whose value is the metadata string value.
key[1] = "$MAXVIEWCOLUMNS", with all data from maxviewcolumns (or maxviewcolumncfg) for this object. Under this key, there will be stored another TreeMap, key = viewcolumnname (uppercase), value = HashMap. The HashMap has an entry for each attribute in the maxviewcolumn metadata, whose value is the metadata string value.
java.sql.SQLException
public java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> getTenantAttributeMeta(java.lang.String objectname, int tenantId) throws java.sql.SQLException
objectname
- The object name.getCfg
- If true, gets metadata from the configuration table(s).
Otherwise, gets the active metadata.orderByName
- If true, the key to the "$MAXATTRIBUTES" TreeMap is attribute name (uppercase).
Otherwise, the key to this TreeMap is attribute number
(4-character String with leading zeroes).getPersistentOnly
- If true, gets only persistent attributes. Else gets them all.getChangedOnly
- If true, gets only attributes where the value of "changed" is not "N".selectView
- True if we want to try to retrieve View metadata (i.e., this is a view, or
we are not sure whether this is a table or view).entityName
- The entityname (if known). This is important when selecting view attributes
from maxviewcolumn. Otherwise, it is OK for this to be null.tenantId
- In MT environment tenant id of the processing tenant.key[0] = "$MAXATTRIBUTES" with all data from maxattribute (or maxattributecfg) for this object. Under this key, there will be stored another TreeMap, key = attributename (uppercase) or attribute number, value = HashMap. The HashMap has an entry for each attribute in the maxattribute metadata, whose value is the metadata string value.
key[1] = "$MAXVIEWCOLUMNS", with all data from maxviewcolumns (or maxviewcolumncfg) for this object. Under this key, there will be stored another TreeMap, key = viewcolumnname (uppercase), value = HashMap. The HashMap has an entry for each attribute in the maxviewcolumn metadata, whose value is the metadata string value.
java.sql.SQLException
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> gettenantSameAsExtendedAtributes(int tenantId) throws java.sql.SQLException
objectname
- The object name.getCfg
- If true, gets metadata from the configuration table(s).
Otherwise, gets the active metadata.orderByName
- If true, the key to the "$MAXATTRIBUTES" TreeMap is attribute name (uppercase).
Otherwise, the key to this TreeMap is attribute number
(4-character String with leading zeroes).getPersistentOnly
- If true, gets only persistent attributes. Else gets them all.getChangedOnly
- If true, gets only attributes where the value of "changed" is not "N".selectView
- True if we want to try to retrieve View metadata (i.e., this is a view, or
we are not sure whether this is a table or view).entityName
- The entityname (if known). This is important when selecting view attributes
from maxviewcolumn. Otherwise, it is OK for this to be null.tenantId
- In MT environment tenant id of the processing tenant.key[0] = "$MAXATTRIBUTES" with all data from maxattribute (or maxattributecfg) for this object. Under this key, there will be stored another TreeMap, key = attributename (uppercase) or attribute number, value = HashMap. The HashMap has an entry for each attribute in the maxattribute metadata, whose value is the metadata string value.
key[1] = "$MAXVIEWCOLUMNS", with all data from maxviewcolumns (or maxviewcolumncfg) for this object. Under this key, there will be stored another TreeMap, key = viewcolumnname (uppercase), value = HashMap. The HashMap has an entry for each attribute in the maxviewcolumn metadata, whose value is the metadata string value.
java.sql.SQLException
public java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> getIndexMeta(java.lang.String tbname, boolean getChangedOnly) throws java.sql.SQLException
java.sql.SQLException
getIndexMeta(String, boolean, boolean)
public java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> getIndexMeta(java.lang.String tbname, boolean getChangedOnly, boolean getPrimary) throws java.sql.SQLException
java.sql.SQLException
getIndexMeta(String, boolean, boolean)
public java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> getIndexMeta(java.lang.String tbname, boolean getChangedOnly, boolean getPrimary, boolean includeDeleted) throws java.sql.SQLException
tbname
- To get indexes for only one table, this will equal the table name.
To get indexes for all tables, this will be null.getChangedOnly
- If true, gets only indexes where the value of "changed"
equal "Y" or "D" on maxsysindexes and/or maxsyskeys.
If False, gets all indexes, whether or not they've been changed.getPrimary
- This parameter is used only for DB2. If true, all indexes will be retrieved,
including primary keys (defined with the "create table" statement "primary key" clause).
If false, primary keys will not be included.includeDelted
- If False, exclude indexes where the value of "changed"
equal "D" on maxsysindexes and/or maxsyskeys.
If True, include indexes where the value of "changed"
equal "D" on maxsysindexes and/or maxsyskeys.getStorageClause
).java.sql.SQLException
getStorageClause(java.lang.String, boolean)
public java.util.ArrayList<java.lang.String> getIndexNamesForColumn(java.lang.String tbname, java.lang.String colName) throws java.sql.SQLException
tbname
- Table namecolName
- Column namejava.sql.SQLException
public java.lang.String getMaxvar(java.lang.String varname, boolean getDefault) throws java.sql.SQLException
varname
- Name of the maxvar.getDefault
- If True, gets default value of maxvar from maxvartype table.
If False, gets value of maxvar from maxvars table, with
orgid and siteid both null.java.sql.SQLException
public java.lang.String getYes()
sYes
.public java.lang.String getNo()
sNo
.public java.lang.String getMaxUpgVersion()
maxUpgVersion
(the maxvar value for MAXUPG),
initialized via the constructor.public boolean nativeTableExists(java.lang.String tbname) throws java.lang.Exception
tbname
- The table namejava.lang.Exception
public boolean nativeColumnExists(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- The table namename
- The column namejava.lang.Exception
public boolean nativeViewExists(java.lang.String vname) throws java.lang.Exception
schemaOwner
variable which was initialized
in the constructor.vname
- The view namejava.lang.Exception
public boolean nativeIndexExists(java.lang.String ixname, java.lang.String tbname) throws java.lang.Exception
ixname
- The index name.tbname
- The table name (optional). If non-null, this method will determine
whether the specified index exists on the specified table. If null, this
method will check for the index, without using a table constraint.java.lang.Exception
public java.util.ArrayList<java.lang.String> nativeIndexExistsForColumn(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- Table namename
- Column namejava.lang.Exception
public java.lang.String nativeIndexExistsForColumns(java.lang.String tbname, java.lang.Object[] names) throws java.lang.Exception
nativeIndexExistsForColumns
with last parameter false.tbname
- Table namenames
- Array of column names in the sequence they would appear in the index.java.lang.Exception
nativeIndexExistsForColumns(String, Object[], boolean)
public java.lang.String nativeIndexExistsForColumns(java.lang.String tbname, java.lang.Object[] names, boolean ignoreTS) throws java.lang.Exception
tbname
- Table namenames
- Array of column names in the sequence they would appear in the index.ignoreTS
- When looking for a duplicate index, ignore domain index (Oracle text search).java.lang.Exception
public java.util.ArrayList<java.lang.String> cleanStatisticNames() throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> fixMetadataForDescendingKeys(java.lang.String tbname, java.lang.String ixname) throws java.lang.Exception
getSysIndexRefresh
on an Oracle platform.
This method will update maxsyskeys colname for descending keys.tbname
- Table name (can be null for all tables).ixname
- Index name (can be null for all indexes).java.lang.Exception
getSysIndexRefresh(java.lang.String, java.lang.String)
public boolean nativeIndexIsUnique(java.lang.String ixname) throws java.lang.Exception
ixname
- Index namejava.lang.Exception
public boolean nativeIndexIsPrimaryKey(java.lang.String ixname) throws java.lang.Exception
ixname
- Index namejava.lang.Exception
public boolean nativeColumnIsNullable(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- The table namename
- The column namejava.lang.Exception
public java.util.ArrayList<java.lang.String> addTenantIDIndex(java.lang.String tbname, java.lang.String storagepartition, MTStorageType storageType) throws java.lang.Exception
tbname
- Table namenames
- Array of column names to be in the index.startWith
- The index will be named tbname + "_ndx" + xx, where xx >= startWith.
This parameter must be equivalent to an integer value.
If null, the method will start with 1.addUnique
- True if the new index should be unique, else False.storagepartition
- Storage partition for the index. If this is null, the default partition will be used.java.lang.Exception
nativeIndexExistsForColumns(java.lang.String, java.lang.Object[])
,
getNewIndexName(java.lang.String, int)
,
nativeIndexExists(java.lang.String, java.lang.String)
,
getDefaultStoragePartition(boolean)
,
getNextSequenceValueForSqlServer(java.lang.String)
public java.util.ArrayList<java.lang.String> addIndex(java.lang.String tbname, java.lang.String[] names, java.lang.String startWith, boolean addUnique, java.lang.String storagepartition) throws java.lang.Exception
tbname
- Table namenames
- Array of column names to be in the index.startWith
- The index will be named tbname + "_ndx" + xx, where xx >= startWith.
This parameter must be equivalent to an integer value.
If null, the method will start with 1.addUnique
- True if the new index should be unique, else False.storagepartition
- Storage partition for the index. If this is null, the default partition will be used.java.lang.Exception
nativeIndexExistsForColumns(java.lang.String, java.lang.Object[])
,
getNewIndexName(java.lang.String, int)
,
nativeIndexExists(java.lang.String, java.lang.String)
,
getDefaultStoragePartition(boolean)
,
getNextSequenceValueForSqlServer(java.lang.String)
public java.lang.String getNewIndexName(java.lang.String tbname, int startWith) throws java.lang.Exception
tbname
- Table namestartWith
- If it's known that indexes _ndx3 exists, you can set startWith to 4;
Or you can just leave startWith at 0 or 1.java.lang.Exception
public java.util.ArrayList<java.lang.String> nativeDefaultConstraintExists(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- Table namename
- Column namejava.lang.Exception
public boolean nativeTriggerExists(java.lang.String trigname) throws java.lang.Exception
trigname
- The trigger namejava.lang.Exception
public boolean nativeSequenceExists(java.lang.String name) throws java.lang.Exception
name
- The sequence namejava.lang.Exception
public boolean isNickname(java.lang.String name) throws java.lang.Exception
name
- The nicknamejava.lang.Exception
public boolean isSysYORN(java.lang.String attrName)
attrName
- The name of the attribute (e.g. "canautonum").sysYORNattrs
public boolean isSysNumeric(java.lang.String attrName)
attrName
- The name of the attribute (e.g. "length").sysNumattrs
,
isSysYORN(java.lang.String)
public java.util.ArrayList<java.lang.String> adjustViewMeta(java.lang.String viewname) throws java.lang.Exception
viewname
- The view to be adjusted.java.lang.Exception
adjustViewMeta(String, boolean, boolean)
public int getMaximumColumnNameLength() throws java.sql.SQLException
java.sql.SQLException
public java.util.ArrayList<java.lang.String> adjustViewMeta(java.lang.String viewname, boolean addP, boolean addNP) throws java.lang.Exception
buildCreateViewStatement
.
Attributes will be added to the metadata whether or not the view is autoselect. However, if the view is non-autoselect, another process will have to adjust viewselect and other attributes on maxview, as needed. Therefore, the driver to this method should ideally be passing in only autoselect views.
This method was written to support installations having multiple Industry Solutions, but can be used elsewhere. For example:
viewname
- The view to be adjusted.addP
- True to add persistent attributes, False to not add them.addNP
- True to add non-persistent attributes, False to not add them.java.lang.Exception
public boolean useQuotes(java.lang.String maxtype)
maxtype
- The maxtype to be evaluated.public java.lang.String singleToDoubleQuotes(java.lang.String in)
in
- The value to be analyzed.public java.lang.String toggleStringConcat(java.lang.String inString, java.lang.String inConcat, java.lang.String outConcat)
inString
- The value to be analyzed.inConcat
- The contatenator to be searched for and replaced in the input string.outConcat
- The new concatenator to be used in the output string.public java.lang.String getNativeType(java.lang.String maxType, java.lang.String length, int dbPlatform)
maxType
- The Maximo datatypelength
- The length of the field as specified on maxattribute
(to determine if this is a long string).dbPlatform
- If equal to 0, uses whatever platform we're using for dbOut.
Otherwise, can equal one of the values in UpgConstants to specify
ORACLE, SQLSERVER, or DB2.public int getJdbcType(java.lang.String nativeType, int dbPlatform) throws java.lang.Exception
nativeType
- dbPlatform
- java.lang.Exception
public java.lang.String getNativeTypeForColumn(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- The table name.name
- The column name.java.lang.Exception
public java.lang.String getNativeDateDefault() throws java.lang.Exception
SYSDATE
.
For SqlServer, this equals getdate()
.
For DB2, this equals current timestamp
.java.lang.Exception
public java.lang.String getNativePartition(java.lang.String tbname) throws java.lang.Exception
tbname
- The table name.java.lang.Exception
public boolean spaceIsActive(java.lang.String spaceName) throws java.lang.Exception
spaceName
- Name of the tablespace to be checked.java.lang.Exception
public boolean spaceIsSysManaged(java.lang.String spaceName) throws java.lang.Exception
spaceName
- Name of the tablespace to be checked.java.lang.Exception
public int bytesSpaceNeeded(java.lang.String spaceName) throws java.lang.Exception
spaceNeeded
.spaceName
- Name of the tablespace to be checked.java.lang.Exception
public java.lang.Object[] spaceNeeded(java.lang.String spaceName) throws java.lang.Exception
spaceName
- Name of the tablespace to be checked.java.lang.Exception
public java.util.ArrayList<java.lang.String> makeSpace(java.lang.String spaceName, int numBytes) throws java.lang.Exception
makeSpace
java.lang.Exception
public java.util.ArrayList<java.lang.String> makeSpace(java.lang.String spaceName, int numBytes, java.lang.String multiplier) throws java.lang.Exception
spaceName
- Name of the tablespace.numBytes
- The number of bytes or megabytes to be allocated.multiplier
- Space = bytes, "M" = megabytesjava.lang.Exception
public java.lang.String[] spaceCheckForDBConfig() throws java.lang.Exception
java.lang.Exception
spaceIsActive(java.lang.String)
,
spaceNeeded(java.lang.String)
,
makeSpace(java.lang.String, int)
public java.lang.String getStorageClause(java.lang.String name, boolean isTable) throws java.lang.Exception
name
- Object name (table or index name)isTable
- True if this is a table, False if this is an indexjava.lang.Exception
public java.lang.String adjustNativeSql(java.lang.String origSql) throws java.lang.Exception
This method is not needed for ConfigDB and other database utilities, as they create the native statements properly. This method is needed only when the incoming Sql has been hardcoded in a script.
origSql
- Original create or alter statement.java.lang.Exception
varcharMultiple
,
useVargraphic
public java.lang.String getMaxType(java.lang.String nativeType)
nativeType
- The native datatypepublic java.lang.String getDefaultStoragePartition(boolean checkValuelist) throws java.lang.Exception
checkValuelist
- True if the name must exist in both the native system
table and the alndomain table (DBSTORAGEPARTITION
).
False to get the value from the native system table only, without
checking against the valuelist.java.lang.Exception
public java.util.ArrayList<java.lang.String> getDBStoragePartitions() throws java.lang.Exception
java.lang.Exception
public boolean nativeSpaceExists(java.lang.String name) throws java.lang.Exception
name
- Name of tablespace to be checked.java.lang.Exception
public boolean needLength(java.lang.String maxtype, java.lang.String nativeType)
maxtype
- Maximo datatypenativeType
- Native datatypepublic boolean needScale(java.lang.String maxtype, java.lang.String nativeType)
maxtype
- Maximo datatypenativeType
- Native datatypepublic java.lang.String reEvaluateObjectChanged(java.util.HashMap newObject, java.util.HashMap oldObject, boolean useAttrChanged, java.lang.String upgradeDir) throws java.lang.Exception
This method is used by the Configure UI and the Upgrade.
For a description of the values for the "changed" attribute, see
MaxObjectCfg
.
newObject
- The new object, with attributes in sequence by name.
Cannot be null or empty.
If deleting the object, this must have "CHANGED" equal to "R".
For the format of this param, see getObjectMeta
.oldObject
- The old object, with attributes in sequence by name.
Can be null or empty only if a new object is being added.
For the format of this param, see getObjectMeta
.useAttrChanged
- If True, then when examining the attributes, this method will
assume that the attributes' value for "changed" has been updated to the proper value.
If False, the method will not look at attributes' changed, and will instead
call reEvaluateAttributeChanged
where needed. However, this does NOT update the attribute HashMap.
If the attributes are not up-to-date, and you wish to update them,
call reEvaluateAttributeChanged
and update the column HashMap before calling the object method.
upgradeDir
- This is non-null ONLY when this method is called during the upgrade
by TableElement
.
It is the subdirectory used by custom classes.
When called via the Config UI this MUST be null.java.lang.Exception
reEvaluateAttributeChanged(java.lang.String, java.util.HashMap, java.util.HashMap, java.lang.String, boolean)
,
canAlterTable(java.lang.String, java.util.HashMap, java.util.HashMap, java.lang.String)
public java.lang.String reEvaluateObjectChanged(java.util.HashMap newObject, java.util.HashMap oldObject, boolean useAttrChanged, java.lang.String upgradeDir, java.lang.String langcode) throws java.lang.Exception
java.lang.Exception
public java.lang.String reEvaluateObjectChangedQuickGL(java.lang.String entityname, boolean isView, java.util.HashMap attrs, boolean persistent, java.lang.String origChanged) throws java.lang.Exception
entityname
- Table or view nameisView
- True if this is a view, else Falseattrs
- Key = attributename, value = current value of Changed from maxattributecfgpersistent
- True if persistent, else FalseorigChanged
- Current value of maxobjectcfg changedjava.lang.Exception
public java.lang.String reEvaluateAttributeChangedQuickGL(java.lang.String entityname, java.lang.String columnname, boolean isView, int oldLength, int newLength, boolean persistent, java.lang.String origChanged) throws java.lang.Exception
entityname
- Table or view namecolumnname
- Column NameisView
- True if this is a view, else FalseoldLength
- Old column lengthnewLength
- New column lengthpersistent
- True if persistentorigChanged
- Old value of "changed"java.lang.Exception
canAlterForLengthChange(java.lang.String, java.lang.String, int, int)
public java.lang.String reEvaluateAttributeChanged(java.lang.String entityname, java.util.HashMap newAttr, java.util.HashMap oldAttr, java.lang.String upgradeDir, boolean isView) throws java.lang.Exception
reEvaluateTableAttributeChanged
or reEvaluateViewAttributeChanged
,
depending on whether this is a table or a view.public java.lang.String reEvaluateTableAttributeChanged(java.lang.String tablename, java.util.HashMap newAttr, java.util.HashMap oldAttr, java.lang.String upgradeDir) throws java.lang.Exception
This method is used by the Configure UI and the Upgrade.
For a description of the values for the "changed" attribute, see
MaxAttributeCfg
.
tablename
- The table namenewAttr
- The new attribute.
Cannot be null or empty.
If deleting the attribute, this must have "CHANGED" equal to "R".
For the format of this param, see getAttributeMeta
.oldAttr
- The old attribute.
Can be null or empty only if a new attribute is being added.
For the format of this param, see getAttributeMeta
.upgradeDir
- This is non-null ONLY when this method is called during the upgrade
by TableElement
or ColumnElement
.
It is the subdirectory used by custom classes.
When called via the Config UI this MUST be null.java.lang.Exception
canAlterTable(java.lang.String, java.util.HashMap, java.util.HashMap, java.lang.String)
public java.lang.String reEvaluateViewAttributeChanged(java.lang.String viewname, java.util.HashMap newAttr, java.util.HashMap oldAttr, java.lang.String upgradeDir) throws java.lang.Exception
This method is used by the Configure UI and the Upgrade.
For a description of the values for the "changed" attribute, see
MaxAttributeCfg
.
viewname
- The view namenewAttr
- The new attribute.
Cannot be null or empty.
If deleting the attribute, this must have "CHANGED" equal to "R".
For the format of this param, see getAttributeMeta
.oldAttr
- The old attribute.
Can be null or empty only if a new attribute is being added.
For the format of this param, see getAttributeMeta
.upgradeDir
- This is non-null ONLY when this method is called during the upgrade
by TableElement
or ColumnElement
.
It is the subdirectory used by custom classes.
When called via the Config UI this MUST be null.java.lang.Exception
public boolean canAlterTable(java.lang.String tablename, java.util.HashMap newAttr, java.util.HashMap oldAttr, java.lang.String upgradeDir) throws java.lang.Exception
ConfigDB
via an "alter table" statement. This method does
the check based on one attribute only. If multiple attributes are being changed, then
if ANY of them requires that the table be rebuilt, it must be rebuilt.
This method does not analyze the applicability of the native "alter" statement
in isolation.
It is used to determine whether the ConfigDB
program
is able to issue "alter table." ConfigDB in some cases may do preparatory work before
invoking "alter", such as dropping a default in SqlServer, etc.
Programmer's note: If the logic in buildDefaultDataStatement
changes, it may be necessary to change this method as well. For example, currently,
YORN columns default to N even if "nullwithdefault" is No. These two methods have
to be in synch.
tablename
- The table name.newAttr
- The new attribute (from maxattributecfg).
If the attribute is being dropped, this can be null or empty or have "CHANGED" = "R".
For the format of this param, see getAttributeMeta
.oldAttr
- The current attribute (from maxattribute).
If the attribute is being added, this parameter will be null or empty.
For the format of this param, see getAttributeMeta
.upgradeDir
- This is non-null ONLY when this method is called during the upgrade
by TableElement
or ColumnElement
.
It is the subdirectory used by custom classes.
If adding or changing a non-nullable column, and no default value is
provided in the metadata, and it is not a YORN or numeric column, then
this method will call upgradeDefaultExists
to see whether a custom class provides a default value for that column.
When called via the Config UI this MUST be null.java.lang.Exception
canAlterForLengthChange(java.lang.String, java.lang.String, int, int)
,
getDefaultString(String,String,String,String,String,String,int,int,int,int,int,boolean,boolean)
public boolean canAlterForLengthChange(java.lang.String tablename, java.lang.String columnname, int oldLength, int newLength) throws java.lang.Exception
canAlterTable
to determine whether table can be altered for
a column length change. This takes into account ONLY the length change.tablename
- Table namecolumnname
- Column nameoldLength
- Old column lengthnewLength
- New column lengthjava.lang.Exception
public boolean upgradeDefaultExists(java.lang.String tbname, java.lang.String name, java.lang.String upgradeDir) throws java.lang.Exception
UpgDefaultsTemplate
.
The name of the class must be "UpgDefaults" + tbname, and it must reside in the
upgradeDir. If it returns True for
columnHasDefault
then the column has an upgrade default.tbname
- Table namename
- Column nameupgradeDir
- The subdirectory where custom classes reside for the original
maxupg that is being upgraded from.columnHasDefault
.
It is not necessary to provide upgrade defaults for columns that would
get a default anyhow, such as YORN columns that default to No, or numeric
columns that default to 0.java.lang.Exception
public boolean implicitConversionSupported(java.lang.String newType, java.lang.String oldType) throws java.lang.Exception
newType
- The new native SqlServer datatype (from getNativeType
).oldType
- The old native SqlServer datatype (from getNativeType
).java.lang.Exception
public boolean explicitConversionSupported(java.lang.String newType, java.lang.String oldType) throws java.lang.Exception
newType
- The new native datatype (from getNativeType
).oldType
- The old native datatype (from getNativeType
).java.lang.Exception
implicitConversionSupported(java.lang.String, java.lang.String)
public boolean tableIsEmpty(java.lang.String tbname) throws java.lang.Exception
tbname
- Table name.java.lang.Exception
public boolean columnIsEmpty(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- Table name.name
- Column name.java.lang.Exception
public boolean nullValueExists(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- Table name.name
- Column name.java.lang.Exception
public int getMaxColumnLength(java.lang.String tbname, java.lang.String name) throws java.lang.Exception
tbname
- Table name.name
- Column name.java.lang.Exception
public int getMaxColno(java.lang.String objectname, boolean getCfg, java.lang.String where) throws java.lang.Exception
getAttributeMeta
could also be used, but this is a
simpler method if the only attribute needed is max(attributeno).objectname
- Object name.getCfg
- If true, gets max(attributeno) from the configuration object
(maxattributecfg), else gets from maxattribute.where
- The Where clause for the select statement (not beginning with "where" or "and").
This is optional.
If null, the method gets the max(attributeno) for the object, with no other conditions.java.lang.Exception
public int getMaxLengthColumnInIndex()
public int getMaxLengthIndex()
public int getMaxVarcharLength()
public void setVarcharMultiple(int val)
val
- Varchar multiplepublic int getVarcharMultiple()
varcharMultiple
.public void setVargraphic(boolean val)
val
- Vargraphic (true or false)public boolean useVargraphic()
useVargraphic
.public java.lang.String getInternalSiteOrgType(java.lang.String externalSiteOrgType) throws java.sql.SQLException
Translate
class.externalSiteOrgType
- java.sql.SQLException
siteOrgTypes
public java.lang.String getInternalSearchType(java.lang.String externalSearchType) throws java.sql.SQLException
Translate
class.externalSearchType
- java.sql.SQLException
public boolean isLocAllowed(java.lang.String objectName, java.lang.String attributeName, java.util.HashMap attrInfo, java.util.HashMap sameasAtrInfo) throws java.lang.Exception
objectName
- Object nameattributeName
- Attribute nameattrInfo
- Attribute info from getAttributeMeta
.
This is optional. If null, the method will look in the database (MaxAttributeCfg).sameasAtrInfo
- Attribute info from getAttributeMeta
for the sameas attribute (if any).
This is optional. If null, the method will look in the database (MaxAttributeCfg).java.lang.Exception
MaxAttributeCfg.getHashMap()
,
getAttributeMeta(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String)
public boolean getLocDefault(java.lang.String objectName, java.lang.String attributeName, java.util.HashMap attrInfo, java.util.HashMap sameasAttrInfo) throws java.lang.Exception
objectName
- Object nameattributeName
- Attribute nameattrInfo
- Attribute info from getAttributeMeta
.
This is optional. If null, the method will look in the database (MaxAttributeCfg).sameasAtrInfo
- Attribute info from getAttributeMeta
for the sameas attribute (if any).
This is optional. If null, the method will look in the database (MaxAttributeCfg).java.lang.Exception
MaxAttributeCfg.getHashMap()
,
getAttributeMeta(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String)
public boolean nameInList(java.lang.String name, java.lang.String list)
getColumnNames
.name
- Name to search for in the listlist
- Comma-delimited list of names in which to search for the first param.
The comma may or may not have a space following it (the test does a trim).public java.lang.String selectString(java.lang.String sql) throws java.lang.Exception
sql
- The sql to be executed by this method to test if any rows found.
Must be a select statement that selects one String column!java.lang.Exception
public boolean rowFound(java.lang.String sql) throws java.lang.Exception
sql
- The sql to be executed by this method to test if any rows found.
Must be a select statement!java.lang.Exception
public java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> changeTreeKey(java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> oldMap, java.lang.String keyAttr) throws java.lang.Exception
The main intended use for this is to allow a TreeMap of columns to be
output with a new key, which typically will be the value of either
ATTRIBUTENO
or ATTRIBUTENAME
.
If the current key starts with $
then do not change it.
For the regular TreeMap formats, see getAttributeMeta
,
getObjectMeta
, and getIndexMeta
.
oldMap
- The old map.keyAttr
- The name of the attribute to use as the key in the new map.java.lang.Exception
public void setConnection(java.sql.Connection connection) throws java.lang.Exception
con
, used for retrieving data.public void setPrintStream(java.io.PrintStream outstream) throws java.lang.Exception
out
.outstream
- Output print stream.java.lang.Exception
public void setDB2tsPreferSysproc(boolean val)
val
- True if executing commands on local database via java; False when generating a separate script for DB2 Text commands.public void setDBOut(int platform)
dbOut
.platform
- Valid values are in UpgConstants
:
ORACLE
,
SQLSERVER
, or
DB2
.dbOut
public boolean mxServerIsUp(java.lang.String serverName) throws java.lang.Exception
serverTimeStampUpdateRate
.)
The method lockMaximoTables
can be used to
lock tables.
serverName
- If just checking a particular instance of MXServer, this is the servername
to check for. To check for any instance of MXServer on this database, this param
should be null.java.lang.Exception
public boolean configInProcess() throws java.lang.Exception
java.lang.Exception
public java.lang.String setConfigInProcess(boolean inProcess) throws java.lang.Exception
CONFIGURING
).java.lang.Exception
public java.sql.Statement createStatement() throws java.sql.SQLException
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getNextSequenceValueForSqlServer(java.lang.String seqName) throws java.lang.Exception
seqName
- The name of the sequencejava.lang.Exception
public java.util.List<java.lang.String> updateDMSource() throws java.lang.Exception
java.lang.Exception
public java.lang.String getDatabaseName() throws java.lang.Exception
updateDMSource
, not from ConfigDB.java.lang.Exception
public java.lang.String getSchemaName() throws java.lang.Exception
updateDMSource
, not from ConfigDB.java.lang.Exception
getCurrentNativeSchema()
public java.lang.String getDBHostName() throws java.lang.Exception
updateDMSource
, not from ConfigDB.java.lang.Exception
public static java.lang.String getFileText(java.io.InputStream fileStrm) throws java.io.IOException
fileStrm
- java.io.IOException
public java.util.ArrayList<java.lang.String> enableForMultiTenancy(java.lang.String tabName, java.lang.String uniqueName, java.lang.String userName, java.lang.String adminUser, MTStorageType storageType) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> addTenantidToTable(java.lang.String tabName, MTStorageType storageType) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> changeStorageType(java.lang.String tabName, java.lang.String uniqueName, MTStorageType oldType, MTStorageType newType, java.lang.String userName, java.lang.String adminUser, boolean isInternal) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> disableMTPermission(java.lang.String tabName, MTStorageType storageType)
public java.util.List<java.lang.String> createPermission(java.lang.String tabName, java.lang.String uniqueName, java.lang.String newTenantUser, java.lang.String landlordUser, MTStorageType type) throws java.lang.Exception
tabName
- Name of the table to create permission for.uniqueName
- The name of the Unique ID column in the table.userName
- The name of the Master user.type
- Extended storage type, not directly same as MaxTable.StorageTypejava.lang.Exception
public java.util.List<java.lang.String> createPermission(java.lang.String tabName, java.lang.String uniqueName, java.lang.String newTenantUser, java.lang.String landlordUser, MTStorageType type, boolean addProcessUser) throws java.lang.Exception
tabName
- Name of the table to create permission for.uniqueName
- The name of the Unique ID column in the table.userName
- The name of the Master user.type
- Extended storage type, not directly same as MaxTable.StorageTypejava.lang.Exception
public java.util.List<java.lang.String> rebuildProcessUserVariable(java.lang.String adminUser) throws java.lang.Exception
adminUser
- User namejava.lang.Exception
public void rebuildPermissions(java.lang.String processUser) throws java.lang.Exception
java.lang.Exception
public java.util.List<java.lang.String> createTenantidTriggeres(java.lang.String tbname, MTStorageType storageType, boolean secureRowlevelTriggers, boolean dropInsert, boolean dropUpdateDelete, boolean createDeltaTriggers) throws java.lang.Exception
tbname
- Table namestorageType
- secureRowlevelTriggers
- dropInsert
- Checks for an existing M trigger, dropping it if it exists. This parameter can only be false if it's known there can't be such an index.dropUpdateDelete
- Checks for existing E & D triggers, dropping them if they exist. This parameter should only be false if it's know there can't be such indexes.java.lang.Exception
public java.util.ArrayList<java.lang.String> dropDeltaTriggers() throws java.lang.Exception
java.lang.Exception
public java.util.List<java.lang.String> getDeltaTriggerSql(java.lang.String tbname) throws java.lang.Exception
java.lang.Exception
public java.util.HashMap<java.lang.String,java.lang.String> getSequences(java.lang.String tableName) throws java.lang.Exception
createSequences
.java.lang.Exception
public java.util.List<java.lang.String> registerTableFromTemplate(java.lang.String tbname, java.util.TreeMap tableCols, java.lang.String whereClause) throws java.lang.Exception
If this is Oracle, the rowstamp value is set to "maxseq.nextval".
Depending on the platform, there will be a semicolon (";") or "go" after the statement, so that it can be run via a script.
Any encrypted datatypes (such as password) will be set to a foobar value, as encrypted data cannot be output to a print file.
tbname
- The table name (must be a persistent table).tableCols
- The column attributes for persistent columns. Can be null.
If null, this method calls getAttributeMeta
.out
- The output print stream.numLines
- The number of lines that have been written to the current
output file.maxLines
- The maximum number of lines that can be written to an output file.
This parameter enables Unlcvt to output multiple files.
If there is no maximum, this will equal 0.unlcvt
- Instance of Unlcvt that invoked this method. Used only when maxLines > 0.psFormat
- If this is true then output will support use of PreparedStatement when script is
run by Maxinst. This is set to true by using the -b param when running Unlcvt.java.lang.Exception
getAttributeMeta(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String)
,
buildSelectStatement(java.lang.String, java.util.TreeMap, boolean, boolean)
,
buildInsertStatementPrefix(java.lang.String, java.util.TreeMap, boolean, boolean)
,
buildInsertValuesStatement(java.lang.String, java.sql.ResultSet, java.util.TreeMap, boolean, java.lang.String)
public java.lang.String[] getColumnNamesForExtendedView(java.util.TreeMap tableCols, java.lang.String tableName, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> extendedTables, java.lang.String uniqueColumnName, java.lang.String isView, boolean mtEnabled) throws java.lang.Exception
colNameList
parameter in
buildDefaultDataStatement
,
buildSelectStatement
,
buildInsertStatementPrefix
, and for this
very method.
This method will NOT output columns that are "handle" columns used for DB2 text search.
These columns must be created via db2ts
(see enableRichTextSearch
).
tableCols
- Column attributes, see getAttributeMeta
.java.lang.Exception
isHandleColumn(java.lang.String, java.util.TreeMap)
public java.lang.String getExtendedUniqueColumnForView(java.lang.String viewName, java.lang.String extTableName) throws java.lang.Exception
viewName
- The name of the viewextTableName
- The name of extended tablejava.lang.Exception
public boolean isMTEnabled() throws java.sql.SQLException
attrName
- The name of the attribute (e.g. "canautonum").java.sql.SQLException
sysYORNattrs
public java.lang.String getUserFromProperties(boolean getLandlordUser) throws java.lang.Exception
java.lang.Exception
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> getTenantExtAttributes(java.sql.Connection conn, java.lang.String objectName, int tenantId) throws MXApplicationException
conn
- Connection to the database.objectName
- name of the object - table or viewtenantId
- Tenant ID #MXApplicationException
public java.util.ArrayList<java.lang.String> updateViewMetaDataForExtendedAttr(java.sql.Connection conn, java.lang.String objectName, java.lang.String viewName, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> extAttr, int tenantId) throws MXApplicationException
MXApplicationException
public java.util.List<java.lang.String> createExtensionView(java.lang.String objectName, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> extendedTables, java.sql.Connection masterCon, int tenantId, boolean deleteOnly, boolean mtEnabled) throws MXException, java.rmi.RemoteException
createTable
for each extension table to be created.objectName
- Name of the object that is extendedextendedTables
- mapped information about the tablemasterCon
- Not usedtenantId
- Id# of the tenant to create the view for (-1 is MT is not enabled).deleteOnly
- Set when we only want to drop any existing extension view.mtEnabled
- Is Multitenacy enabled?"configure"
- "RemoveChangesFailure"
MXException
java.rmi.RemoteException
psdi.configure.Util#createTable
public void storeChangedAttributes(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String[]>>> changedObjects, java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> attrs, java.lang.String objectname) throws java.sql.SQLException
attrs
- map of attributes and new valuescurrentAttrs
- map of attributes and old valuesjava.sql.SQLException
public java.util.ArrayList<java.lang.String> renumberExtendedAttributes(int tenantId, java.util.Map<java.lang.String,java.lang.Integer> lastNumbers, java.util.ArrayList<java.lang.String> list) throws java.sql.SQLException, MXException
attrs
- map of attributes and new valuescurrentAttrs
- map of attributes and old valuesjava.sql.SQLException
MXException
public java.util.ArrayList getUpdateTenantDelta(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String[]>>> changedObjects, int tenantId, java.util.TreeMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> cfgAttrs, java.util.Vector<java.lang.String[]> skipList) throws java.sql.SQLException, MXException
attrs
- map of attributes and new valuescurrentAttrs
- map of attributes and old valuesskipLst
- each element in this list describes the tenant/object/attribute/value that's not being populated
from the master. each element in this list is a parameter list that for the message to be displayedjava.sql.SQLException
MXException
public int getNextAttrNo(java.lang.String tablename) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<java.lang.String> getTenantCodeMetadata() throws java.lang.Exception
java.lang.Exception
public java.util.List<java.lang.String> addTenantid(java.lang.String tablename, java.lang.String uniqueColumnName, MTStorageType storageType) throws java.lang.Exception
java.lang.Exception
enableForMultiTenancy(java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.ibm.tivoli.maximo.dbmanage.connection.MTStorageType)
,
enableForMultiTenancy(java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.ibm.tivoli.maximo.dbmanage.connection.MTStorageType)
,
This is a similar method.
public void reorgBeforeDB2TSUpdate() throws java.lang.Exception
java.lang.Exception