Package com.opencsv
Class ResultSetHelperService
- java.lang.Object
-
- com.opencsv.ResultSetHelperService
-
- All Implemented Interfaces:
ResultSetHelper
- Direct Known Subclasses:
ResultSetColumnNameHelperService
public class ResultSetHelperService extends java.lang.Object implements ResultSetHelper
Helper class for processing JDBC ResultSet objects.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
CLOBBUFFERSIZE
-
Constructor Summary
Constructors Constructor Description ResultSetHelperService()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
getColumnNames(java.sql.ResultSet rs)
Returns the column names from the ResultSet.java.lang.String[]
getColumnValues(java.sql.ResultSet rs)
Returns the column values from the result set.java.lang.String[]
getColumnValues(java.sql.ResultSet rs, boolean trim)
Returns the column values from the result set with the values trimmed if desired.java.lang.String[]
getColumnValues(java.sql.ResultSet rs, boolean trim, java.lang.String dateFormatString, java.lang.String timeFormatString)
Returns the column values from the result set with the values trimmed if desired.protected java.lang.String
handleTimestamp(java.sql.Timestamp timestamp, java.lang.String timestampFormatString)
The formatted timestamp.void
setDateFormat(java.lang.String dateFormat)
Set a default date format pattern that will be used by the service.void
setDateTimeFormat(java.lang.String dateTimeFormat)
Set a default date time format pattern that will be used by the service.
-
-
-
Field Detail
-
CLOBBUFFERSIZE
protected static final int CLOBBUFFERSIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setDateFormat
public void setDateFormat(java.lang.String dateFormat)
Set a default date format pattern that will be used by the service.- Parameters:
dateFormat
- Desired date format
-
setDateTimeFormat
public void setDateTimeFormat(java.lang.String dateTimeFormat)
Set a default date time format pattern that will be used by the service.- Parameters:
dateTimeFormat
- Desired date time format
-
getColumnNames
public java.lang.String[] getColumnNames(java.sql.ResultSet rs) throws java.sql.SQLException
Description copied from interface:ResultSetHelper
Returns the column names from the ResultSet.- Specified by:
getColumnNames
in interfaceResultSetHelper
- Parameters:
rs
- ResultSet- Returns:
- String array containing the column names.
- Throws:
java.sql.SQLException
- Thrown by the ResultSet.
-
getColumnValues
public java.lang.String[] getColumnValues(java.sql.ResultSet rs) throws java.sql.SQLException, java.io.IOException
Description copied from interface:ResultSetHelper
Returns the column values from the result set.- Specified by:
getColumnValues
in interfaceResultSetHelper
- Parameters:
rs
- The ResultSet containing the values.- Returns:
- String array containing the values.
- Throws:
java.sql.SQLException
- Thrown by the ResultSet.java.io.IOException
- Thrown by the ResultSet.
-
getColumnValues
public java.lang.String[] getColumnValues(java.sql.ResultSet rs, boolean trim) throws java.sql.SQLException, java.io.IOException
Description copied from interface:ResultSetHelper
Returns the column values from the result set with the values trimmed if desired.- Specified by:
getColumnValues
in interfaceResultSetHelper
- Parameters:
rs
- The ResultSet containing the values.trim
- Values should have white spaces trimmed.- Returns:
- String array containing the values.
- Throws:
java.sql.SQLException
- Thrown by the ResultSet.java.io.IOException
- Thrown by the ResultSet.
-
getColumnValues
public java.lang.String[] getColumnValues(java.sql.ResultSet rs, boolean trim, java.lang.String dateFormatString, java.lang.String timeFormatString) throws java.sql.SQLException, java.io.IOException
Description copied from interface:ResultSetHelper
Returns the column values from the result set with the values trimmed if desired. Also format the date and time columns based on the format strings passed in.- Specified by:
getColumnValues
in interfaceResultSetHelper
- Parameters:
rs
- The ResultSet containing the values.trim
- Values should have white spaces trimmed.dateFormatString
- Format string for dates.timeFormatString
- Format string for timestamps.- Returns:
- String array containing the values.
- Throws:
java.sql.SQLException
- Thrown by the ResultSet.java.io.IOException
- Thrown by the ResultSet.
-
handleTimestamp
protected java.lang.String handleTimestamp(java.sql.Timestamp timestamp, java.lang.String timestampFormatString)
The formatted timestamp.- Parameters:
timestamp
- Timestamp read from resultsettimestampFormatString
- Format string- Returns:
- Formatted time stamp.
-
-