|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.brains2b.sql.SQLRecord
public class SQLRecord
Object for containing results from a Select statement
Constructor Summary | |
---|---|
SQLRecord()
Constructor for SQLRecord. |
|
SQLRecord(int initialSize)
Constructor for SQLRecord. |
Method Summary | |
---|---|
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()
|
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)
convinience 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 |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLRecord()
Sets the initial size to 0
public SQLRecord(int initialSize)
initialSize
- int, the number of columns to
create for this RecordMethod Detail |
---|
public 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 column
public 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 identifier
public java.lang.Class getColumnType(int idx)
idx
- int, the index of the column
public 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 identifiervalue
- Object, the value for this specific column. You can set the column type
afterwards. The value and type should be consistentpublic java.lang.Object getValue(int idx)
idx
- int, the index of the column
null
if no
previous value was setpublic boolean getBoolValue(java.lang.String name)
name
- String, the name of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public boolean getBoolValue(int idx)
idx
- int, the index of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public double getDoubleValue(int idx)
idx
- int, the index of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public double getDoubleValue(java.lang.String name)
name
- String, the name of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public int getIntValue(int idx)
idx
- int, the index of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public long getLongValue(int idx)
idx
- int, the index of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public long getLongValue(java.lang.String name)
name
- String, the name of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public 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 identifier
public int getIntValue(java.lang.String name)
name
- String, the name of the column
NumberFormatException,
- If the value set to this specific column cannot be cast to an int
public int getIndex(java.lang.String name)
name
- String, the column identifier ignoring case
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(Object)
public int hashCode()
hashCode
in class java.lang.Object
public SQLRecord cloneDefinition()
public java.lang.Object clone()
clone
in class java.lang.Object
public 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.
rs
- ResultSetMeta
java.sql.SQLException
- thrown if ResultSet throws the Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |