Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.dataobjs
Class DBSubset

    java.lang.Object
      com.knowgate.dataobjs.DBSubset

    public final class DBSubset

extends 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 the `JDCConnectionPool`, 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.

Constructor Summary
`DBSubset(java.lang.String sTableName, java.lang.String sColumnList, java.lang.String sFilterClause, int iFetchSize)` Contructs a DBSubset.

Method Summary
`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.Map` | `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
`boolean` | `isNull(int iCol, int iRow)`
`boolean` | `isNull(java.lang.String sCol, int iRow)`
`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+"=?"
`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` | `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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DBSubset

    public DBSubset(java.lang.String sTableName,
                    java.lang.String sColumnList,
                    java.lang.String sFilterClause,
                    int iFetchSize)

  Contructs a DBSubset.

  Parameters:
    `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.

Method Detail

### clear

    public int clear(java.sql.Connection oConn,
                     java.lang.Object[] aFilterValues)
              throws java.sql.SQLException

  Delete rows from base table

  Parameters:
    `oConn` - Connection
    `aFilterValues` - Object[] Parameters for sFilter parameter specified at constructor
  Returns:
    int Number of rows deleted
  Throws:
    `java.sql.SQLException`

### eof

    public boolean eof()

  Returns:
    true if call() or load() methods readed all available rows, false if more rows where pending of reading when getMaxRows() was reached.
    Also, after calling store(), eof() is true if all rows were stored successfully or false if any row failed to be inserted or updated.

### getMaxRows

    public int getMaxRows()

  Returns:
    Maximum number of rows to be readed from database

### setMaxRows

    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.

### getQueryTimeout

    public int getQueryTimeout()

  Returns:
    Maximum amount of time in seconds that a query may run before being cancelled.

### setQueryTimeout

    public void setQueryTimeout(int iMaxSeconds)

  Maximum number of seconds that a query can be executing before raising a timeout exception

  Parameters:
    `iMaxSeconds` -

### call

    public int call(JDCConnection oConn)
             throws java.sql.SQLException

  Execute a stored procedure returning a ResultSet

  Parameters:
    `oConn` - Database Connection
  Returns:
    Number of rows retrieved
  Throws:
    `java.sql.SQLException`

### call

    public int call(JDCConnection oConn,
                    int iSkip)
             throws java.sql.SQLException,
                    java.lang.IllegalArgumentException,
                    java.lang.ArrayIndexOutOfBoundsException

  Execute a stored procedure returning a ResultSet

  Parameters:
    `oConn` - Database Connection
    `iSkip` - Number of rows to be skipped before reading
  Returns:
    Number of rows retrieved
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalArgumentException` - if iSkip<0
    `java.lang.ArrayIndexOutOfBoundsException`

### call

    public int call(JDCConnection oConn,
                    java.lang.Object[] aFilterValues)
             throws java.sql.SQLException

  Execute a stored procedure returning a ResultSet

  Parameters:
    `oConn` - Database Connection
    `aFilterValues` - Values to be binded and JDBC PreparedStatement query paramenters.
  Returns:
    Number of rows retrieved
  Throws:
    `java.sql.SQLException`

### call

    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

  Parameters:
    `oConn` - Database Connection
    `aFilterValues` - Values to be binded and JDBC PreparedStatement query paramenters.
    `iSkip` - Number of rows to be skipped before reading
  Returns:
    Number of rows retrieved, the maximum number of rows to be retrieved is determined by calling method setMaxRows(), if setMaxRows() is not called before call() then all rows existing are retrieved.
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalArgumentException`
    `java.lang.ArrayIndexOutOfBoundsException`

### load

    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

  Parameters:
    `oConn` - Database Connection
  Returns:
    Number of rows retrieved the maximum number of rows to be retrieved is determined by calling method setMaxRows(), if setMaxRows() is not called before call() then all rows existing are retrieved.
  Throws:
    `java.sql.SQLException`
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NullPointerException`

### load

    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

  Parameters:
    `oConn` - Database Connection
    `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.
  Returns:
    Number of rows retrieved the maximum number of rows to be retrieved is determined by calling method setMaxRows(), if setMaxRows() is not called before call() then all rows existing are retrieved.
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalArgumentException` - if iSkip<0
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NullPointerException`

