public class Results
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
autoGeneratedKeys |
private int |
autoIncrement |
private boolean |
batch |
private boolean |
binaryFormat |
private SelectResultSet |
callableResultSet |
private CmdInformation |
cmdInformation |
private java.util.Deque<SelectResultSet> |
executionResults |
private int |
expectedSize |
private int |
fetchSize |
private int |
maxFieldSize |
private SelectResultSet |
resultSet |
private int |
resultSetConcurrency |
private int |
resultSetScrollType |
private boolean |
rewritten |
private MariaDbStatement |
statement |
Constructor and Description |
---|
Results()
Single Text query.
|
Results(MariaDbStatement statement,
int fetchSize,
boolean batch,
int expectedSize,
boolean binaryFormat,
int resultSetScrollType,
int resultSetConcurrency,
int autoGeneratedKeys,
int autoIncrement)
Default constructor.
|
Results(MariaDbStatement statement,
int autoIncrement,
int resultSetScrollType,
int resultSetConcurrency)
Constructor for specific statement.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Connection.abort() has been called, abort remaining active result-set
|
void |
addResultSet(SelectResultSet resultSet,
boolean moreResultAvailable)
Add resultSet to results.
|
void |
addStats(long updateCount,
long insertId,
boolean moreResultAvailable)
Add execution statistics.
|
void |
addStatsError(boolean moreResultAvailable)
Indicate that result is an Error, to set appropriate results.
|
void |
close() |
boolean |
commandEnd()
Indicate that command / batch is finished, so set current resultSet if needed.
|
int |
getAutoGeneratedKeys() |
SelectResultSet |
getCallableResultSet() |
CmdInformation |
getCmdInformation() |
int |
getCurrentStatNumber() |
int |
getExpectedSize() |
int |
getFetchSize() |
java.sql.ResultSet |
getGeneratedKeys(Protocol protocol)
Send a resultSet that contain auto generated keys.
|
int |
getMaxFieldSize() |
boolean |
getMoreResults(int current,
Protocol protocol)
Position to next resultSet.
|
SelectResultSet |
getResultSet() |
int |
getResultSetConcurrency() |
int |
getResultSetScrollType() |
MariaDbStatement |
getStatement() |
boolean |
isBatch() |
boolean |
isBinaryFormat() |
boolean |
isFullyLoaded(Protocol protocol)
Indicate if result contain result-set that is still streaming from server.
|
boolean |
isRewritten() |
void |
loadFully(boolean skip,
Protocol protocol)
Load fully current results.
|
void |
removeFetchSize() |
void |
setAutoIncrement(int autoIncrement) |
protected void |
setCmdInformation(CmdInformation cmdInformation) |
void |
setRewritten(boolean rewritten) |
private MariaDbStatement statement
private int fetchSize
private boolean batch
private int expectedSize
private CmdInformation cmdInformation
private java.util.Deque<SelectResultSet> executionResults
private SelectResultSet resultSet
private SelectResultSet callableResultSet
private boolean binaryFormat
private int resultSetScrollType
private int resultSetConcurrency
private int autoGeneratedKeys
private int maxFieldSize
private int autoIncrement
private boolean rewritten
public Results()
public Results(MariaDbStatement statement, int autoIncrement, int resultSetScrollType, int resultSetConcurrency)
statement
- current Statement.autoIncrement
- connection auto-incrementresultSetScrollType
- one of the following ResultSet
constants:
ResultSet.TYPE_FORWARD_ONLY
,
ResultSet.TYPE_SCROLL_INSENSITIVE
, or
ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency
- a concurrency type; one of ResultSet.CONCUR_READ_ONLY
or
ResultSet.CONCUR_UPDATABLE
public Results(MariaDbStatement statement, int fetchSize, boolean batch, int expectedSize, boolean binaryFormat, int resultSetScrollType, int resultSetConcurrency, int autoGeneratedKeys, int autoIncrement)
statement
- current statementfetchSize
- fetch sizebatch
- select result possibleexpectedSize
- expected sizebinaryFormat
- use binary protocolresultSetScrollType
- one of the following ResultSet
constants:
ResultSet.TYPE_FORWARD_ONLY
,
ResultSet.TYPE_SCROLL_INSENSITIVE
, or
ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency
- a concurrency type; one of ResultSet.CONCUR_READ_ONLY
or
ResultSet.CONCUR_UPDATABLE
autoGeneratedKeys
- a flag indicating whether auto-generated keys should be returned;
one of
Statement.RETURN_GENERATED_KEYS
or Statement.NO_GENERATED_KEYS
autoIncrement
- Connection auto-increment valuepublic void addStats(long updateCount, long insertId, boolean moreResultAvailable)
updateCount
- number of updated rowsinsertId
- primary keymoreResultAvailable
- is there additional packetpublic void addStatsError(boolean moreResultAvailable)
moreResultAvailable
- indicate if other results (ResultSet or updateCount) are available.public int getCurrentStatNumber()
public void addResultSet(SelectResultSet resultSet, boolean moreResultAvailable)
resultSet
- new resultSet.moreResultAvailable
- indicate if other results (ResultSet or updateCount) are available.public CmdInformation getCmdInformation()
protected void setCmdInformation(CmdInformation cmdInformation)
public boolean commandEnd()
public SelectResultSet getResultSet()
public SelectResultSet getCallableResultSet()
public void loadFully(boolean skip, Protocol protocol) throws java.sql.SQLException
Load fully current results.
Lock must be set before using this method
skip
- must result be available afterwhileprotocol
- current protocoljava.sql.SQLException
- if any connection error occurpublic void abort() throws java.sql.SQLException
java.sql.SQLException
- exceptionpublic boolean isFullyLoaded(Protocol protocol)
protocol
- current protocolpublic boolean getMoreResults(int current, Protocol protocol) throws java.sql.SQLException
current
- one of the following Statement
constants indicating what should
happen to current
ResultSet
objects obtained using the method
getResultSet
:
Statement.CLOSE_CURRENT_RESULT
, Statement.KEEP_CURRENT_RESULT
,
or Statement.CLOSE_ALL_RESULTS
protocol
- current protocoljava.sql.SQLException
- if any connection error occur.public int getFetchSize()
public MariaDbStatement getStatement()
public boolean isBatch()
public int getExpectedSize()
public boolean isBinaryFormat()
public void removeFetchSize()
public int getResultSetScrollType()
public java.sql.ResultSet getGeneratedKeys(Protocol protocol) throws java.sql.SQLException
example "INSERT INTO myTable values ('a'),('b');INSERT INTO myTable values ('c'),('d'),('e')" will have a resultSet of 2 values, and when Statement.getMoreResults() will be called, a Statement.getGeneratedKeys will return a resultset with 3 ids.
protocol
- current protocoljava.sql.SQLException
- if autoGeneratedKeys was not set to Statement.RETURN_GENERATED_KEYSpublic void close()
public int getMaxFieldSize()
public void setAutoIncrement(int autoIncrement)
public int getResultSetConcurrency()
public int getAutoGeneratedKeys()
public boolean isRewritten()
public void setRewritten(boolean rewritten)