|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jfw.database.ReadDbData
public final class ReadDbData
Offers methods for read data from a ResultSet.
Some methods are explicity create for the Parser
.
All public methods are static and thread safe.
Field Summary | |
---|---|
static java.lang.String |
ALL_ROWS_KEY
Key paired with container of data readed from db. |
static java.lang.String |
COLUMN_NAME_KEY
Key paired with the name of a column. |
static java.lang.String |
COLUMNS_NAMES_KEY
Key paired with columns names. |
static java.lang.String |
GROUP_BY_ROWS
Key paired with container of data readed from db. |
static java.lang.String |
GROUP_BY_ROWS_COUNT
Key paired with number of rows from db. |
static java.lang.String |
GROUP_SUFFIX
Suffix for readed rows key. |
static java.lang.String |
READED_ROWS_SUFFIX
Suffix for readed rows key. |
static java.lang.String |
ROW_ODD
Value for odd rows, used for key ROW_TYPE . |
static java.lang.String |
ROW_PAR
Value for par rows, used for key ROW_TYPE . |
static java.lang.String |
ROW_TYPE
Key paired with row type value. |
static java.lang.String |
SKIPPED_ROWS_SUFFIX
Suffix for readed rows key. |
static java.lang.String |
TOTAL_ROWS_SUFFIX
Suffix for total rows key. |
Constructor Summary | |
---|---|
ReadDbData()
|
Method Summary | |
---|---|
static byte[] |
getBLOB(java.sql.ResultSet resultSet,
int index)
Read a column BLOB. |
static byte[] |
getBLOB(java.sql.ResultSet resultSet,
java.lang.String name)
Read a column BLOB. |
static java.lang.StringBuilder |
getCLOB(java.sql.CallableStatement callable,
int index)
Read a column CLOB. |
static java.lang.StringBuilder |
getCLOB(oracle.sql.CLOB clob)
Read a column CLOB. |
static java.lang.StringBuilder |
getCLOB(java.sql.ResultSet resultSet,
int index)
Read a column CLOB. |
static java.lang.StringBuilder |
getCLOB(java.sql.ResultSet resultSet,
java.lang.String name)
Read a column CLOB. |
static int |
getColumns(java.sql.ResultSet res,
java.util.ArrayList columnsNames,
java.lang.String groupBy)
Get the names of the columns and save them in the columnsNames parameter. |
static java.util.ArrayList |
getColumns4Parser(java.util.ArrayList columnsNames)
Transform an ArrayList with the names of the columns in an ArrayList of HashMaps with the names of the columns. |
static void |
result2Hash(java.sql.ResultSet res,
java.util.HashMap hashContainer)
Use method result2Hash(ResultSet,HashMap,String,boolean,String) to read data. |
static void |
result2Hash(java.sql.ResultSet res,
java.util.HashMap hashContainer,
java.lang.String listName)
Use method result2Hash(ResultSet,HashMap,String,boolean,String) to read data. |
static void |
result2Hash(java.sql.ResultSet res,
java.util.HashMap hashContainer,
java.lang.String listName,
boolean escape,
java.lang.String groupBy)
Use method result2Hash(ResultSet,HashMap,String,boolean,String,int,int) to read data. |
static void |
result2Hash(java.sql.ResultSet res,
java.util.HashMap hashContainer,
java.lang.String listName,
boolean escape,
java.lang.String groupBy,
int rows2Read,
int firstRow)
Save all rows returned by the query in a "data container" compatible with the Parser . |
static void |
result2Hash(java.sql.ResultSet res,
java.util.HashMap hashContainer,
java.lang.String listName,
int rows2Read,
int firstRow)
Use method result2Hash(ResultSet,HashMap,String,boolean,String,int,int) to read data. |
static void |
result2Hash(java.sql.ResultSet res,
java.util.HashMap hashContainer,
java.lang.String listName,
java.lang.String groupBy)
Use method result2Hash(ResultSet,HashMap,String,boolean,String) to read data. |
static void |
setColumns4Parser(java.util.ArrayList columnsNames,
java.util.HashMap hashContainer)
Set the columns names under key COLUMNS_NAMES_KEY in the HashMap
container. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ROW_TYPE
public static final java.lang.String ROW_ODD
ROW_TYPE
.
public static final java.lang.String ROW_PAR
ROW_TYPE
.
public static final java.lang.String GROUP_BY_ROWS
public static final java.lang.String GROUP_BY_ROWS_COUNT
public static final java.lang.String ALL_ROWS_KEY
public static final java.lang.String COLUMNS_NAMES_KEY
public static final java.lang.String COLUMN_NAME_KEY
public static final java.lang.String TOTAL_ROWS_SUFFIX
public static final java.lang.String READED_ROWS_SUFFIX
public static final java.lang.String GROUP_SUFFIX
public static final java.lang.String SKIPPED_ROWS_SUFFIX
Constructor Detail |
---|
public ReadDbData()
Method Detail |
---|
public static void result2Hash(java.sql.ResultSet res, java.util.HashMap hashContainer, java.lang.String listName, boolean escape, java.lang.String groupBy, int rows2Read, int firstRow) throws DatabaseException
Parser
.
res
- a ResultSet object.hashContainer
- the HasMap containing the ArrayList of HashMaps. The
default key to use, if parameter listName is null, is
ALL_ROWS_KEY
.listName
- the key value for the ArrayList of HashMaps.escape
- if true the data are escapedusing the method escape(java.lang.String)
.groupBy
- the column name to group by.rows2Read
- max number of rows to read. If the value is -1 then
all the available rows will be read.firstRow
- the first row to read. The first row index is 1.
DatabaseException
public static void result2Hash(java.sql.ResultSet res, java.util.HashMap hashContainer, java.lang.String listName, boolean escape, java.lang.String groupBy) throws DatabaseException
result2Hash(ResultSet,HashMap,String,boolean,String,int,int)
to read data.
DatabaseException
public static void result2Hash(java.sql.ResultSet res, java.util.HashMap hashContainer, java.lang.String listName, int rows2Read, int firstRow) throws DatabaseException
result2Hash(ResultSet,HashMap,String,boolean,String,int,int)
to read data.
DatabaseException
public static void result2Hash(java.sql.ResultSet res, java.util.HashMap hashContainer, java.lang.String listName) throws DatabaseException
result2Hash(ResultSet,HashMap,String,boolean,String)
to read data.
DatabaseException
public static void result2Hash(java.sql.ResultSet res, java.util.HashMap hashContainer) throws DatabaseException
result2Hash(ResultSet,HashMap,String,boolean,String)
to read data.
DatabaseException
public static void result2Hash(java.sql.ResultSet res, java.util.HashMap hashContainer, java.lang.String listName, java.lang.String groupBy) throws DatabaseException
result2Hash(ResultSet,HashMap,String,boolean,String)
to read data.
The value of parameter escape is false.
DatabaseException
public static int getColumns(java.sql.ResultSet res, java.util.ArrayList columnsNames, java.lang.String groupBy) throws java.lang.Exception
res
- a ResultSet object.columnsNames
- the names of the columns in uppercase. The position 0
of the array is always the blank space(""). The parameter mustn't be null.groupBy
- the name of column to groyp by.
java.lang.Exception
public static java.util.ArrayList getColumns4Parser(java.util.ArrayList columnsNames)
columnsNames
- the ArrayList with the names of the columns.
COLUMN_NAME_KEY
public static void setColumns4Parser(java.util.ArrayList columnsNames, java.util.HashMap hashContainer)
COLUMNS_NAMES_KEY
in the HashMap
container.
columnsNames
- ArrayList of HashMaps with the names of the columns.hashContainer
- the container of the data.public static java.lang.StringBuilder getCLOB(oracle.sql.CLOB clob) throws DatabaseException
clob
- the CLOB object to read.
DatabaseException
public static java.lang.StringBuilder getCLOB(java.sql.ResultSet resultSet, int index) throws DatabaseException
resultSet
- a ResultSet object.index
- the position on ResultSet of the CLOB column.
DatabaseException
public static java.lang.StringBuilder getCLOB(java.sql.CallableStatement callable, int index) throws DatabaseException
callable
- a CallableStatement object.index
- the position on ResultSet of the CLOB column.
DatabaseException
public static java.lang.StringBuilder getCLOB(java.sql.ResultSet resultSet, java.lang.String name) throws DatabaseException
resultSet
- a ResultSet object.name
- the name on ResultSet of the CLOB column.
DatabaseException
public static byte[] getBLOB(java.sql.ResultSet resultSet, java.lang.String name) throws DatabaseException
resultSet
- a ResultSet object.name
- the name on ResultSet of the BLOB column.
DatabaseException
public static byte[] getBLOB(java.sql.ResultSet resultSet, int index) throws DatabaseException
resultSet
- a ResultSet object.index
- the index on ResultSet of the BLOB column.
DatabaseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |