public class ResultSetHelperService extends Object implements ResultSetHelper
Modifier and Type | Field and Description |
---|---|
protected static int |
CLOBBUFFERSIZE |
protected String |
dateFormat |
protected String |
dateTimeFormat |
protected NumberFormat |
floatingPointFormat |
protected NumberFormat |
integerFormat |
Constructor and Description |
---|
ResultSetHelperService()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
String[] |
getColumnNames(ResultSet rs)
Returns the column names from the ResultSet.
|
String[] |
getColumnValues(ResultSet rs)
Returns the column values from the result set.
|
String[] |
getColumnValues(ResultSet rs,
boolean trim)
Returns the column values from the result set with the values trimmed if desired.
|
String[] |
getColumnValues(ResultSet rs,
boolean trim,
String dateFormatString,
String timeFormatString)
Returns the column values from the result set with the values trimmed if desired.
|
protected String |
handleClob(ResultSet rs,
int colIndex)
retrieves the data out of a CLOB
|
protected String |
handleDate(ResultSet rs,
int colIndex,
String dateFormatString)
retrieves an date from a result set
|
protected String |
handleNClob(ResultSet rs,
int colIndex)
retrieves the data out of a NCLOB
|
protected String |
handleNVarChar(ResultSet rs,
int colIndex,
boolean trim)
retrieves the data from an NVarChar in a result set
|
protected String |
handleTimestamp(Timestamp timestamp,
String timestampFormatString)
The formatted timestamp.
|
protected String |
handleVarChar(ResultSet rs,
int colIndex,
boolean trim)
retrieves the data from an VarChar in a result set
|
void |
setDateFormat(String dateFormat)
Set a default date format pattern that will be used by the service.
|
void |
setDateTimeFormat(String dateTimeFormat)
Set a default date time format pattern that will be used by the service.
|
void |
setFloatingPointFormat(NumberFormat format)
Set a default number formatter for integer numbers that will be used by the service.
|
void |
setIntegerFormat(NumberFormat format)
Set a default number formatter for floating point numbers that will be used by the service.
|
protected static final int CLOBBUFFERSIZE
protected String dateFormat
protected String dateTimeFormat
protected NumberFormat integerFormat
protected NumberFormat floatingPointFormat
public void setDateFormat(String dateFormat)
dateFormat
- Desired date formatpublic void setDateTimeFormat(String dateTimeFormat)
dateTimeFormat
- Desired date time formatpublic void setIntegerFormat(NumberFormat format)
format
- Desired number format. Should not be nullpublic void setFloatingPointFormat(NumberFormat format)
format
- Desired number format. Should not be nullpublic String[] getColumnNames(ResultSet rs) throws SQLException
ResultSetHelper
getColumnNames
in interface ResultSetHelper
rs
- ResultSetSQLException
- Thrown by the ResultSet.public String[] getColumnValues(ResultSet rs) throws SQLException, IOException
ResultSetHelper
getColumnValues
in interface ResultSetHelper
rs
- The ResultSet containing the values.SQLException
- Thrown by the ResultSet.IOException
- Thrown by the ResultSet.public String[] getColumnValues(ResultSet rs, boolean trim) throws SQLException, IOException
ResultSetHelper
getColumnValues
in interface ResultSetHelper
rs
- The ResultSet containing the values.trim
- Values should have white spaces trimmed.SQLException
- Thrown by the ResultSet.IOException
- Thrown by the ResultSet.public String[] getColumnValues(ResultSet rs, boolean trim, String dateFormatString, String timeFormatString) throws SQLException, IOException
ResultSetHelper
getColumnValues
in interface ResultSetHelper
rs
- The ResultSet containing the values.trim
- Values should have white spaces trimmed.dateFormatString
- Format string for dates.timeFormatString
- Format string for timestamps.SQLException
- Thrown by the ResultSet.IOException
- Thrown by the ResultSet.protected String handleTimestamp(Timestamp timestamp, String timestampFormatString)
timestamp
- Timestamp read from resultsettimestampFormatString
- Format stringprotected String handleVarChar(ResultSet rs, int colIndex, boolean trim) throws SQLException
rs
- - result setcolIndex
- - column location of the data in the result settrim
- - should the value be trimmed before being returnedSQLException
protected String handleNVarChar(ResultSet rs, int colIndex, boolean trim) throws SQLException
rs
- - result setcolIndex
- - column location of the data in the result settrim
- - should the value be trimmed before being returnedSQLException
protected String handleDate(ResultSet rs, int colIndex, String dateFormatString) throws SQLException
rs
- - result setcolIndex
- - column location of the data in the result setdateFormatString
- - desired format of the dateSQLException
protected String handleClob(ResultSet rs, int colIndex) throws SQLException, IOException
rs
- - result setcolIndex
- - column location of the data in the result setSQLException
IOException
protected String handleNClob(ResultSet rs, int colIndex) throws SQLException, IOException
rs
- - result setcolIndex
- - column location of the data in the result setSQLException
IOException
Copyright © 2005–2023. All rights reserved.