public class SQLRecord
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
| Constructor and Description |
|---|
SQLRecord()
Constructor for SQLRecord.
|
SQLRecord(int initialSize)
Constructor for SQLRecord.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
SQLRecord |
cloneDefinition()
clone the definition of this record, but not
the values set for any of the columns
|
static SQLRecord |
createEmptyRecord(java.sql.ResultSetMetaData meta)
automatically create a new SQLRecord structure from ResultSetMeta
|
static SQLRecord |
createRecord(java.sql.ResultSet rs)
automatically create a new SQLRecord from a ResultSet
|
boolean |
equals(java.lang.Object obj)
determines if two objects are equal by comparing their hashCodes
|
boolean |
getBoolValue(int idx)
get the value of the column at the given index as a boolean.
|
boolean |
getBoolValue(java.lang.String name)
get the boolean value belonging to the column identified by name
|
java.lang.String |
getColumn(int idx)
get the column identifier for the column at the given index
|
int |
getColumnCount()
get the number of fields in this cursor data object
|
java.lang.Class |
getColumnType(int idx)
get the column type for the column given by the specified index
|
java.lang.Class |
getColumnType(java.lang.String name)
get the column type for the column identified by name
|
double |
getDoubleValue(int idx)
get the value of the column at the given index as a double.
|
double |
getDoubleValue(java.lang.String name)
get the double value belonging to the column identified by name
|
int |
getIndex(java.lang.String name)
get the index of the column identified by name
|
int |
getIntValue(int idx)
get the value of the column at the given index as an integer.
|
int |
getIntValue(java.lang.String name)
get the intValue belonging to the column identified by name
|
long |
getLongValue(int idx)
get the value of the column at the given index as a long.
|
long |
getLongValue(java.lang.String name)
get the longValue belonging to the column identified by name
|
java.lang.String |
getString(int idx) |
java.lang.String |
getString(java.lang.String name) |
java.lang.Object |
getValue(int idx)
get the value of the column at the given index as an Object
|
java.lang.Object |
getValue(java.lang.String name)
get the value of the column identified by name as an Object
|
int |
hashCode() |
java.lang.String |
paramString() |
void |
setColumn(int idx,
java.lang.String name)
set a column identified by name at the specified position
|
void |
setColumn(int idx,
java.lang.String name,
java.lang.Class c)
convenience method to set the column name,class and value at once at a given index
|
void |
setColumn(int idx,
java.lang.String name,
java.lang.Class c,
java.lang.Object value)
convinience method to set the column name,class and value at once at a given index
|
void |
setColumnType(int idx,
java.lang.Class c)
set the Class identifying the type of content for this column
by index.
|
void |
setValue(int idx,
java.lang.Object value)
set the content value for the specified index
|
void |
setValue(java.lang.String name,
java.lang.Object value)
set the content value for the column identified by name
|
public SQLRecord()
Sets the initial size to 0
public SQLRecord(int initialSize)
initialSize - int, the number of columns to
create for this Recordpublic int getColumnCount()
public void setColumn(int idx,
java.lang.String name)
idx - int, the index to set the column toname - String, the identifier for this columnpublic java.lang.String getColumn(int idx)
idx - int, the index of the columnpublic void setColumnType(int idx,
java.lang.Class c)
idx - int, the index of the columnc - Class, the class identifying the content for this column.
Use the Integer.TYPE, Boolean.TYPE, etc. for the primitivespublic java.lang.Class getColumnType(java.lang.String name)
name - String, the column identifierpublic java.lang.Class getColumnType(int idx)
idx - int, the index of the columnpublic void setValue(int idx,
java.lang.Object value)
idx - int, the index of the columnvalue - Object, the value for this specific column. The type of Object
should be consistent with the type of column you defined through setColumnType(int,Class)setColumnType(int, Class)public void setValue(java.lang.String name,
java.lang.Object value)
name - String, the column identifiervalue - Object, the value for this specific column. The type of Object
should be consistent with the type of column you defined through setColumnType(int,Class)setColumnType(int, Class)public void setColumn(int idx,
java.lang.String name,
java.lang.Class c,
java.lang.Object value)
idx - int, the index of the columnname - String, the column identifiervalue - Object, the value for this specific column. You can set the column type
afterwards. The value and type should be consistentpublic void setColumn(int idx,
java.lang.String name,
java.lang.Class c)
idx - int, the index of the columnname - String, the column identifierc - Class, the column type for this specific column. The value and type should be consistentpublic java.lang.Object getValue(int idx)
idx - int, the index of the columnnull if no
previous value was setpublic boolean getBoolValue(java.lang.String name)
name - String, the name of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic boolean getBoolValue(int idx)
idx - int, the index of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic double getDoubleValue(int idx)
idx - int, the index of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic double getDoubleValue(java.lang.String name)
name - String, the name of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic int getIntValue(int idx)
idx - int, the index of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic long getLongValue(int idx)
idx - int, the index of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic long getLongValue(java.lang.String name)
name - String, the name of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic java.lang.String getString(java.lang.String name)
public java.lang.String getString(int idx)
public java.lang.Object getValue(java.lang.String name)
name - String, the column identifierpublic int getIntValue(java.lang.String name)
name - String, the name of the columnNumberFormatException, - If the value set to this specific column cannot be cast to an intpublic int getIndex(java.lang.String name)
name - String, the column identifier ignoring casepublic boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(Object)public int hashCode()
hashCode in class java.lang.Objectpublic SQLRecord cloneDefinition()
public java.lang.Object clone()
clone in class java.lang.Objectpublic static final SQLRecord createRecord(java.sql.ResultSet rs) throws java.sql.SQLException
rs - ResultSet, expects a previous successful call to rs.next()java.sql.SQLException - thrown if ResultSet throws the Exceptionpublic static final SQLRecord createEmptyRecord(java.sql.ResultSetMetaData meta) throws java.sql.SQLException
The name and type are set, the value for this column is not set. This can be used when the resultset is empty and a new record needs to be created.
meta - ResultSetMetajava.sql.SQLException - thrown if ResultSet throws the Exceptionpublic java.lang.String paramString()