### load

    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

  Parameters:
    `oConn` - Database Connection
    `aFilterValues` - Values to be binded and JDBC PreparedStatement query paramenters.
  Returns:
    Number of rows retrieved the maximum number of rows to be retrieved is determined by calling method setMaxRows(), if setMaxRows() is not called before call() then all rows existing are retrieved.
  Throws:
    `java.sql.SQLException`
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NullPointerException`

### load

    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

  Parameters:
    `oConn` - Database Connection
    `aFilterValues` - 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.
  Returns:
    Number of rows retrieved the maximum number of rows to be retrieved is determined by calling method setMaxRows(), if setMaxRows() is not called before call() then all rows existing are retrieved.
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalArgumentException` - if iSkip<0
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NullPointerException`

### distinct

    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

  Parameters:
    `iCol` - Column to be searched [0..getColumnCount()-1]
  Returns:
    ArrayList with distinct values.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    4.0

### find

    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.

  Parameters:
    `iCol` - Column to be searched [0..getColumnCount()-1]
    `oVal` - Value searched
  Returns:
    Row where seached value was found or -1 is value was not found.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### findi

    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.

  Parameters:
    `iCol` - Column to be searched [0..getColumnCount()-1]
    `sVal` - Value searched
  Returns:
    Row where seached value was found or -1 is value was not found.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    4.0

### findClose

    public DBMatchSet findClose(int iCol,
                                int iRowGuidCol,
                                java.lang.String sSought,
                                int nMaxResults,
                                boolean bAccents,
                                float fThreshold)
                         throws java.lang.IllegalArgumentException,
                                java.lang.ArrayIndexOutOfBoundsException

  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.

  Parameters:
    `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 sought
    `nMaxResults` - int Maximum number of results to return
    `bAccents` - 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 set
  Returns:
    DBMatchSet
  Throws:
    `java.lang.IllegalArgumentException` - if fThreshold is not between 0 and 100
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    4.0

### binaryFind

    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.

  Parameters:
    `iCol` - Column to be searched [0..getColumnCount()-1]
    `oVal` - Value searched
  Returns:
    Row where seached value was found or -1 if value was not found.
  Throws:
    `java.lang.ClassCastException` - if column iCol is not Comparable
  Since:
    4.0

### getColumnDelimiter

    public java.lang.String getColumnDelimiter()

  Returns:
    Column delimiter for print() and toString() methods.

### setColumnDelimiter

    public void setColumnDelimiter(java.lang.String sDelim)

  Parameters:
    `sDelim` - Column delimiter for print() and toString() methods. The default delimiter is '`' character

### getRowDelimiter

    public java.lang.String getRowDelimiter()

  Returns:
    Row delimiter for print() and toString() methods.

### setRowDelimiter

    public void setRowDelimiter(java.lang.String sDelim)

  Parameters:
    `sDelim` - Row delimiter for print() and toString() methods. The default delimiter is '¨' character

### getTextQualifier

    public java.lang.String getTextQualifier()

  Returns:
    Text qualifier for quoting fields in print() and toString() methods.

### setTextQualifier

    public void setTextQualifier(java.lang.String sQualifier)

  Parameters:
    `sQualifier` - Text qualifier for quoting fields in print() and toString() methods.

### getColumnCount

    public int getColumnCount()

  Returns:
    Number of columns retrieved.

### getColumnNames

    public java.lang.String[] getColumnNames()

  Get column names

  Returns:
    String[] An array with names of columns from the most recently SQL SELECT sentence.
  Since:
    3.0

