public class RecordSet extends java.lang.Object implements Record
| Constructor and Description |
|---|
RecordSet(DatabaseCategory category)
Initialize.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Clear the catch data.
|
void |
convert(java.sql.ResultSet result)
Convert the result of a query.
|
void |
end()
Change the current row index to the end index.
|
java.lang.String |
field(int index)
Take the column value of the earmark index.
|
java.lang.String |
field(java.lang.String name)
Take the column value of the name and the current index.
|
<T> java.util.List<T> |
fieldArray(java.lang.String name,
java.lang.Class<T[]> castClass)
Get value by specified field name.
|
java.math.BigDecimal |
fieldBigDecimal(java.lang.String name)
Get value by specified field name.
|
byte[] |
fieldBytes(java.lang.String name)
Take the column value of the name and the current index, Return Object null, if the value is
null.
|
double |
fieldDouble(java.lang.String name)
Get value by specified field name.
|
float |
fieldFloat(java.lang.String name)
Get value by specified field name.
|
int |
fieldInt(java.lang.String name)
Get value by specified field name.
|
long |
fieldLong(java.lang.String name)
Get value by specified field name.
|
void |
fieldNames(java.util.function.Consumer<java.lang.String> consumer)
Get name of table fields.
|
java.lang.Object |
fieldObject(java.lang.String name)
Get value by specified field name.
|
void |
first()
Change the current row index to the first index.
|
void |
forEach(java.util.function.Consumer<RowSet> action)
Take the row data by row data.
|
java.lang.String |
getColumnName(int index)
Returns name of column.
|
int |
getFieldCount()
Take count in the table`s column.
|
LastInsertId |
getLastInsertId(java.sql.Statement statement)
Returns last insert id.
|
int |
getRecordCount()
Take the row count in SQL statement execute finish.
|
boolean |
isBof()
Is the current row index equal first index.
|
boolean |
isEof()
is the current row index equal end index.
|
boolean |
isNull(java.lang.String name)
If the query database specifies a field name and its value is null, it will return null.
|
void |
move(int index)
Change the current row index.
|
void |
next()
Add one up the current row index.
|
java.util.stream.Stream<RowSet> |
parallelStream()
Return the parallel stream in SQL statement execute finish.
|
void |
previous()
Subtract one from the current row index.
|
java.util.stream.Stream<RowSet> |
stream()
Return the serialization stream in SQL statement execute finish.
|
java.lang.String |
toString() |
public RecordSet(DatabaseCategory category)
category - database modepublic int getFieldCount()
getFieldCount in interface RecordCursorpublic void fieldNames(java.util.function.Consumer<java.lang.String> consumer)
RecordCursorfieldNames in interface RecordCursorconsumer - Consumerpublic boolean isNull(java.lang.String name)
isNull in interface RecordCursorname - Field namepublic void convert(java.sql.ResultSet result)
throws java.sql.SQLException
public java.lang.String field(int index)
field in interface RecordCursorindex - earmark indexpublic java.lang.String field(java.lang.String name)
field in interface RecordCursorname - column`s namepublic byte[] fieldBytes(java.lang.String name)
fieldBytes in interface RecordCursorname - column`s namepublic long fieldLong(java.lang.String name)
RecordCursorfieldLong in interface RecordCursorname - Field namepublic int fieldInt(java.lang.String name)
throws java.lang.NumberFormatException
RecordCursorfieldInt in interface RecordCursorname - Field namejava.lang.NumberFormatExceptionpublic float fieldFloat(java.lang.String name)
RecordCursorfieldFloat in interface RecordCursorname - Field namepublic double fieldDouble(java.lang.String name)
RecordCursorfieldDouble in interface RecordCursorname - Field namepublic java.math.BigDecimal fieldBigDecimal(java.lang.String name)
RecordCursorfieldBigDecimal in interface RecordCursorname - Field namepublic <T> java.util.List<T> fieldArray(java.lang.String name,
java.lang.Class<T[]> castClass)
RecordCursorfieldArray in interface RecordCursorT - list elementname - Field namecastClass - Cast classpublic java.lang.Object fieldObject(java.lang.String name)
RecordCursorfieldObject in interface RecordCursorname - Field namepublic void next()
next in interface RecordCursorpublic void previous()
previous in interface RecordCursorpublic void move(int index)
move in interface RecordCursorindex - Earmark row index.public void first()
first in interface RecordCursorpublic void end()
end in interface RecordCursorpublic boolean isBof()
isBof in interface RecordCursorpublic boolean isEof()
isEof in interface RecordCursorpublic int getRecordCount()
getRecordCount in interface RecordCursorpublic void forEach(java.util.function.Consumer<RowSet> action)
Execute situation like the program show
RecordSet record = ...
while(!record.isEOF()){
//do get record data
record.next();
}
forEach in interface RecordCursoraction - Take the row data.The instance RowSet would be reused.public java.util.stream.Stream<RowSet> stream()
stream in interface RecordCursorpublic java.util.stream.Stream<RowSet> parallelStream()
parallelStream in interface RecordCursorpublic java.lang.String toString()
toString in class java.lang.Objectpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic java.lang.String getColumnName(int index)
getColumnName in interface Recordindex - index (range : 1 ~ column.length - 1)public LastInsertId getLastInsertId(java.sql.Statement statement) throws java.sql.SQLException
getLastInsertId in interface Recordstatement - statementjava.sql.SQLException - SQLException