public class Util
extends java.lang.Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
checkSQLName(java.lang.String string, int maxStringLength)
Checks for any illegal characters in a SQL name.
|
static boolean |
compareDates(java.lang.Object o1, java.lang.Object o2)
Returns true if two given objects (either a Date object or a String representation of a Date object) are the same.
|
static java.lang.String |
enquoteColumnName(java.sql.Connection conn, java.lang.String columnName)
Enquotes a column name.
|
static java.lang.String |
enquoteColumnNameCaseSensitive(java.sql.Connection conn, java.lang.String name)
Enquotes a column name.
|
static java.lang.String |
enquoteLiteral(java.sql.Connection conn, java.lang.String name)
This method enquotes a literal value.
|
static java.lang.String |
enquoteLiteral(java.sql.Connection conn, java.lang.String literal, int maxLengthAllowed)
Returns the enquoted literal
|
static java.lang.String |
enquoteNameSQLName(java.sql.Connection conn, java.lang.String name)
Returns the ENQUOTE_NAME formatted String for the SQL name If the Oracle JDBC is present, use the new OracleStatement.enquoteIdentifier API in the JDK8 JDBC.
|
static java.lang.String |
enquoteTableName(java.sql.Connection conn, java.lang.String tableName)
Enquotes a table name with or without schema name which is separated by ".".
|
static int |
getMaxLengthAllowed() |
static java.lang.String |
getValidatedGraphName(java.sql.Connection conn, java.lang.String graphName)
Returns the validated graph name
|
static java.lang.String |
getValidatedGraphName(java.sql.Connection conn, java.lang.String graphName, int maxLengthAllowed)
Returns the validated graph name
|
static java.lang.String |
myCheckName(java.lang.String string)
Checks for any illegal characters in a SQL name.
|
static java.lang.String |
qualifiedSQLName(java.sql.Connection conn, java.lang.String name)
Checks if the specified name is a qualified SQL name.
|
static java.lang.String |
sanitizeSimpleFileName(java.lang.String fileName)
do sanity checking to the filename, only allowed characters can appear in the file name
|
static java.lang.String |
simpleSqlNameCheck(java.sql.Connection conn, java.lang.String name)
This method returns the result of OracleStatement.enquoteIdentifier function: If identifier is a simple SQL identifier, the original value is returned A SQLException will be thrown if identifier contains any characters invalid in a delimited identifier or the identifier length is invalid for the datasource.
|
public static java.lang.String checkSQLName(java.lang.String string, int maxStringLength) throws java.sql.SQLException
string
- input stringmaxStringLength
- maximum length for input stringjava.sql.SQLException
- An exception is thrown if the input string contains any illegal characters or exceeds the maximum lengthpublic static boolean compareDates(java.lang.Object o1, java.lang.Object o2)
o1
- must be either a Date object or Stringo2
- must be either a Date object or Stringpublic static java.lang.String enquoteColumnName(java.sql.Connection conn, java.lang.String columnName) throws java.sql.SQLException
conn
-columnName
-java.sql.SQLException
public static java.lang.String enquoteColumnNameCaseSensitive(java.sql.Connection conn, java.lang.String name) throws java.sql.SQLException
java.sql.SQLException
public static java.lang.String enquoteLiteral(java.sql.Connection conn, java.lang.String name) throws java.sql.SQLException
conn
- the database connectionname
- the input literaljava.sql.SQLException
- A SQLexception is thrown if the dbms_assert.qualified_sql_name failedpublic static java.lang.String enquoteLiteral(java.sql.Connection conn, java.lang.String literal, int maxLengthAllowed) throws java.sql.SQLException
conn
- the database connectionliteral
- the input namejava.sql.SQLException
public static java.lang.String enquoteNameSQLName(java.sql.Connection conn, java.lang.String name) throws java.sql.SQLException
conn
- the database connectionname
- the input namejava.sql.SQLException
public static java.lang.String enquoteTableName(java.sql.Connection conn, java.lang.String tableName) throws java.sql.SQLException
conn
-tableName
-java.sql.SQLException
public static int getMaxLengthAllowed()
public static java.lang.String getValidatedGraphName(java.sql.Connection conn, java.lang.String graphName) throws java.sql.SQLException
conn
- the database connectiongraphName
- the input graph namejava.sql.SQLException
public static java.lang.String getValidatedGraphName(java.sql.Connection conn, java.lang.String graphName, int maxLengthAllowed) throws java.sql.SQLException
conn
- the database connectiongraphName
- the input graph namejava.sql.SQLException
public static java.lang.String myCheckName(java.lang.String string) throws java.sql.SQLException
string
- input stringjava.sql.SQLException
- An exception is thrown if the input string contains any illegal characters or exceeds the maximum lengthpublic static java.lang.String qualifiedSQLName(java.sql.Connection conn, java.lang.String name) throws java.sql.SQLException
conn
- the database connectionname
- the input namejava.sql.SQLException
- A SQLexception is thrown if the dbms_assert.qualified_sql_name failedpublic static java.lang.String sanitizeSimpleFileName(java.lang.String fileName) throws java.lang.IllegalArgumentException
fileName
-java.lang.IllegalArgumentException
public static java.lang.String simpleSqlNameCheck(java.sql.Connection conn, java.lang.String name) throws java.sql.SQLException
conn
- the database connectionname
- the input literaljava.sql.SQLException
- A SQLexception is thrown if the assertion failedCopyright © 2017, 2018 Oracle and/or its affiliates. All Rights Reserved.