### getColumnName

    public java.lang.String getColumnName(int iColumnPosition)
                                   throws java.lang.ArrayIndexOutOfBoundsException

  Get name for column given its index

  Parameters:
    `iColumnPosition` - [0..getColumnCount()-1]
  Returns:
    String Column Name
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    5.0

### getColumnPosition

    public int getColumnPosition(java.lang.String sColumnName)

  Parameters:
    `sColumnName` - Name of column witch position is to be returned. Column names are case insensitive.
  Returns:
    Column position or -1 if no column with such name exists.

### getRowCount

    public int getRowCount()

  Returns:
    number of rows retrieved by last call() or load() method invocation.

### getColumnAsList

    public java.util.List getColumnAsList(int iCol)
                                   throws java.lang.ArrayIndexOutOfBoundsException,
                                          java.lang.IllegalStateException

  Get DBSubset column as a List interface

  Parameters:
    `iCol` - int Column position [0..getColumnCount()-1]
  Returns:
    List
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.IllegalStateException` - if DBSubset has not been loaded

### getRowAsList

    public java.util.List getRowAsList(int iRow)
                                throws java.lang.ArrayIndexOutOfBoundsException,
                                       java.lang.IllegalStateException

  Get DBSubset row as a List interface

  Parameters:
    `iRow` - int Row position [0..getRowCount()-1]
  Returns:
    List
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.IllegalStateException` - if DBSubset has not been loaded

### getRowAsMap

    public java.util.Map getRowAsMap(int iRow)
                              throws java.lang.ArrayIndexOutOfBoundsException,
                                     java.lang.IllegalStateException

  Get DBSubset row as a Map interface

  Parameters:
    `iRow` - int Row position [0..getRowCount()-1]
  Returns:
    Map
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.IllegalStateException` - if DBSubset has not been loaded

### getRowAsVector

    public java.util.Vector getRowAsVector(int iRow)
                                    throws java.lang.ArrayIndexOutOfBoundsException,
                                           java.lang.IllegalStateException

  Get DBSubset row as a Vector

  Parameters:
    `iRow` - int Row position [0..getRowCount()-1]
  Returns:
    Vector
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.IllegalStateException` - if DBSubset has not been loaded
  Since:
    3.0

### get

    public java.lang.Object get(int iCol,
                                int iRow)
                         throws java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded field

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### get

    public java.lang.Object get(java.lang.String sCol,
                                int iRow)
                         throws java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded field by name

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - If no column with such name was found

### getBoolean

    public boolean getBoolean(int iCol,
                              int iRow)
                       throws java.lang.ClassCastException,
                              java.lang.ArrayIndexOutOfBoundsException,
                              java.lang.NullPointerException

  Get pre-loaded value for a Boolean field

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    boolean value for field.
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NullPointerException`

### getDate

    public java.util.Date getDate(int iCol,
                                  int iRow)
                           throws java.lang.ClassCastException,
                                  java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded value for a Date field

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`

### getSQLDate

    public java.sql.Date getSQLDate(int iCol,
                                    int iRow)
                             throws java.lang.ClassCastException,
                                    java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded value for a Date field

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    java.sql.Date
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    3.0

### getSQLDate

    public java.sql.Date getSQLDate(java.lang.String sCol,
                                    int iRow)
                             throws java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded value for a Date field

  Parameters:
    `sCol` - String Column name
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    java.sql.Date
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    3.0

### getSQLTime

    public java.sql.Time getSQLTime(int iCol,
                                    int iRow)
                             throws java.lang.ClassCastException,
                                    java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded value for a Time field

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    3.0

### getSQLTime

    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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Time
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    3.0

### getDate

    public java.util.Date getDate(java.lang.String sCol,
                                  int iRow)
                           throws java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded value for a Date field

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found

### getDateShort

    public java.lang.String getDateShort(int iCol,
                                         int iRow)

  Get pre-loaded value for a Date field formated as a short Date "yyyy-MM-dd"

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    String with format "yyyy-MM-dd" or null.
  Throws:
    `java.lang.ClassCastException`

