Package org.mariadb.jdbc.client.result
Class CompleteResult
- java.lang.Object
-
- org.mariadb.jdbc.client.result.Result
-
- org.mariadb.jdbc.client.result.CompleteResult
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.ResultSet
,java.sql.Wrapper
,Completion
,ServerMessage
- Direct Known Subclasses:
UpdatableResult
public class CompleteResult extends Result
Result-set that will retrieve all rows immediately before returning the result-set.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
BEFORE_FIRST_POS
before first row position = initial positionprivate boolean
bulkResult
private boolean
mightBeBulkResult
-
Fields inherited from class org.mariadb.jdbc.client.result.Result
closed, context, data, dataSize, exceptionFactory, fieldIndex, loaded, maxRows, metadataList, NULL_LENGTH, outputParameter, reader, resultSetType, rowBuf, rowDecoder, rowPointer, statement, traceEnable
-
-
Constructor Summary
Constructors Modifier Constructor Description CompleteResult(ColumnDecoder[] metadataList, byte[][] data, Context context, int resultSetType)
Specific constructor for internal build result-set, empty resultset, or generated key result-set.private
CompleteResult(ColumnDecoder[] metadataList, CompleteResult prev)
CompleteResult(Statement stmt, boolean binaryProtocol, long maxRows, ColumnDecoder[] metadataList, Reader reader, Context context, int resultSetType, boolean closeOnCompletion, boolean traceEnable, boolean mightBeBulkResult)
Constructor from exchanges
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
absolute(int idx)
void
afterLast()
void
beforeFirst()
void
closeFromStmtClose(ClosableLock lock)
Closing result-set due to closing statement that issue command.static java.sql.ResultSet
createResultSet(java.lang.String[] columnNames, DataType[] columnTypes, java.lang.String[][] data, Context context, int flags, int resultSetType)
Create a result set from given data.static java.sql.ResultSet
createResultSet(java.lang.String columnName, DataType columnType, java.lang.String[][] data, Context context, int flags, int resultSetType)
Specific constructor for generating generated key result-set.void
fetchRemaining()
Fetch remaining results.boolean
first()
int
getFetchSize()
int
getRow()
boolean
isAfterLast()
boolean
isBulkResult()
Indicate if result-set is a bulk unitary resultboolean
isFirst()
boolean
isLast()
boolean
last()
CompleteResult
newResultsetWithUseAliasAsName()
Recreate Result-set with metadata using alias as name.boolean
next()
Position resultset to next rowboolean
previous()
boolean
relative(int rows)
void
setBulkResult()
Indicate that result is a bulk resultvoid
setFetchSize(int rows)
boolean
streaming()
Indicate of current result-set is a streaming result-set-
Methods inherited from class org.mariadb.jdbc.client.result.Result
abort, addRowData, cancelRowUpdates, checkClose, checkNotForwardOnly, clearWarnings, close, closeOnCompletion, deleteRow, findColumn, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCurrentRowData, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getMetaData, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isBeforeFirst, isClosed, isOutputParameter, isWrapperFor, loaded, moveToCurrentRow, moveToInsertRow, readNext, refreshRow, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setNullRowBuf, setRow, setStatement, skipRemaining, unwrap, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowData, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNull
-
-
-
-
Field Detail
-
BEFORE_FIRST_POS
protected static final int BEFORE_FIRST_POS
before first row position = initial position- See Also:
- Constant Field Values
-
bulkResult
private boolean bulkResult
-
mightBeBulkResult
private boolean mightBeBulkResult
-
-
Constructor Detail
-
CompleteResult
public CompleteResult(Statement stmt, boolean binaryProtocol, long maxRows, ColumnDecoder[] metadataList, Reader reader, Context context, int resultSetType, boolean closeOnCompletion, boolean traceEnable, boolean mightBeBulkResult) throws java.io.IOException, java.sql.SQLException
Constructor from exchanges- Parameters:
stmt
- current statementbinaryProtocol
- does exchanges uses binary protocolmaxRows
- maximum number of rowsmetadataList
- metadatareader
- packet readercontext
- connection contextresultSetType
- result set typecloseOnCompletion
- close statement on completiontraceEnable
- network trace exchange possiblemightBeBulkResult
- might be a bulk unitary result- Throws:
java.io.IOException
- if Socket error occursjava.sql.SQLException
- for all other kind of errors
-
CompleteResult
private CompleteResult(ColumnDecoder[] metadataList, CompleteResult prev)
-
CompleteResult
public CompleteResult(ColumnDecoder[] metadataList, byte[][] data, Context context, int resultSetType)
Specific constructor for internal build result-set, empty resultset, or generated key result-set.- Parameters:
metadataList
- metadatadata
- result-set datacontext
- connection contextresultSetType
- result set type
-
-
Method Detail
-
setBulkResult
public void setBulkResult()
Description copied from class:Result
Indicate that result is a bulk result- Specified by:
setBulkResult
in classResult
-
createResultSet
public static java.sql.ResultSet createResultSet(java.lang.String columnName, DataType columnType, java.lang.String[][] data, Context context, int flags, int resultSetType)
Specific constructor for generating generated key result-set.- Parameters:
columnName
- column keycolumnType
- column key typedata
- valuescontext
- connection contextflags
- column flagsresultSetType
- result set type- Returns:
- result-set
-
createResultSet
public static java.sql.ResultSet createResultSet(java.lang.String[] columnNames, DataType[] columnTypes, java.lang.String[][] data, Context context, int flags, int resultSetType)
Create a result set from given data. Useful for creating "fake" resultSets for DatabaseMetaData, (one example is MariaDbDatabaseMetaData.getTypeInfo())- Parameters:
columnNames
- - string array of column namescolumnTypes
- - column typesdata
- - each element of this array represents a complete row in the ResultSet. Each value is given in its string representation, as in MariaDB text protocol, except boolean (BIT(1)) values that are represented as "1" or "0" stringscontext
- connection contextflags
- column flagsresultSetType
- result set type- Returns:
- resultset
-
newResultsetWithUseAliasAsName
public CompleteResult newResultsetWithUseAliasAsName()
Recreate Result-set with metadata using alias as name.- Returns:
- Result-set with metadata using alias as name
-
next
public boolean next() throws java.sql.SQLException
Description copied from class:Result
Position resultset to next row
-
streaming
public boolean streaming()
Description copied from class:Result
Indicate of current result-set is a streaming result-set
-
isBulkResult
public boolean isBulkResult()
Description copied from class:Result
Indicate if result-set is a bulk unitary result- Specified by:
isBulkResult
in classResult
- Returns:
- true if unitary result-set
-
fetchRemaining
public void fetchRemaining()
Description copied from class:Result
Fetch remaining results.- Specified by:
fetchRemaining
in classResult
-
closeFromStmtClose
public void closeFromStmtClose(ClosableLock lock)
Description copied from class:Result
Closing result-set due to closing statement that issue command.- Overrides:
closeFromStmtClose
in classResult
- Parameters:
lock
- thread locker object
-
isAfterLast
public boolean isAfterLast() throws java.sql.SQLException
- Specified by:
isAfterLast
in interfacejava.sql.ResultSet
- Specified by:
isAfterLast
in classResult
- Throws:
java.sql.SQLException
-
isFirst
public boolean isFirst() throws java.sql.SQLException
-
isLast
public boolean isLast() throws java.sql.SQLException
-
beforeFirst
public void beforeFirst() throws java.sql.SQLException
- Specified by:
beforeFirst
in interfacejava.sql.ResultSet
- Specified by:
beforeFirst
in classResult
- Throws:
java.sql.SQLException
-
afterLast
public void afterLast() throws java.sql.SQLException
-
first
public boolean first() throws java.sql.SQLException
-
last
public boolean last() throws java.sql.SQLException
-
getRow
public int getRow() throws java.sql.SQLException
-
absolute
public boolean absolute(int idx) throws java.sql.SQLException
-
relative
public boolean relative(int rows) throws java.sql.SQLException
-
previous
public boolean previous() throws java.sql.SQLException
-
getFetchSize
public int getFetchSize() throws java.sql.SQLException
- Specified by:
getFetchSize
in interfacejava.sql.ResultSet
- Overrides:
getFetchSize
in classResult
- Throws:
java.sql.SQLException
-
setFetchSize
public void setFetchSize(int rows) throws java.sql.SQLException
- Specified by:
setFetchSize
in interfacejava.sql.ResultSet
- Overrides:
setFetchSize
in classResult
- Throws:
java.sql.SQLException
-
-