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 RecordCursor
public void fieldNames(java.util.function.Consumer<java.lang.String> consumer)
RecordCursor
fieldNames
in interface RecordCursor
consumer
- Consumerpublic boolean isNull(java.lang.String name)
isNull
in interface RecordCursor
name
- Field namepublic void convert(java.sql.ResultSet result) throws java.sql.SQLException
public java.lang.String field(int index)
field
in interface RecordCursor
index
- earmark indexpublic java.lang.String field(java.lang.String name)
field
in interface RecordCursor
name
- column`s namepublic byte[] fieldBytes(java.lang.String name)
fieldBytes
in interface RecordCursor
name
- column`s namepublic long fieldLong(java.lang.String name)
RecordCursor
fieldLong
in interface RecordCursor
name
- Field namepublic int fieldInt(java.lang.String name) throws java.lang.NumberFormatException
RecordCursor
fieldInt
in interface RecordCursor
name
- Field namejava.lang.NumberFormatException
public float fieldFloat(java.lang.String name)
RecordCursor
fieldFloat
in interface RecordCursor
name
- Field namepublic double fieldDouble(java.lang.String name)
RecordCursor
fieldDouble
in interface RecordCursor
name
- Field namepublic java.math.BigDecimal fieldBigDecimal(java.lang.String name)
RecordCursor
fieldBigDecimal
in interface RecordCursor
name
- Field namepublic <T> java.util.List<T> fieldArray(java.lang.String name, java.lang.Class<T[]> castClass)
RecordCursor
fieldArray
in interface RecordCursor
T
- list elementname
- Field namecastClass
- Cast classpublic java.lang.Object fieldObject(java.lang.String name)
RecordCursor
fieldObject
in interface RecordCursor
name
- Field namepublic void next()
next
in interface RecordCursor
public void previous()
previous
in interface RecordCursor
public void move(int index)
move
in interface RecordCursor
index
- Earmark row index.public void first()
first
in interface RecordCursor
public void end()
end
in interface RecordCursor
public boolean isBof()
isBof
in interface RecordCursor
public boolean isEof()
isEof
in interface RecordCursor
public int getRecordCount()
getRecordCount
in interface RecordCursor
public 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 RecordCursor
action
- Take the row data.The instance RowSet would be reused.public java.util.stream.Stream<RowSet> stream()
stream
in interface RecordCursor
public java.util.stream.Stream<RowSet> parallelStream()
parallelStream
in interface RecordCursor
public java.lang.String toString()
toString
in class java.lang.Object
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public java.lang.String getColumnName(int index)
getColumnName
in interface Record
index
- index (range : 1 ~ column.length - 1)public LastInsertId getLastInsertId(java.sql.Statement statement) throws java.sql.SQLException
getLastInsertId
in interface Record
statement
- statementjava.sql.SQLException
- SQLException