### getDateTime24

    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"

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    String with format "yyyy-MM-dd HH:mm:ss" or null.
  Throws:
    `java.lang.ClassCastException`
  Since:
    2.1

### getDateTime

    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"

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    String with format "yyyy-MM-dd hh:mm:ss" or null.
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`

### getDateFormated

    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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
    `sFormat` - Date Format (like "yyyy-MM-dd HH:mm:ss")
  Returns:
    Date value formated as String.
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`
  See Also:
    `SimpleDateFormat`

### getDateFormated

    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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
    `oFmt` - Date Format
  Returns:
    Date value formated as String.
  Throws:
    `java.lang.ClassCastException`
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    4.0

### getShort

    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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.NullPointerException` - If field value is null
    `java.lang.ArrayIndexOutOfBoundsException`

### getShort

    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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.NullPointerException` - If field value is null
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    4.0

### getInt

    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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.NullPointerException` - If field value is null
    `java.lang.ArrayIndexOutOfBoundsException`

### getInt

    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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found
    `java.lang.NullPointerException` - If field value is null

### getDouble

    public 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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.NullPointerException` - If field value is null
    `java.lang.ArrayIndexOutOfBoundsException`

### getFloat

    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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.NullPointerException` - If field value is null
    `java.lang.ArrayIndexOutOfBoundsException`

### getFloat

    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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found
    `java.lang.NullPointerException` - If field value is null

### getFloat

    public 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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
    `iDecimals` - Decimal places for float value
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found
    `java.lang.NullPointerException` - If field value is null

### getFloat

    public 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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
    `iDecimals` - Decimal places for float value
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found
    `java.lang.NullPointerException` - If field value is null

### getInteger

    public java.lang.Integer getInteger(int iCol,
                                        int iRow)
                                 throws java.lang.ArrayIndexOutOfBoundsException

  Get pre-loaded value and tries to convert it into an Integer

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Field value converted to Integer or null if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### getLong

    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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Field value converted to Integer or null if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    5.0

### getInteger

    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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Field value converted to Integer or null if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found

### getDecimal

    public 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.
  If base columnn is of type String then thsi function will try to parse the value into a BigDecimal. A single dot '.' is used as decimal delimiter no matter which is the current locale. All comma characters ',' are removed before parsing String into BigDecimal.

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Field value converted to BigDecimal or null if field was NULL.
  Throws:
    `java.lang.ClassCastException`
    `java.lang.NumberFormatException`

### getDecimal

    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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Field value converted to BigDecimal or null if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found

### getDecimalFormated

    public 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

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
    `sPattern` - A non-localized pattern string, for example: "#0.00"
  Returns:
    String decimal value formated according to sPatern or null
  Throws:
    `java.lang.ClassCastException`
    `java.lang.NumberFormatException`
    `java.lang.NullPointerException` - if sPattern is null
    `java.lang.IllegalArgumentException` - if sPattern is invalid

### getDecimalFormated

    public 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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
    `sPattern` - A non-localized pattern string, for example: "#0.00"
  Returns:
    String decimal value formated according to sPatern or null
  Throws:
    `java.lang.ClassCastException`
    `java.lang.NumberFormatException`
    `java.lang.NullPointerException` - if sPattern is null
    `java.lang.IllegalArgumentException` - if sPattern is invalid
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found

### getMoney

    public 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 €"

  Parameters:
    `iCol` - int Column position [0..getColumnCount()-1]
    `iRow` - int Row position [0..getRowCount()-1]
  Returns:
    com.knowgate.math.Money
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NumberFormatException`
  Since:
    3.0

### getMoney

    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 €"

  Parameters:
    `iCol` - int Column position [0..getColumnCount()-1]
    `iRow` - int Row position [0..getRowCount()-1]
  Returns:
    com.knowgate.math.Money
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found
    `java.lang.NumberFormatException`
  Since:
    3.0

