OracleDBUtilpublic class Utility
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
protected java.sql.Connection |
dbConnection |
Represents the connection object that is used by the class to execute SQL
statements
|
static int |
ERR_CATEGORY_CONNECTION |
|
static int |
ERR_CATEGORY_SQL |
|
static int |
ERR_CATEGORY_STORED_PROCEDURES_ERROR |
|
static int |
ERR_CATEGORY_STORED_PROCEDURES_RECOMPILED |
|
static int |
EXCEPTION_CONNECTION_RESET |
|
static int |
EXCEPTION_CONNECTION_SHUT |
|
protected DBErrorHandler |
handler |
Handles the errors regarding this connection
|
protected DBIOHandler |
ioHandler |
|
protected DBConnection |
smyldDbConnection |
| Constructor | Description |
|---|---|
Utility(DBConnection activeDBConnection,
DBErrorHandler e) |
Constructs the class with the given connection object to be used for the
execution of statements
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
closeCursor(java.sql.PreparedStatement stRecords) |
Close the cursor opened through the given prepared statement object
|
void |
closeCursor(java.sql.ResultSet rsRecords) |
Close the cursor opened through the given result set object
|
static java.lang.String |
constructDoubleParamFunctionCall(java.lang.String functionName) |
|
static java.lang.String |
constructDoubleParamProcedureCall(java.lang.String ProcedureName) |
|
static java.lang.String |
constructMultiParamFunctionCall(java.lang.String functionName,
int paramsNo) |
|
static java.lang.String |
constructMultiParamProcedureCall(java.lang.String ProcedureName,
int paramsNo) |
|
static java.lang.String |
constructSingleParamFunctionCall(java.lang.String functionName) |
|
static java.lang.String |
constructSingleParamProcedureCall(java.lang.String ProcedureName) |
|
static java.lang.String |
constructTrippleParamFunctionCall(java.lang.String functionName) |
|
static java.lang.String |
constructTrippleParamProcedureCall(java.lang.String ProcedureName) |
|
java.lang.String |
createInsertSQL(java.lang.String tableName) |
|
java.lang.String |
detectLongFieldError(java.sql.PreparedStatement st) |
|
boolean |
doDoubleParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText) |
To invoke the given sql and set the given 2 parameters using execute
method
|
int |
doDoubleParamUpdateSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText) |
To invoke the given sql and set the given 2 parameters using
executeUpdate method
|
int |
doQuadParamUpdateSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String fourthParam,
java.lang.String sqlText) |
To invoke the given sql and set the given 3 parameters using
executeUpdate method
|
boolean |
doSingleParamSQL(int firstParam,
java.lang.String sqlText) |
To invoke the given sql and set the given integer parameter using execute
method
|
boolean |
doSingleParamSQL(java.lang.String firstParam,
java.lang.String sqlText) |
To invoke the given sql and set the given string parameter using execute
method
|
int |
doSingleParamUpdateSQL(java.lang.String firstParam,
java.lang.String sqlText) |
To invoke the given sql and set the given string parameter using
executeUpdate method and returns the affected records number
|
int |
doTrippleParamUpdateSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String sqlText) |
To invoke the given sql and set the given 3 parameters using
executeUpdate method
|
void |
executeDoubleParamFunction(java.lang.String function,
int param1,
int param2) |
|
void |
executeDoubleParamFunction(java.lang.String function,
java.lang.String param1,
java.lang.String param2) |
|
void |
executeDoubleParamProcedure(java.lang.String procedure,
int param1,
int param2) |
|
void |
executeDoubleParamProcedure(java.lang.String procedure,
java.lang.String param1,
java.lang.String param2) |
|
void |
executeMultiParamProcedure(java.lang.String procedure,
java.lang.String[] params) |
|
java.sql.ResultSet |
executeQuery(java.lang.String sqlText) |
To invoke the given sql using executeQuery method
|
void |
executeTrippleParamFunction(java.lang.String function,
java.lang.String param1,
java.lang.String param2,
java.lang.String param3) |
|
void |
executeTrippleParamProcedure(java.lang.String procedure,
java.lang.String param1,
int param2,
int param3) |
|
java.sql.ResultSet |
fetchTableData(java.lang.String tableName) |
Fetches the all the records of the given table with out any conditions
|
java.util.HashMap<java.lang.String,Field> |
FetchTableFields(java.lang.String TableName,
java.lang.String FieldName,
java.lang.String FieldValue) |
Fetchs the given table name data and returns HashMap object containing
org.smyld.db.Field objects created upon the given field Name/Value pair
(represents 2 column names in the given table name)
|
void |
FillColumnNames(java.sql.ResultSetMetaData rsMetaData,
java.util.HashMap<java.lang.String,java.lang.Integer> results) |
|
java.sql.Connection |
getConnection() |
|
int |
getCount(java.sql.ResultSet rs) |
|
java.sql.ResultSet |
getDoubleParamSQL(int firstParam,
int secondParam,
java.lang.String sqlText) |
To invoke the given sql using executeQuery method,setting the given 2
parameter and returning the resultant result set
|
java.sql.ResultSet |
getDoubleParamSQL(int firstParam,
java.lang.String secondParam,
java.lang.String sqlText) |
To invoke the given sql using executeQuery method,setting the given 2
parameter and returning the resultant result set
|
java.sql.ResultSet |
getDoubleParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText) |
To invoke the given sql using executeQuery method,setting the given 2
parameter and returning the resultant result set
|
static int |
getErrorCategory(java.lang.Exception ex) |
|
protected static java.lang.String |
getParamsText(int paramsNo) |
|
java.sql.ResultSet |
getQuadParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String fourthParam,
java.lang.String sqlText) |
|
int |
getSequenceValue(java.lang.String seqName) |
|
int |
getSequentialID(java.lang.String tableName,
java.lang.String idColName) |
Calculate the value of the given column name in the given table and
increase it by one.
|
int |
getSequentialID(java.lang.String tableName,
java.lang.String idColName,
java.lang.String whereColumnName,
java.lang.String whereColumnValue) |
Calculate the value of the given column name in the given table and
increase it by one.
|
java.sql.ResultSet |
getSingleParamSQL(java.lang.String paramValue,
java.lang.String sqlText) |
To invoke the given sql using executeQuery method,setting the given
parameter and returning the resultant result set
|
java.lang.String |
getSingleParamSQLData(java.lang.String firstParam,
java.lang.String sqlText,
java.lang.String columnName) |
To invoke the given sql using class getSingleParamSQL method,setting the
given parameter and returning the gievn column name value
|
java.lang.String |
getSQLData(java.lang.String sqlText,
java.lang.String columnName) |
To invoke the given sql using class executeQuery method, and returning
the gievn column name value
|
java.sql.ResultSet |
getSQLResultSet(java.lang.String sqlText) |
|
static java.lang.String |
getStringIndex(int digitWidth,
int index) |
Returns the index represented as the required number of digit text.
|
java.util.Vector<TableColumn> |
getTableCols(java.lang.String tableName) |
|
java.sql.ResultSet |
getTrippleParamSQL(int firstParam,
int secondParam,
java.lang.String thirdParam,
java.lang.String sqlText) |
To invoke the given sql and set the given 3 parameters using executeQuery
method and returns the resultant result set
|
java.sql.ResultSet |
getTrippleParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String sqlText) |
To invoke the given sql and set the given 3 parameters using executeQuery
method and returns the resultant result set
|
void |
handleDBError(java.lang.Exception ex) |
|
void |
importFile(java.lang.String targetTable,
java.lang.String fileName) |
|
boolean |
isDoubleExist(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText) |
Checking if the given double parameter sql statement contains records or
not
|
boolean |
isExist(java.lang.String sqlText) |
Checking if the given single parameter sql statement contains records or
not
|
boolean |
isExist(java.sql.ResultSet rsRecords) |
Checking if the given result set contains records or not
|
boolean |
isSingleExist(java.lang.String firstParam,
java.lang.String sqlText) |
Checking if the given single parameter sql statement contains records or
not
|
boolean |
isTrippleExist(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String sqlText) |
Checking if the given tripple parameter sql statement contains records or
not
|
void |
setSMYLDConnection(DBConnection activeConnection) |
protected java.sql.Connection dbConnection
protected DBConnection smyldDbConnection
protected DBIOHandler ioHandler
protected DBErrorHandler handler
public static final int ERR_CATEGORY_SQL
public static final int ERR_CATEGORY_CONNECTION
public static final int ERR_CATEGORY_STORED_PROCEDURES_RECOMPILED
public static final int ERR_CATEGORY_STORED_PROCEDURES_ERROR
public static final int EXCEPTION_CONNECTION_RESET
public static final int EXCEPTION_CONNECTION_SHUT
public Utility(DBConnection activeDBConnection, DBErrorHandler e)
activeConnection - the active data base connection objecte - the error handler object that takes care of the errors raised
during this connectionpublic void closeCursor(java.sql.ResultSet rsRecords)
rsRecords - the result set of the opened cursorpublic void closeCursor(java.sql.PreparedStatement stRecords)
stRecords - the prepared statement of the opened cursorpublic boolean doDoubleParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuesqlText - the SQL statementpublic void setSMYLDConnection(DBConnection activeConnection)
public int doDoubleParamUpdateSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuesqlText - the SQL statementpublic boolean doSingleParamSQL(int firstParam,
java.lang.String sqlText)
firstParam - the first parameter valuesqlText - the SQL statementpublic java.lang.String detectLongFieldError(java.sql.PreparedStatement st)
throws java.sql.SQLException
java.sql.SQLExceptionpublic int doTrippleParamUpdateSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuethirdParam - the third parameter valuesqlText - the SQL statementpublic int doQuadParamUpdateSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String fourthParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuethirdParam - the third parameter valuesqlText - the SQL statementpublic java.sql.ResultSet getTrippleParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuethirdParam - the third parameter valuesqlText - the SQL statementpublic java.sql.ResultSet getQuadParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String fourthParam,
java.lang.String sqlText)
public java.sql.ResultSet getTrippleParamSQL(int firstParam,
int secondParam,
java.lang.String thirdParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuethirdParam - the third parameter valuesqlText - the SQL statementpublic int doSingleParamUpdateSQL(java.lang.String firstParam,
java.lang.String sqlText)
firstParam - the first parameter valuesqlText - the SQL statementpublic boolean doSingleParamSQL(java.lang.String firstParam,
java.lang.String sqlText)
firstParam - the first parameter valuesqlText - the SQL statementpublic java.sql.ResultSet executeQuery(java.lang.String sqlText)
sqlText - the SQL statementpublic java.lang.String getSQLData(java.lang.String sqlText,
java.lang.String columnName)
sqlText - the SQL statementcolumnName - the column name of the desired column valuepublic java.lang.String getSingleParamSQLData(java.lang.String firstParam,
java.lang.String sqlText,
java.lang.String columnName)
firstParam - the first parameter valuesqlText - the SQL statementcolumnName - the column name of the desired column valuepublic int getCount(java.sql.ResultSet rs)
public java.sql.ResultSet getSingleParamSQL(java.lang.String paramValue,
java.lang.String sqlText)
firstParam - the first parameter valuesqlText - the SQL statementpublic java.sql.ResultSet getSQLResultSet(java.lang.String sqlText)
public java.sql.ResultSet getDoubleParamSQL(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuesqlText - the SQL statementpublic java.sql.ResultSet getDoubleParamSQL(int firstParam,
java.lang.String secondParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuesqlText - the SQL statementpublic java.sql.ResultSet getDoubleParamSQL(int firstParam,
int secondParam,
java.lang.String sqlText)
firstParam - the first parameter valuesecondParam - the second parameter valuesqlText - the SQL statementpublic int getSequentialID(java.lang.String tableName,
java.lang.String idColName)
tableName - required table namepublic int getSequentialID(java.lang.String tableName,
java.lang.String idColName,
java.lang.String whereColumnName,
java.lang.String whereColumnValue)
tableName - required table namepublic int getSequenceValue(java.lang.String seqName)
public boolean isExist(java.sql.ResultSet rsRecords)
rsRecords - The result set to be checkedpublic boolean isSingleExist(java.lang.String firstParam,
java.lang.String sqlText)
firstParam - The first parameter valuesqlText - The SQL textpublic boolean isExist(java.lang.String sqlText)
firstParam - The first parameter valuesqlText - The SQL textpublic boolean isDoubleExist(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String sqlText)
firstParam - The first parameter valuesecondParam - The second parameter valuesqlText - The SQL textpublic boolean isTrippleExist(java.lang.String firstParam,
java.lang.String secondParam,
java.lang.String thirdParam,
java.lang.String sqlText)
firstParam - The first parameter valuesecondParam - The second parameter valuethirdParam - The third parameter valuesqlText - The SQL textpublic java.sql.ResultSet fetchTableData(java.lang.String tableName)
tableName - commentspublic java.util.HashMap<java.lang.String,Field> FetchTableFields(java.lang.String TableName, java.lang.String FieldName, java.lang.String FieldValue)
TableName - the target table of dataFieldName - the target table column representing the field NameFieldValue - the target table column representing the field Valuepublic void FillColumnNames(java.sql.ResultSetMetaData rsMetaData,
java.util.HashMap<java.lang.String,java.lang.Integer> results)
public static java.lang.String getStringIndex(int digitWidth,
int index)
digitWidth - the width of the required digitspublic void handleDBError(java.lang.Exception ex)
public static java.lang.String constructSingleParamProcedureCall(java.lang.String ProcedureName)
public static java.lang.String constructDoubleParamProcedureCall(java.lang.String ProcedureName)
public static java.lang.String constructTrippleParamProcedureCall(java.lang.String ProcedureName)
public static java.lang.String constructSingleParamFunctionCall(java.lang.String functionName)
public static java.lang.String constructDoubleParamFunctionCall(java.lang.String functionName)
public static java.lang.String constructTrippleParamFunctionCall(java.lang.String functionName)
public static java.lang.String constructMultiParamFunctionCall(java.lang.String functionName,
int paramsNo)
public static java.lang.String constructMultiParamProcedureCall(java.lang.String ProcedureName,
int paramsNo)
protected static java.lang.String getParamsText(int paramsNo)
public void executeDoubleParamFunction(java.lang.String function,
java.lang.String param1,
java.lang.String param2)
public void executeTrippleParamFunction(java.lang.String function,
java.lang.String param1,
java.lang.String param2,
java.lang.String param3)
public void executeDoubleParamFunction(java.lang.String function,
int param1,
int param2)
public void executeMultiParamProcedure(java.lang.String procedure,
java.lang.String[] params)
public void executeDoubleParamProcedure(java.lang.String procedure,
int param1,
int param2)
public void executeDoubleParamProcedure(java.lang.String procedure,
java.lang.String param1,
java.lang.String param2)
public void executeTrippleParamProcedure(java.lang.String procedure,
java.lang.String param1,
int param2,
int param3)
public java.sql.Connection getConnection()
public void importFile(java.lang.String targetTable,
java.lang.String fileName)
throws java.lang.Exception
java.lang.Exceptionpublic static int getErrorCategory(java.lang.Exception ex)
public java.lang.String createInsertSQL(java.lang.String tableName)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.Vector<TableColumn> getTableCols(java.lang.String tableName) throws java.sql.SQLException
java.sql.SQLExceptionCopyright © 2019 SMYLD. All rights reserved.