public final class DBSubset
extends java.util.Vector<java.util.Vector<java.lang.Object>>
A bidimensional array representing data readed from a database table.
The DBSubset object is used for reading a collection of registers from the database and kept them in memory for inmediate access. As hipergate reuses database connections by recycling them at theJDCConnectionPool
,
it is a good programming practice to read just the needed number of registers in a single
step operation and then free the connection as soon as possible for being used by another processs.
Another reason for this "read fast and leave" tactic is that some JDBC drivers have problems
managing multiple open resultsets with pending results in a single connection.Modifier and Type | Class and Description |
---|---|
class |
DBSubset.DBSubsetDateGroup |
Constructor and Description |
---|
DBSubset(java.lang.String sTableName,
java.lang.String sColumnList,
java.lang.String sFilterClause,
int iFetchSize)
Contructs a DBSubset.
|
Modifier and Type | Method and Description |
---|---|
int |
binaryFind(int iCol,
java.lang.Comparable oVal)
Find a Comparable object using binary search
The searched column must have been previously sorted in ascending order.
|
int |
call(JDCConnection oConn)
Execute a stored procedure returning a ResultSet
|
int |
call(JDCConnection oConn,
int iSkip)
Execute a stored procedure returning a ResultSet
|
int |
call(JDCConnection oConn,
java.lang.Object[] aFilterValues)
Execute a stored procedure returning a ResultSet
|
int |
call(JDCConnection oConn,
java.lang.Object[] aFilterValues,
int iSkip)
Execute a stored procedure returning a ResultSet
|
int |
clear(java.sql.Connection oConn,
java.lang.Object[] aFilterValues)
Delete rows from base table
|
java.util.ArrayList |
distinct(int iCol)
Get list of distinct values for a column
If column contains null values, those are never included at the output list
|
void |
ensureCapacity(int nCols,
int nRows)
Pre-allocate a given number of empty rows and columns
|
boolean |
eof() |
int |
find(int iCol,
java.lang.Object oVal)
Find first match of a value in a given column
Value is searched by brute force from the begining to the end of the column.
|
DBMatchSet |
findClose(int iCol,
int iRowGuidCol,
java.lang.String sSought,
int nMaxResults,
boolean bAccents,
float fThreshold)
Find columns lexicographically close to a given one
This method uses Levenshtein distance to compare a given value
with all not null values of a DBSubset column.
|
int |
findi(int iCol,
java.lang.String sVal)
Find a String in a given column using case insensitive search
Value is searched by brute force from the begining to the end of the column.
|
java.lang.Object |
get(int iCol,
int iRow)
Get pre-loaded field
|
java.lang.Object |
get(java.lang.String sCol,
int iRow)
Get pre-loaded field by name
|
boolean |
getBoolean(int iCol,
int iRow)
Get pre-loaded value for a Boolean field
|
java.util.List |
getColumnAsList(int iCol)
Get DBSubset column as a List interface
|
int |
getColumnCount() |
java.lang.String |
getColumnDelimiter() |
java.lang.String |
getColumnName(int iColumnPosition)
Get name for column given its index
|
java.lang.String[] |
getColumnNames()
Get column names
|
int |
getColumnPosition(java.lang.String sColumnName) |
java.util.Date |
getDate(int iCol,
int iRow)
Get pre-loaded value for a Date field
|
java.util.Date |
getDate(java.lang.String sCol,
int iRow)
Get pre-loaded value for a Date field
|
java.lang.String |
getDateFormated(int iCol,
int iRow,
java.text.SimpleDateFormat oFmt)
Get pre-loaded value for a Date field formated with a used defind formar
|
java.lang.String |
getDateFormated(int iCol,
int iRow,
java.lang.String sFormat)
Get pre-loaded value for a Date field formated with a used defind formar
|
java.lang.String |
getDateShort(int iCol,
int iRow)
Get pre-loaded value for a Date field formated as a short Date "yyyy-MM-dd"
|
java.lang.String |
getDateTime(int iCol,
int iRow)
Get pre-loaded value for a Date field formated as a DateTime "yyyy-MM-dd hh:mm:ss"
|
java.lang.String |
getDateTime24(int iCol,
int iRow)
Get pre-loaded value for a Date field formated as a DateTime "yyyy-MM-dd HH:mm:ss"
|
java.math.BigDecimal |
getDecimal(int iCol,
int iRow)
Get pre-loaded value and tries to convert it into a BigDecimal
If column is NULL then null value is returned.
|
java.math.BigDecimal |
getDecimal(java.lang.String sCol,
int iRow)
Get pre-loaded value and tries to convert it into a BigDecimal
|
java.lang.String |
getDecimalFormated(int iCol,
int iRow,
java.lang.String sPattern)
Get decimal formated as a String using the given pattern and the symbols for the default locale
|
java.lang.String |
getDecimalFormated(java.lang.String sCol,
int iRow,
java.lang.String sPattern)
Get decimal formated as a String using the given pattern and the symbols for the default locale
|
double |
getDouble(int iCol,
int iRow)
Get pre-loaded value and tries to convert it into a double
|
float |
getFloat(int iCol,
int iRow)
Get pre-loaded value and tries to convert it into a float
|
float |
getFloat(int iCol,
int iRow,
int iDecimals)
Get pre-loaded value and tries to convert it into a float
|
float |
getFloat(java.lang.String sCol,
int iRow)
Get pre-loaded value and tries to convert it into a Short
|
float |
getFloat(java.lang.String sCol,
int iRow,
int iDecimals)
Get pre-loaded value and tries to convert it into a float
|
int |
getInt(int iCol,
int iRow)
Get pre-loaded value and tries to convert it into a int
|
int |
getInt(java.lang.String sCol,
int iRow)
Get pre-loaded value and tries to convert it into a Short
|
java.lang.Integer |
getInteger(int iCol,
int iRow)
Get pre-loaded value and tries to convert it into an Integer
|
java.lang.Integer |
getInteger(java.lang.String sCol,
int iRow)
Get pre-loaded value and tries to convert it into an Integer
|
long |
getIntervalMilis(int iCol,
int iRow)
Return interval value in miliseconds
This method is only for PostgreSQL 8.0 or later
|
java.lang.Long |
getLong(int iCol,
int iRow)
Get pre-loaded value and tries to convert it into a Long
|
int |
getMaxRows() |
Money |
getMoney(int iCol,
int iRow)
Get value of a VARCHAR field that holds a money+currency amount
Money values are stored with its currency sign embedded inside,
like "26.32 USD" or "$48.3" or "35.44 €"
|
Money |
getMoney(java.lang.String sCol,
int iRow)
Get value of a VARCHAR field that holds a money+currency amount
Money values are stored with its currency sign embedded inside,
like "26.32 USD" or "$48.3" or "35.44 €"
|
int |
getQueryTimeout() |
java.util.List |
getRowAsList(int iRow)
Get DBSubset row as a List interface
|
java.util.HashMap<java.lang.String,java.lang.Object> |
getRowAsMap(int iRow)
Get DBSubset row as a Map interface
|
java.util.Vector |
getRowAsVector(int iRow)
Get DBSubset row as a Vector
|
int |
getRowCount() |
java.lang.String |
getRowDelimiter() |
short |
getShort(int iCol,
int iRow)
Get pre-loaded value and tries to convert it into a Short
|
short |
getShort(java.lang.String sCol,
int iRow)
Get pre-loaded value and tries to convert it into a Short
|
java.sql.Date |
getSQLDate(int iCol,
int iRow)
Get pre-loaded value for a Date field
|
java.sql.Date |
getSQLDate(java.lang.String sCol,
int iRow)
Get pre-loaded value for a Date field
|
java.sql.Time |
getSQLTime(int iCol,
int iRow)
Get pre-loaded value for a Time field
|
java.sql.Time |
getSQLTime(java.lang.String sCol,
int iRow)
Get pre-loaded value for a Time field
|
java.lang.String |
getString(int iCol,
int iRow)
Get toString() form of pre-loaded value
|
java.lang.String |
getString(java.lang.String sCol,
int iRow)
Get toString() form of pre-loaded value
|
java.lang.String |
getStringHtml(int iCol,
int iRow,
java.lang.String sDef)
Get value for a CHAR, VARCHAR or LONGVARCHAR field replacing null
with a default value and replacing non-ASCII and quote values with code;
|
java.lang.String |
getStringNull(int iCol,
int iRow,
java.lang.String sDef)
Get toString() form of pre-loaded value
|
java.lang.String |
getStringNull(java.lang.String sCol,
int iRow,
java.lang.String sDef)
Get toString() form of pre-loaded value
|
DBSubset |
getSubrecords(int nRow)
Get subrecords of a given row of this DBSubset
Subrecords must have been prevoiously loaded by calling loadSubrecords()
|
java.lang.String |
getTextQualifier() |
long |
getTimeMilis(int iCol,
int iRow)
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
java.sql.Time |
getTimeOfDay(int iCol,
int iRow)
Get Time column
|
java.sql.Timestamp |
getTimestamp(int iCol,
int iRow)
Get Timestamp columnn
|
java.util.ArrayList<DBSubset.DBSubsetDateGroup> |
groupByDay(int iDateColumnPosition)
Group rows by day intervals
|
java.util.ArrayList<DBSubset.DBSubsetDateGroup> |
groupByHour(int iDateColumnPosition)
Group rows by hour intervals
|
java.util.ArrayList<DBSubset.DBSubsetDateGroup> |
groupByMonth(int iDateColumnPosition)
Group rows by month intervals
|
java.util.ArrayList<DBSubset.DBSubsetDateGroup> |
groupByWeek(int iDateColumnPosition,
int iFirstDayOfWeek)
Group rows by week intervals
|
java.util.ArrayList<DBSubset.DBSubsetDateGroup> |
groupByYear(int iDateColumnPosition)
Group rows by year intervals
|
boolean |
isNull(int iCol,
int iRow) |
boolean |
isNull(java.lang.String sCol,
int iRow) |
java.lang.String |
json(java.lang.String sName,
java.lang.String sIdentifier,
java.lang.String sLabel) |
int |
load(JDCConnection oConn)
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
|
int |
load(JDCConnection oConn,
int iSkip)
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
|
int |
load(JDCConnection oConn,
java.lang.Object[] aFilterValues)
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
|
int |
load(JDCConnection oConn,
java.lang.Object[] aFilterValues,
int iSkip)
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
|
int |
loadSubrecords(JDCConnection oConn,
java.lang.String sSubrecordsTable,
java.lang.String sForeignKey,
int iPrimaryKey)
For each DBSubset row, load another DBSubset with related records from another table
For example for loading the categories of a user and then the Products inside them do:
DBSubset oCats = new DBSubset(DB.k_categories, DB.gu_category+","+DB.nm_category, DB.gu_owner+"=?" |
java.lang.Object |
max(int iCol)
Get maximum value for a column
|
java.lang.Object |
min(int iCol)
Get minimum value for a column
|
void |
parseCSV(char[] aData)
Parse character data into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.
|
void |
parseCSV(char[] aData,
java.lang.String sCharSet)
Parse character data into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.
|
void |
parseCSV(java.lang.String sFilePath)
Parse a delimited text file into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.
|
void |
parseCSV(java.lang.String sFilePath,
java.lang.String sCharSet)
Parse a delimited text file into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.
|
void |
print(java.sql.Connection oConn,
java.io.OutputStream oOutStrm)
Print DBSubset to an output stream
This method is quite different in behavior from toString() and toXML().
|
void |
setColumnDelimiter(java.lang.String sDelim) |
void |
setElementAt(java.lang.Object oObj,
int iCol,
int iRow)
Set an element for a loaded DBSubset
|
void |
setElementAt(java.lang.Object oObj,
java.lang.String sCol,
int iRow)
Set an element for a loaded DBSubset
|
void |
setMaxRows(int iMax)
Maximum number of rows to be readed from database
The exact behavior of this property depends on the RDBMS used.
|
void |
setQueryTimeout(int iMaxSeconds)
Maximum number of seconds that a query can be executing before raising a timeout exception
|
void |
setRowDelimiter(java.lang.String sDelim) |
void |
setTextQualifier(java.lang.String sQualifier) |
void |
sort(java.lang.String sCol)
Sort in memory an already loaded ResultSet by a given column
A modified bubble sort algorithm is used.
|
void |
sortBy(int iCol)
Sort in memory an already loaded ResultSet by a given column
A modified bubble sort algorithm is used.
|
void |
sortByDesc(int iCol)
Sort in memory an already loaded ResultSet by a given column
A modified bubble sort algorithm is used.
|
java.sql.SQLException[] |
store(JDCConnection oConn,
java.lang.Class oDBPersistSubclass,
boolean bStopOnError)
Store full contents of this DBSubset at base table
This method takes all the dat contained in memory for this DBSubsets and
stores it at the database.
|
java.lang.Object |
sum(int iCol) |
java.lang.String |
toString()
Write DBSubset to a delimited text string using the column and row delimiters
stablished at setColumnDelimiter() and setRowDelimiter() properties.
|
java.lang.String |
toXML(java.lang.String sIdent,
java.lang.String sNode)
Write DBSubset to an XML string
Use default output format for date values: yyyy-MM-dd'T'hh:mm:ss
|
java.lang.String |
toXML(java.lang.String sIdent,
java.lang.String sNode,
java.lang.String sDateFormat,
java.lang.String sDecimalFormat)
Write DBSubset to an XML string
|
void |
union(DBSubset oDbs)
Append rows from given DBSubset to this DBSubset
|
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
public DBSubset(java.lang.String sTableName, java.lang.String sColumnList, java.lang.String sFilterClause, int iFetchSize)
sTableName
- Base table or tables, ie. "k_products" or "k_products p, k_x_cat_objs x"sColumnList
- Column list to be retirved from base tables i.e "p.gu_product,p.nm_product"sFilterClause
- SQL filter clause or null if there is no filter clause to be applied.iFetchSize
- Space for number of rows initailly allocated. Is DBSubset later loads more rows
the buffer is automatically expanded. This parameter may also have a great effect on reducing
network round trips as the ResultSet.setFetchSize(iFetchSize) method is called prior to fetching
rows. Fetching rows in batches is much faster than doing so one by one. When iFetchSize is set,
the JDBC driver may optimize accesses to fetched rows by reading bursts and
caching rows at client side.public int clear(java.sql.Connection oConn, java.lang.Object[] aFilterValues) throws java.sql.SQLException
oConn
- ConnectionaFilterValues
- Object[] Parameters for sFilter parameter specified at constructorjava.sql.SQLException
public boolean eof()
public int getMaxRows()
public void setMaxRows(int iMax)
Maximum number of rows to be readed from database
The exact behavior of this property depends on the RDBMS used.
For PostgreSQL [LIMIT n] clause is appended to DBSubset query and all returned rows are readed.
For Microsoft SQL Server [OPTION FAST(n)] clause is appended to DBSubset query and then the number of readed rows is limited at client side fetching.
For Oracle there is no standard way of limiting the resultset size. The number of readed rows is just limited at client side fetching.
public int getQueryTimeout()
public void setQueryTimeout(int iMaxSeconds)
iMaxSeconds
- public int call(JDCConnection oConn) throws java.sql.SQLException
Execute a stored procedure returning a ResultSet
oConn
- Database Connectionjava.sql.SQLException
public int call(JDCConnection oConn, int iSkip) throws java.sql.SQLException, java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException
Execute a stored procedure returning a ResultSet
oConn
- Database ConnectioniSkip
- Number of rows to be skipped before readingjava.sql.SQLException
java.lang.IllegalArgumentException
- if iSkip<0java.lang.ArrayIndexOutOfBoundsException
public int call(JDCConnection oConn, java.lang.Object[] aFilterValues) throws java.sql.SQLException
Execute a stored procedure returning a ResultSet
oConn
- Database ConnectionaFilterValues
- Values to be binded and JDBC PreparedStatement query paramenters.java.sql.SQLException
public int call(JDCConnection oConn, java.lang.Object[] aFilterValues, int iSkip) throws java.sql.SQLException, java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException
Execute a stored procedure returning a ResultSet
oConn
- Database ConnectionaFilterValues
- Values to be binded and JDBC PreparedStatement query paramenters.iSkip
- Number of rows to be skipped before readingjava.sql.SQLException
java.lang.IllegalArgumentException
java.lang.ArrayIndexOutOfBoundsException
public int load(JDCConnection oConn) throws java.sql.SQLException, java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
oConn
- Database Connectionjava.sql.SQLException
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
public int load(JDCConnection oConn, int iSkip) throws java.sql.SQLException, java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
oConn
- Database ConnectioniSkip
- Number of rows to be skipped before reading. On database systems that support an
OFFSET clause (such as PostgreSQL) the native offset feature of the DBMS is used, in case that
the DBMS does not provide offset capabilities, the data is fetched and discarded at client side
before returning the DBSubset. Care must be taken when skipping a large number of rows in client
side mode as it may cause heavy network traffic and round trips to the database.java.sql.SQLException
java.lang.IllegalArgumentException
- if iSkip<0java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
public int load(JDCConnection oConn, java.lang.Object[] aFilterValues) throws java.sql.SQLException, java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
oConn
- Database ConnectionaFilterValues
- Values to be binded and JDBC PreparedStatement query paramenters.java.sql.SQLException
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
public int load(JDCConnection oConn, java.lang.Object[] aFilterValues, int iSkip) throws java.sql.SQLException, java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Execute a JDBC Statement and load query ResultSet in an internal bidimensional matrix
oConn
- Database ConnectionaFilterValues
- Values to be binded and JDBC PreparedStatement query paramenters.iSkip
- Number of rows to be skipped before reading. On database systems that support an
OFFSET clause (such as PostgreSQL) the native offset feature of the DBMS is used, in case that
the DBMS does not provide offset capabilities, the data is fetched and discarded at client side
before returning the DBSubset. Care must be taken when skipping a large number of rows in client
side mode as it may cause heavy network traffic and round trips to the database.java.sql.SQLException
java.lang.IllegalArgumentException
- if iSkip<0java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
public java.util.ArrayList distinct(int iCol) throws java.lang.ArrayIndexOutOfBoundsException
Get list of distinct values for a column
If column contains null values, those are never included at the output list
iCol
- Column to be searched [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
public java.lang.Object max(int iCol) throws java.lang.ArrayIndexOutOfBoundsException
Get maximum value for a column
iCol
- Column index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
public java.lang.Object min(int iCol) throws java.lang.ArrayIndexOutOfBoundsException
Get minimum value for a column
iCol
- Column index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
public int find(int iCol, java.lang.Object oVal) throws java.lang.ArrayIndexOutOfBoundsException
Find first match of a value in a given column
Value is searched by brute force from the begining to the end of the column.
Trying to find a null value is allowed.
For strings, find is case sensitive.
iCol
- Column to be searched [0..getColumnCount()-1]oVal
- Value searchedjava.lang.ArrayIndexOutOfBoundsException
public int findi(int iCol, java.lang.String sVal) throws java.lang.ArrayIndexOutOfBoundsException
Find a String in a given column using case insensitive search
Value is searched by brute force from the begining to the end of the column.
Trying to find a null value is allowed.
Find is case insensitive.
iCol
- Column to be searched [0..getColumnCount()-1]sVal
- Value searchedjava.lang.ArrayIndexOutOfBoundsException
public DBMatchSet findClose(int iCol, int iRowGuidCol, java.lang.String sSought, int nMaxResults, boolean bAccents, float fThreshold) throws java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException
iCol
- int Position of column being searched [0..getRowCount()]iRowGuidCol
- int Position of column holding the DBSubset primary key,
if it is -1 then a new GUID is automatically assigned to each new match.sSought
- String being soughtnMaxResults
- int Maximum number of results to returnbAccents
- boolean If this parameter is true then search will be
case sensitive and accents will be taken into account, if it is false
then search will be case insensitive and accents will not be taken into account.fThreshold
- float [0..100] The minimum match grade percentage that a result must reach in order to be included at the matches setjava.lang.IllegalArgumentException
- if fThreshold is not between 0 and 100java.lang.ArrayIndexOutOfBoundsException
public int binaryFind(int iCol, java.lang.Comparable oVal) throws java.lang.ClassCastException
Find a Comparable object using binary search
The searched column must have been previously sorted in ascending order.
Trying to find null always return -1 even thought the column contains indeed a null value.
iCol
- Column to be searched [0..getColumnCount()-1]oVal
- Value searchedjava.lang.ClassCastException
- if column iCol is not Comparablepublic java.lang.String getColumnDelimiter()
public void setColumnDelimiter(java.lang.String sDelim)
sDelim
- Column delimiter for print() and toString() methods.
The default delimiter is '`' characterpublic java.lang.String getRowDelimiter()
public void setRowDelimiter(java.lang.String sDelim)
sDelim
- Row delimiter for print() and toString() methods.
The default delimiter is '¨' characterpublic java.lang.String getTextQualifier()
public void setTextQualifier(java.lang.String sQualifier)
sQualifier
- Text qualifier for quoting fields in print() and toString() methods.public int getColumnCount()
public java.lang.String[] getColumnNames()
Get column names
public java.lang.String getColumnName(int iColumnPosition) throws java.lang.ArrayIndexOutOfBoundsException
Get name for column given its index
iColumnPosition
- [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
public int getColumnPosition(java.lang.String sColumnName)
sColumnName
- Name of column witch position is to be returned. Column names are case insensitive.public int getRowCount()
public java.util.List getColumnAsList(int iCol) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalStateException
iCol
- int Column position [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalStateException
- if DBSubset has not been loadedpublic java.util.List getRowAsList(int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalStateException
iRow
- int Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalStateException
- if DBSubset has not been loadedpublic java.util.HashMap<java.lang.String,java.lang.Object> getRowAsMap(int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalStateException
iRow
- int Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalStateException
- if DBSubset has not been loadedpublic java.util.Vector getRowAsVector(int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalStateException
iRow
- int Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalStateException
- if DBSubset has not been loadedpublic java.lang.Object get(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded field
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
public java.lang.Object get(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded field by name
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- If no column with such name was foundpublic boolean getBoolean(int iCol, int iRow) throws java.lang.ClassCastException, java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Get pre-loaded value for a Boolean field
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
public java.util.Date getDate(int iCol, int iRow) throws java.lang.ClassCastException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value for a Date field
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
public java.sql.Date getSQLDate(int iCol, int iRow) throws java.lang.ClassCastException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value for a Date field
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
public java.sql.Date getSQLDate(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value for a Date field
sCol
- String Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
public java.sql.Time getSQLTime(int iCol, int iRow) throws java.lang.ClassCastException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value for a Time field
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
public java.sql.Time getSQLTime(java.lang.String sCol, int iRow) throws java.lang.ClassCastException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value for a Time field
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
public java.util.Date getDate(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value for a Date field
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
- if column is not foundpublic java.lang.String getDateShort(int iCol, int iRow)
Get pre-loaded value for a Date field formated as a short Date "yyyy-MM-dd"
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
public java.lang.String getDateTime24(int iCol, int iRow)
Get pre-loaded value for a Date field formated as a DateTime "yyyy-MM-dd HH:mm:ss"
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
public java.lang.String getDateTime(int iCol, int iRow) throws java.lang.ClassCastException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value for a Date field formated as a DateTime "yyyy-MM-dd hh:mm:ss"
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
public java.lang.String getDateFormated(int iCol, int iRow, java.lang.String sFormat) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
Get pre-loaded value for a Date field formated with a used defind formar
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]sFormat
- Date Format (like "yyyy-MM-dd HH:mm:ss")java.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
SimpleDateFormat
public java.lang.String getDateFormated(int iCol, int iRow, java.text.SimpleDateFormat oFmt) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
Get pre-loaded value for a Date field formated with a used defind formar
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]oFmt
- Date Formatjava.lang.ClassCastException
java.lang.ArrayIndexOutOfBoundsException
public short getShort(int iCol, int iRow) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a Short
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.NullPointerException
- If field value is nulljava.lang.ArrayIndexOutOfBoundsException
public short getShort(java.lang.String sCol, int iRow) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a Short
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.NullPointerException
- If field value is nulljava.lang.ArrayIndexOutOfBoundsException
public int getInt(int iCol, int iRow) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a int
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.NullPointerException
- If field value is nulljava.lang.ArrayIndexOutOfBoundsException
public int getInt(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Get pre-loaded value and tries to convert it into a Short
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- if column is not foundjava.lang.NullPointerException
- If field value is nullpublic double getDouble(int iCol, int iRow) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a double
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.NullPointerException
- If field value is nulljava.lang.ArrayIndexOutOfBoundsException
public float getFloat(int iCol, int iRow) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a float
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.NullPointerException
- If field value is nulljava.lang.ArrayIndexOutOfBoundsException
public float getFloat(java.lang.String sCol, int iRow) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a Short
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- if column is not foundjava.lang.NullPointerException
- If field value is nullpublic float getFloat(int iCol, int iRow, int iDecimals) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a float
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]iDecimals
- Decimal places for float valuejava.lang.ArrayIndexOutOfBoundsException
- if column is not foundjava.lang.NullPointerException
- If field value is nullpublic float getFloat(java.lang.String sCol, int iRow, int iDecimals) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Get pre-loaded value and tries to convert it into a float
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]iDecimals
- Decimal places for float valuejava.lang.ArrayIndexOutOfBoundsException
- if column is not foundjava.lang.NullPointerException
- If field value is nullpublic java.lang.Integer getInteger(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into an Integer
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
public java.lang.Long getLong(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a Long
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
public java.lang.Integer getInteger(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into an Integer
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- if column is not foundpublic java.math.BigDecimal getDecimal(int iCol, int iRow) throws java.lang.ClassCastException, java.lang.NumberFormatException
Get pre-loaded value and tries to convert it into a BigDecimal
If column is NULL then null value is returned.iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ClassCastException
java.lang.NumberFormatException
public java.math.BigDecimal getDecimal(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get pre-loaded value and tries to convert it into a BigDecimal
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- if column is not foundpublic java.lang.String getDecimalFormated(int iCol, int iRow, java.lang.String sPattern) throws java.lang.ClassCastException, java.lang.NumberFormatException, java.lang.NullPointerException, java.lang.IllegalArgumentException
Get decimal formated as a String using the given pattern and the symbols for the default locale
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]sPattern
- A non-localized pattern string, for example: "#0.00"java.lang.ClassCastException
java.lang.NumberFormatException
java.lang.NullPointerException
- if sPattern is nulljava.lang.IllegalArgumentException
- if sPattern is invalidpublic java.lang.String getDecimalFormated(java.lang.String sCol, int iRow, java.lang.String sPattern) throws java.lang.ClassCastException, java.lang.NumberFormatException, java.lang.NullPointerException, java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException
Get decimal formated as a String using the given pattern and the symbols for the default locale
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]sPattern
- A non-localized pattern string, for example: "#0.00"java.lang.ClassCastException
java.lang.NumberFormatException
java.lang.NullPointerException
- if sPattern is nulljava.lang.IllegalArgumentException
- if sPattern is invalidjava.lang.ArrayIndexOutOfBoundsException
- if column is not foundpublic Money getMoney(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.NumberFormatException
Get value of a VARCHAR field that holds a money+currency amount
Money values are stored with its currency sign embedded inside, like "26.32 USD" or "$48.3" or "35.44 €"
iCol
- int Column position [0..getColumnCount()-1]iRow
- int Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.NumberFormatException
public Money getMoney(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.NumberFormatException
Get value of a VARCHAR field that holds a money+currency amount
Money values are stored with its currency sign embedded inside, like "26.32 USD" or "$48.3" or "35.44 €"
iCol
- int Column position [0..getColumnCount()-1]iRow
- int Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- if column is not foundjava.lang.NumberFormatException
public java.lang.String getString(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get toString() form of pre-loaded value
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
public java.lang.String getStringNull(int iCol, int iRow, java.lang.String sDef) throws java.lang.ArrayIndexOutOfBoundsException
Get toString() form of pre-loaded value
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]sDef
- Default valuejava.lang.ArrayIndexOutOfBoundsException
public java.lang.String getString(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
Get toString() form of pre-loaded value
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- if column is not foundpublic java.lang.String getStringNull(java.lang.String sCol, int iRow, java.lang.String sDef) throws java.lang.ArrayIndexOutOfBoundsException
Get toString() form of pre-loaded value
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]sDef
- Default valuejava.lang.ArrayIndexOutOfBoundsException
- if column is not foundpublic java.lang.String getStringHtml(int iCol, int iRow, java.lang.String sDef) throws java.lang.ArrayIndexOutOfBoundsException
Get value for a CHAR, VARCHAR or LONGVARCHAR field replacing null with a default value and replacing non-ASCII and quote values with code;
iCol
- Column indexiRow
- Row position [0..getRowCount()-1]sDef
- Default valuejava.lang.ArrayIndexOutOfBoundsException
public java.sql.Time getTimeOfDay(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.ClassCastException
public java.sql.Timestamp getTimestamp(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.ClassCastException
public long getTimeMilis(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.ClassCastException
public long getIntervalMilis(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
Return interval value in miliseconds
This method is only for PostgreSQL 8.0 or lateriCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.ClassCastException
public void ensureCapacity(int nCols, int nRows)
nCols
- Number of columns per rownRows
- Number of rows to allocatepublic void setElementAt(java.lang.Object oObj, int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
oObj
- Object ReferenceiCol
- Column Index [0..getColumnCount()-1]iRow
- Row Index [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
public void setElementAt(java.lang.Object oObj, java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
oObj
- Object ReferencesCol
- Column NameiRow
- Row Index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
public boolean isNull(int iCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
iCol
- Column position [0..getColumnCount()-1]iRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
public boolean isNull(java.lang.String sCol, int iRow) throws java.lang.ArrayIndexOutOfBoundsException
sCol
- Column nameiRow
- Row position [0..getRowCount()-1]java.lang.ArrayIndexOutOfBoundsException
- if column is not foundpublic java.lang.String toString()
Write DBSubset to a delimited text string using the column and row delimiters stablished at setColumnDelimiter() and setRowDelimiter() properties.
toString
in class java.util.Vector<java.util.Vector<java.lang.Object>>
public java.lang.String toXML(java.lang.String sIdent, java.lang.String sNode, java.lang.String sDateFormat, java.lang.String sDecimalFormat)
Write DBSubset to an XML string
sIdent
- Initial space identations on the left for fieldssNode
- Name of top parent node. If null then main table name
for this DBSubset is used.sDateFormat
- Output format for date valuessDecimalFormat
- Output format for decimal and floating point valuespublic java.lang.String toXML(java.lang.String sIdent, java.lang.String sNode)
Write DBSubset to an XML string
Use default output format for date values: yyyy-MM-dd'T'hh:mm:sssIdent
- Initial space identations on the left for fieldssNode
- Name of top parent node. If null then main table name
for this DBSubset is used.public void print(java.sql.Connection oConn, java.io.OutputStream oOutStrm) throws java.sql.SQLException
Print DBSubset to an output stream
This method is quite different in behavior from toString() and toXML(). In toString() and toXML() methods data is first pre-loaded by invoking call() or load() methods and then written to a string buffer. For toString() and toXML() memory consumption depends on how many rows are pre-loaded in memory. print() method directly writes readed data to the output stream without creating the bidimimensional internal array for holding readed data. This way data is directly piped from database to output stream.
oConn
- Database ConnectionoOutStrm
- Output Streamjava.sql.SQLException
public java.lang.String json(java.lang.String sName, java.lang.String sIdentifier, java.lang.String sLabel) throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public java.sql.SQLException[] store(JDCConnection oConn, java.lang.Class oDBPersistSubclass, boolean bStopOnError) throws java.sql.SQLException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ArrayIndexOutOfBoundsException
Store full contents of this DBSubset at base table
This method takes all the dat contained in memory for this DBSubsets and stores it at the database. For each row, if it does not exist then it is inserted, if it exists then it is updated.
oConn
- JDBC Database ConnectionoDBPersistSubclass
- DBPersist subclass for rows. DBSubset will call the
proper DBPersist.store() derived method for each row, executing specific code
for the subclass such as automatic GUID at modification date generation.bStopOnError
- true if process should stop if any SQLException is
thrown, false if process must continue upon an SQLException and leave
return addional information throught SQLException[] array.java.sql.SQLException
- Only if bStopOnError is truejava.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.ArrayIndexOutOfBoundsException
public int loadSubrecords(JDCConnection oConn, java.lang.String sSubrecordsTable, java.lang.String sForeignKey, int iPrimaryKey) throws java.sql.SQLException
For each DBSubset row, load another DBSubset with related records from another table
For example for loading the categories of a user and then the Products inside them do:
DBSubset oCats = new DBSubset(DB.k_categories, DB.gu_category+","+DB.nm_category, DB.gu_owner+"=?", 10);
int nCats = oCats.load (oJdbcConnection, new Object[]{"guid_of_user_owner_of_categories"});
int nProds = oCats.loadSubrecords(oJdbcConnection, DB.v_prod_cat, DB.gu_category, 0);
if (nProds!=0) {
for (int c=0; c<nCats; c++) {
for (int p=0; p<oCats.getSubrecords(c).getRowCount(); p++) {
System.out.writeln(oCats.getSubrecords(c).getString(DB.nm_product,p));
}
}
}
oConn
- JDCConnectionsSubrecordsTable
- String Name of table where subrecords are to be taken fromsForeignKey
- String name of a column at subrecords tableiPrimaryKey
- int Position of column from this DBSubset which must be binded into foreign key for filtering child subrecordsjava.sql.SQLException
public DBSubset getSubrecords(int nRow) throws java.lang.ArrayIndexOutOfBoundsException
Get subrecords of a given row of this DBSubset
Subrecords must have been prevoiously loaded by calling loadSubrecords()java.lang.ArrayIndexOutOfBoundsException
public void sortBy(int iCol) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
Sort in memory an already loaded ResultSet by a given column
A modified bubble sort algorithm is used. Resulting in a O(n²) worst case and O(n) best case if the ResultSet was already sorted by the given column.iCol
- int Column Index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.ClassCastException
public void sortByDesc(int iCol) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.ClassCastException
Sort in memory an already loaded ResultSet by a given column
A modified bubble sort algorithm is used. Resulting in a O(n²) worst case and O(n) best case if the ResultSet was already sorted by the given column.iCol
- int Column Index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.ClassCastException
public void sort(java.lang.String sCol) throws java.lang.ArrayIndexOutOfBoundsException
Sort in memory an already loaded ResultSet by a given column
A modified bubble sort algorithm is used. Resulting in a O(n²) worst case and O(n) best case if the ResultSet was already sorted by the given column.sCol
- String Column Namejava.lang.ArrayIndexOutOfBoundsException
java.lang.ClassCastException
public java.lang.Object sum(int iCol) throws java.lang.NumberFormatException, java.lang.ArrayIndexOutOfBoundsException
java.lang.NumberFormatException
java.lang.ArrayIndexOutOfBoundsException
public void union(DBSubset oDbs) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
Append rows from given DBSubset to this DBSubset
oDbs
- DBSubset An already loaded DBSubsetjava.lang.ArrayIndexOutOfBoundsException
- If both DBSubsets do not have the same number of columnsjava.lang.NullPointerException
- If oDbs is nullpublic java.util.ArrayList<DBSubset.DBSubsetDateGroup> groupByHour(int iDateColumnPosition)
Group rows by hour intervals
iDateColumnPosition
- int Date Column Index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ClassCastException
public java.util.ArrayList<DBSubset.DBSubsetDateGroup> groupByDay(int iDateColumnPosition)
Group rows by day intervals
iDateColumnPosition
- int Date Column Index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ClassCastException
public java.util.ArrayList<DBSubset.DBSubsetDateGroup> groupByWeek(int iDateColumnPosition, int iFirstDayOfWeek)
Group rows by week intervals
iDateColumnPosition
- int Date Column Index [0..getColumnCount()-1]iFirstDayOfWeek
- int First day of the week, SUNDAY=0, MONDAY=1java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ClassCastException
public java.util.ArrayList<DBSubset.DBSubsetDateGroup> groupByMonth(int iDateColumnPosition)
Group rows by month intervals
iDateColumnPosition
- int Date Column Index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ClassCastException
public java.util.ArrayList<DBSubset.DBSubsetDateGroup> groupByYear(int iDateColumnPosition)
Group rows by year intervals
iDateColumnPosition
- int Date Column Index [0..getColumnCount()-1]java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ClassCastException
public void parseCSV(java.lang.String sFilePath, java.lang.String sCharSet) throws java.lang.ArrayIndexOutOfBoundsException, java.io.IOException, java.io.FileNotFoundException, java.lang.RuntimeException, java.lang.NullPointerException, java.lang.IllegalArgumentException
Parse a delimited text file into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.sFilePath
- File PathsCharSet
- Character set encoding for filejava.io.IOException
java.io.FileNotFoundException
java.lang.ArrayIndexOutOfBoundsException
- Delimited values for a file is greater
than columns specified at descriptor.java.lang.RuntimeException
- If delimiter is not one of { ',' ';' or '\t' }java.lang.NullPointerException
- if sFileDescriptor is nulljava.lang.IllegalArgumentException
- if sFileDescriptor is ""public void parseCSV(java.lang.String sFilePath) throws java.lang.ArrayIndexOutOfBoundsException, java.io.IOException, java.io.FileNotFoundException, java.lang.RuntimeException, java.lang.NullPointerException, java.lang.IllegalArgumentException
Parse a delimited text file into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.sFilePath
- File Pathjava.lang.ArrayIndexOutOfBoundsException
java.io.IOException
java.io.FileNotFoundException
java.lang.RuntimeException
java.lang.NullPointerException
java.lang.IllegalArgumentException
public void parseCSV(char[] aData, java.lang.String sCharSet) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.RuntimeException, java.lang.NullPointerException, java.lang.IllegalArgumentException, java.io.UnsupportedEncodingException
Parse character data into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.sFilePath
- Character Data to be parsedsCharSet
- Character set encoding for filejava.lang.ArrayIndexOutOfBoundsException
java.lang.RuntimeException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.io.UnsupportedEncodingException
public void parseCSV(char[] aData) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.RuntimeException, java.lang.NullPointerException, java.lang.IllegalArgumentException, java.io.UnsupportedEncodingException
Parse character data into DBSubset bi-dimensional array
The parsed file must have the same column structure as the column list set when the DBSubset constructor was called.sFilePath
- Character Data to be parsedjava.lang.ArrayIndexOutOfBoundsException
java.lang.RuntimeException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.io.UnsupportedEncodingException