### getString

    public java.lang.String getString(int iCol,
                                      int iRow)
                               throws java.lang.ArrayIndexOutOfBoundsException

  Get toString() form of pre-loaded value

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Field value converted to String or null if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### getStringNull

    public java.lang.String getStringNull(int iCol,
                                          int iRow,
                                          java.lang.String sDef)
                                   throws java.lang.ArrayIndexOutOfBoundsException

  Get toString() form of pre-loaded value

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
    `sDef` - Default value
  Returns:
    Field value converted to String default value sDef if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### getString

    public java.lang.String getString(java.lang.String sCol,
                                      int iRow)
                               throws java.lang.ArrayIndexOutOfBoundsException

  Get toString() form of pre-loaded value

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    Field value converted to String or null if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found

### getStringNull

    public 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

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
    `sDef` - Default value
  Returns:
    Field value converted to String default value sDef if field was NULL.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found

### getStringHtml

    public 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;

  Parameters:
    `iCol` - Column index
    `iRow` - Row position [0..getRowCount()-1]
    `sDef` - Default value
  Returns:
    Field value or default value encoded as HTML numeric entities.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    5.5

### getTimeOfDay

    public java.sql.Time getTimeOfDay(int iCol,
                                      int iRow)
                               throws java.lang.ArrayIndexOutOfBoundsException,
                                      java.lang.ClassCastException

  Get Time column

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    java.sql.Time
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.ClassCastException`
  Since:
    3.0

### getTimestamp

    public java.sql.Timestamp getTimestamp(int iCol,
                                           int iRow)
                                    throws java.lang.ArrayIndexOutOfBoundsException,
                                           java.lang.ClassCastException

  Get Timestamp columnn

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    java.sql.Timestamp
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.ClassCastException`
  Since:
    2.2

### getTimeMilis

    public long getTimeMilis(int iCol,
                             int iRow)
                      throws java.lang.ArrayIndexOutOfBoundsException,
                             java.lang.ClassCastException

  Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    long Miliseconds or zero if column is null
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.ClassCastException`
  Since:
    2.2

### getIntervalMilis

    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 later

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    long Interval in miliseconds. If interval is null then zero is returned.
    For Postgres 7.4 and earlier versions this method always return zero even if the interval column is not null.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.ClassCastException`
  Since:
    v2.2

### ensureCapacity

    public void ensureCapacity(int nCols,
                               int nRows)

  Pre-allocate a given number of empty rows and columns

  Parameters:
    `nCols` - Number of columns per row
    `nRows` - Number of rows to allocate
  Since:
    2.2

