kotkabeans
Class RS2

java.lang.Object
  |
  +--kotkabeans.RS2

public class RS2
extends java.lang.Object

Stores ResultSet's data. Database connection must be open for initializing this bean.

See Also:
RSMetaData

Field Summary
protected  int count
          Number of rows.
protected  int currentRow
           
protected  java.lang.String name
           
protected  java.lang.Object[][] rows
           
protected  RSMetaData rsmd
          Stores ResultSet's metadata as in ResultSetMetaData.
protected  boolean sqlNull
          Whether the last column read has value of SQL null
 
Constructor Summary
RS2()
          Dummy empty constructor.
RS2(java.sql.ResultSet rs)
           
RS2(java.sql.ResultSet rs, boolean log)
           
RS2(java.sql.ResultSet rs, java.lang.String name)
           
RS2(java.sql.ResultSet rs, java.lang.String name, boolean log)
           
RS2(java.lang.String name, java.sql.ResultSet rs)
          Constructor with ResultSet as parameter.
RS2(java.lang.String name, java.sql.ResultSet rs, boolean log)
           
 
Method Summary
 void addRs(java.sql.ResultSet rs)
          Add another rs to the end of current records.
 void afterLast()
          Moves the cursor to one after the last row in this RSContainer object.
 void beforeFirst()
          Moves the cursor to one before the first row in this RSContainer object.
 void close()
           
 int count()
           
 void first()
          Moves the cursor to the first row in this RSContainer object.
 java.sql.Array getArray(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as an Array object in the Java programming language.
 java.sql.Array getArray(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as an Array object in the Java programming language.
 boolean getBoolean(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a boolean in the Java programming language.
 boolean getBoolean(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a boolean in the Java programming language.
 int getColumnCount()
          Retrieve number of columns in this RS2.
 double getDouble(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a double in the Java programming language.
 double getDouble(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a double in the Java programming language.
 float getFloat(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a float in the Java programming language.
 float getFloat(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a float in the Java programming language.
 int getInt(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as an int in the Java programming language.
 int getInt(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as an int in the Java programming language.
 long getLong(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a long in the Java programming language.
 long getLong(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a long in the Java programming language.
 RSMetaData getMetaData()
          Retrieves the number, types and properties of this RSContainer object's columns.
 java.lang.Object getObject(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as a short in the Java programming language.
 java.lang.Object getObject(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as an Object in the Java programming language.
 int getRow()
          Finds the column index of the given column name.
 java.lang.String getString(int colIndex)
          Retrieves the value of the wanted column in the current row of this RSContainer object as an String in the Java programming language.
 java.lang.String getString(java.lang.String colName)
          Retrieves the value of the wanted column in the current row of this RSContainer object as an String in the Java programming language.
 boolean isAfterLast()
          Retrieves whether the cursor is after the last row in this RSContainer object.
 boolean isBeforeFirst()
          Retrieves whether the cursor is before the first row in this RSContainer object.
 boolean isFirst()
          Retrieves whether the cursor is on the first row of this RSContainer object.
 boolean isLast()
          Retrieves whether the cursor is on the last row of this RSContainer object.
 void last()
          Moves the cursor to the last row in this RSContainer object.
 boolean next()
          Retrieves the value of the wanted column in the current row of this RSContainer object as an java.sql.Time in the Java programming language.
 boolean previous()
          Moves the cursor to the previous row in this RSContainer object.
 int size()
          Retrieve number of rows in this RS2.
 void sortArray(int field)
          Implements self-constructed mergesort for 2-dim array
 boolean wasNull()
          Reports whether the last column read had a value of SQL NULL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rsmd

protected RSMetaData rsmd
Stores ResultSet's metadata as in ResultSetMetaData.


count

protected int count
Number of rows.


rows

protected java.lang.Object[][] rows

currentRow

protected int currentRow

sqlNull

protected boolean sqlNull
Whether the last column read has value of SQL null


name

protected java.lang.String name
Constructor Detail

RS2

public RS2()
Dummy empty constructor.


RS2

public RS2(java.sql.ResultSet rs)

RS2

public RS2(java.sql.ResultSet rs,
           boolean log)

RS2

public RS2(java.lang.String name,
           java.sql.ResultSet rs)
Constructor with ResultSet as parameter. Reads ResultSet's data to attributes. Needs (ResultSet needs!) open database connection.

Parameters:
rs - ResultSet to read
Throws:
java.sql.SQLException - if something fails reading ResultSet object

RS2

public RS2(java.lang.String name,
           java.sql.ResultSet rs,
           boolean log)

RS2

public RS2(java.sql.ResultSet rs,
           java.lang.String name)

RS2

public RS2(java.sql.ResultSet rs,
           java.lang.String name,
           boolean log)
Method Detail

addRs

public void addRs(java.sql.ResultSet rs)
Add another rs to the end of current records.


sortArray

public void sortArray(int field)
Implements self-constructed mergesort for 2-dim array


getMetaData

public RSMetaData getMetaData()
Retrieves the number, types and properties of this RSContainer object's columns.

Returns:
the description of this RSContainer object's columns

size

public int size()
Retrieve number of rows in this RS2.

Returns:
number of rows

count

public int count()

getColumnCount

public int getColumnCount()
Retrieve number of columns in this RS2.

Returns:
number of columns

getRow

public int getRow()
Finds the column index of the given column name.

Returns:
the column index of the given column name
Throws:
java.lang.Exception - if the RSContainer object does not contain colName public abstract int findColumn(String colName) throws Exception; /** Retrieves the current row number. The first row is number 1, the second number 2, and so on.

getArray

public java.sql.Array getArray(int colIndex)
                        throws java.lang.ClassCastException
Retrieves the value of the wanted column in the current row of this RSContainer object as an Array object in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:
an Array object representing the SQL ARRAY value in the specified column
java.lang.ClassCastException

getArray

public java.sql.Array getArray(java.lang.String colName)
                        throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as an Array object in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
an Array object representing the SQL ARRAY value in the specified column
java.lang.Exception

getBoolean

public boolean getBoolean(int colIndex)
                   throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as a boolean in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is false
java.lang.Exception

getBoolean

public boolean getBoolean(java.lang.String colName)
                   throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as a boolean in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
the column value; if the value is SQL NULL, the value returned is false
java.lang.Exception

getDouble

public double getDouble(int colIndex)
                 throws java.lang.ClassCastException
Retrieves the value of the wanted column in the current row of this RSContainer object as a double in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:
java.lang.ClassCastException

getDouble

public double getDouble(java.lang.String colName)
                 throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as a double in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
java.lang.Exception

getFloat

public float getFloat(int colIndex)
               throws java.lang.ClassCastException
Retrieves the value of the wanted column in the current row of this RSContainer object as a float in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:
java.lang.ClassCastException

getFloat

public float getFloat(java.lang.String colName)
               throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as a float in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
java.lang.Exception

getInt

public int getInt(int colIndex)
           throws java.lang.ClassCastException
Retrieves the value of the wanted column in the current row of this RSContainer object as an int in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:
java.lang.ClassCastException

getInt

public int getInt(java.lang.String colName)
           throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as an int in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
java.lang.Exception

getLong

public long getLong(int colIndex)
             throws java.lang.ClassCastException
Retrieves the value of the wanted column in the current row of this RSContainer object as a long in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:
java.lang.ClassCastException

getLong

public long getLong(java.lang.String colName)
             throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as a long in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
java.lang.Exception

getObject

public java.lang.Object getObject(int colIndex)
Retrieves the value of the wanted column in the current row of this RSContainer object as a short in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:
public short getShort(int colIndex) { } /** Retrieves the value of the wanted column in the current row of this RSContainer object as a short in the Java programming language.

getObject

public java.lang.Object getObject(java.lang.String colName)
                           throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as an Object in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
java.lang.Exception

getString

public java.lang.String getString(int colIndex)
Retrieves the value of the wanted column in the current row of this RSContainer object as an String in the Java programming language.

Parameters:
colIndex - the first column is 1, the second is 2, ...
Returns:

getString

public java.lang.String getString(java.lang.String colName)
                           throws java.lang.Exception
Retrieves the value of the wanted column in the current row of this RSContainer object as an String in the Java programming language.

Parameters:
colName - the name of the column from which to retrieve the value
Returns:
java.lang.Exception

next

public boolean next()
Retrieves the value of the wanted column in the current row of this RSContainer object as an java.sql.Time in the Java programming language.

Returns:
public Time getTime(int colIndex) { } /** Retrieves the value of the wanted column in the current row of this RSContainer object as an java.sql.Time in the Java programming language.

previous

public boolean previous()
Moves the cursor to the previous row in this RSContainer object.


wasNull

public boolean wasNull()
Reports whether the last column read had a value of SQL NULL.

Returns:

isFirst

public boolean isFirst()
Retrieves whether the cursor is on the first row of this RSContainer object.

Returns:
true if the cursor is on the first row; false otherwise

isLast

public boolean isLast()
Retrieves whether the cursor is on the last row of this RSContainer object.

Returns:
true if the cursor is on the last row; false otherwise

isBeforeFirst

public boolean isBeforeFirst()
Retrieves whether the cursor is before the first row in this RSContainer object.

Returns:
true if the cursor is before the first row; false if the cursor is at any other position or the result set contains no rows

isAfterLast

public boolean isAfterLast()
Retrieves whether the cursor is after the last row in this RSContainer object.

Returns:
true if the cursor is after the last row; false if the cursor is at any other position or the result set contains no rows

first

public void first()
Moves the cursor to the first row in this RSContainer object.


last

public void last()
Moves the cursor to the last row in this RSContainer object.


beforeFirst

public void beforeFirst()
Moves the cursor to one before the first row in this RSContainer object.


afterLast

public void afterLast()
Moves the cursor to one after the last row in this RSContainer object.


close

public void close()