### setElementAt

    public void setElementAt(java.lang.Object oObj,
                             int iCol,
                             int iRow)
                      throws java.lang.ArrayIndexOutOfBoundsException

  Set an element for a loaded DBSubset

  Parameters:
    `oObj` - Object Reference
    `iCol` - Column Index [0..getColumnCount()-1]
    `iRow` - Row Index [0..getRowCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### setElementAt

    public void setElementAt(java.lang.Object oObj,
                             java.lang.String sCol,
                             int iRow)
                      throws java.lang.ArrayIndexOutOfBoundsException

  Set an element for a loaded DBSubset

  Parameters:
    `oObj` - Object Reference
    `sCol` - Column Name
    `iRow` - Row Index [0..getColumnCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### isNull

    public boolean isNull(int iCol,
                          int iRow)
                   throws java.lang.ArrayIndexOutOfBoundsException

  Parameters:
    `iCol` - Column position [0..getColumnCount()-1]
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    true if pre-load field is null, false otherwise.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### isNull

    public boolean isNull(java.lang.String sCol,
                          int iRow)
                   throws java.lang.ArrayIndexOutOfBoundsException

  Parameters:
    `sCol` - Column name
    `iRow` - Row position [0..getRowCount()-1]
  Returns:
    true if pre-load field is null, false otherwise.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if column is not found

### toString

    public java.lang.String toString()

  Write DBSubset to a delimited text string using the column and row delimiters stablished at setColumnDelimiter() and setRowDelimiter() properties.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    String dump of the whole DBSubset pre-loaded data.

### toXML

    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

  Parameters:
    `sIdent` - Initial space identations on the left for fields
    `sNode` - Name of top parent node. If null then main table name for this DBSubset is used.
    `sDateFormat` - Output format for date values
    `sDecimalFormat` - Output format for decimal and floating point values
  Returns:
    XML string dump of the whole DBSubset pre-loaded data.

### toXML

    public 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

  Parameters:
    `sIdent` - Initial space identations on the left for fields
    `sNode` - Name of top parent node. If null then main table name for this DBSubset is used.
  Returns:
    XML string dump of the whole DBSubset pre-loaded data.

### print

    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.

  Parameters:
    `oConn` - Database Connection
    `oOutStrm` - Output Stream
  Throws:
    `java.sql.SQLException`

### store

    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.

  Parameters:
    `oConn` - JDBC Database Connection
    `oDBPersistSubclass` - 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.
  Returns:
    An array with a SQLException object per stored row, if no SQLException was trown for a row then the entry at the array for that row is null.
    eof() property is set to true if all rows were inserted successfully, and, thus, all entries of the returned SQLException array are null; if any row failed to be inserted or updated then eof() is set to false
  Throws:
    `java.sql.SQLException` - Only if bStopOnError is true
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`
    `java.lang.ArrayIndexOutOfBoundsException`

### loadSubrecords

    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));
  }
  }
  }

  Parameters:
    `oConn` - JDCConnection
    `sSubrecordsTable` - String Name of table where subrecords are to be taken from
    `sForeignKey` - String name of a column at subrecords table
    `iPrimaryKey` - int Position of column from this DBSubset which must be binded into foreign key for filtering child subrecords
  Returns:
    int Total count of subrecords found for all rows of this DBSubset
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### getSubrecords

    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()

  Returns:
    DBSubset or null if there are no subrecords for any row of this DBSubset
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
  Since:
    4.0

### sortBy

    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.

  Parameters:
    `iCol` - int Column Index [0..getColumnCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.ClassCastException`
  Since:
    3.0

### sortByDesc

    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.

  Parameters:
    `iCol` - int Column Index [0..getColumnCount()-1]
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.ClassCastException`
  Since:
    5.0

### sum

    public java.lang.Object sum(int iCol)
                         throws java.lang.NumberFormatException,
                                java.lang.ArrayIndexOutOfBoundsException

  Throws:
    `java.lang.NumberFormatException`
    `java.lang.ArrayIndexOutOfBoundsException`

### union

    public void union(DBSubset oDbs)
               throws java.lang.ArrayIndexOutOfBoundsException,
                      java.lang.NullPointerException

  Append rows from given DBSubset to this DBSubset

  Parameters:
    `oDbs` - DBSubset An already loaded DBSubset
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - If both DBSubsets do not have the same number of columns
    `java.lang.NullPointerException` - If oDbs is null
  Since:
    3.0

### parseCSV

    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.

  Parameters:
    `sFilePath` - File Path
    `sCharSet` - Character set encoding for file
  Throws:
    `java.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 null
    `java.lang.IllegalArgumentException` - if sFileDescriptor is ""

### parseCSV

    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.

  Parameters:
    `sFilePath` - File Path
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.io.IOException`
    `java.io.FileNotFoundException`
    `java.lang.RuntimeException`
    `java.lang.NullPointerException`
    `java.lang.IllegalArgumentException`

### parseCSV

    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.

  Parameters:
    `sFilePath` - Character Data to be parsed
    `sCharSet` - Character set encoding for file
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.RuntimeException`
    `java.lang.NullPointerException`
    `java.lang.IllegalArgumentException`
    `java.io.UnsupportedEncodingException`

### parseCSV

    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.

  Parameters:
    `sFilePath` - Character Data to be parsed
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.RuntimeException`
    `java.lang.NullPointerException`
    `java.lang.IllegalArgumentException`
    `java.io.UnsupportedEncodingException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD