Class Results
- java.lang.Object
-
- org.mariadb.jdbc.internal.com.read.dao.Results
-
public class Results extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private intautoGeneratedKeysprivate intautoIncrementprivate booleanbatchprivate booleanbinaryFormatprivate SelectResultSetcallableResultSetprivate CmdInformationcmdInformationprivate java.util.Deque<SelectResultSet>executionResultsprivate intexpectedSizeprivate intfetchSizeprivate intmaxFieldSizeprivate ParameterHolder[]parametersprivate SelectResultSetresultSetprivate intresultSetConcurrencyprivate intresultSetScrollTypeprivate booleanrewrittenprivate java.lang.Stringsqlprivate MariaDbStatementstatement
-
Constructor Summary
Constructors Constructor Description Results()Single Text query.Results(MariaDbStatement statement, int fetchSize, boolean batch, int expectedSize, boolean binaryFormat, int resultSetScrollType, int resultSetConcurrency, int autoGeneratedKeys, int autoIncrement, java.lang.String sql, ParameterHolder[] parameters)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Connection.abort() has been called, abort remaining active result-setvoidaddResultSet(SelectResultSet resultSet, boolean moreResultAvailable)Add resultSet to results.voidaddStats(long updateCount, long insertId, boolean moreResultAvailable)Add execution statistics.voidaddStatsError(boolean moreResultAvailable)Indicate that result is an Error, to set appropriate results.voidclose()booleancommandEnd()Indicate that command / batch is finished, so set current resultSet if needed.intgetAutoGeneratedKeys()SelectResultSetgetCallableResultSet()CmdInformationgetCmdInformation()intgetCurrentStatNumber()intgetExpectedSize()intgetFetchSize()java.sql.ResultSetgetGeneratedKeys(Protocol protocol)Send a resultSet that contain auto generated keys.intgetMaxFieldSize()booleangetMoreResults(int current, Protocol protocol)Position to next resultSet.ParameterHolder[]getParameters()SelectResultSetgetResultSet()intgetResultSetConcurrency()intgetResultSetScrollType()java.lang.StringgetSql()MariaDbStatementgetStatement()booleanisBatch()booleanisBinaryFormat()booleanisFullyLoaded(Protocol protocol)Indicate if result contain result-set that is still streaming from server.booleanisRewritten()voidloadFully(boolean skip, Protocol protocol)Load fully current results.voidremoveFetchSize()voidsetAutoIncrement(int autoIncrement)protected voidsetCmdInformation(CmdInformation cmdInformation)voidsetRewritten(boolean rewritten)
-
-
-
Field Detail
-
statement
private MariaDbStatement statement
-
fetchSize
private int fetchSize
-
batch
private boolean batch
-
expectedSize
private int expectedSize
-
cmdInformation
private CmdInformation cmdInformation
-
executionResults
private java.util.Deque<SelectResultSet> executionResults
-
resultSet
private SelectResultSet resultSet
-
callableResultSet
private SelectResultSet callableResultSet
-
binaryFormat
private boolean binaryFormat
-
resultSetScrollType
private int resultSetScrollType
-
resultSetConcurrency
private int resultSetConcurrency
-
autoGeneratedKeys
private int autoGeneratedKeys
-
maxFieldSize
private int maxFieldSize
-
autoIncrement
private int autoIncrement
-
rewritten
private boolean rewritten
-
sql
private java.lang.String sql
-
parameters
private ParameterHolder[] parameters
-
-
Constructor Detail
-
Results
public Results()
Single Text query. /! use internally, because autoincrement value is not right for multi-queries !/
-
Results
public Results(MariaDbStatement statement, int fetchSize, boolean batch, int expectedSize, boolean binaryFormat, int resultSetScrollType, int resultSetConcurrency, int autoGeneratedKeys, int autoIncrement, java.lang.String sql, ParameterHolder[] parameters)
Default constructor.- Parameters:
statement- current statementfetchSize- fetch sizebatch- select result possibleexpectedSize- expected sizebinaryFormat- use binary protocolresultSetScrollType- one of the followingResultSetconstants:ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency- a concurrency type; one ofResultSet.CONCUR_READ_ONLYorResultSet.CONCUR_UPDATABLEautoGeneratedKeys- a flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYSorStatement.NO_GENERATED_KEYSautoIncrement- Connection auto-increment valuesql- sql commandparameters- parameters
-
-
Method Detail
-
addStats
public void addStats(long updateCount, long insertId, boolean moreResultAvailable)Add execution statistics.- Parameters:
updateCount- number of updated rowsinsertId- primary keymoreResultAvailable- is there additional packet
-
addStatsError
public void addStatsError(boolean moreResultAvailable)
Indicate that result is an Error, to set appropriate results.- Parameters:
moreResultAvailable- indicate if other results (ResultSet or updateCount) are available.
-
getCurrentStatNumber
public int getCurrentStatNumber()
-
addResultSet
public void addResultSet(SelectResultSet resultSet, boolean moreResultAvailable)
Add resultSet to results.- Parameters:
resultSet- new resultSet.moreResultAvailable- indicate if other results (ResultSet or updateCount) are available.
-
getCmdInformation
public CmdInformation getCmdInformation()
-
setCmdInformation
protected void setCmdInformation(CmdInformation cmdInformation)
-
commandEnd
public boolean commandEnd()
Indicate that command / batch is finished, so set current resultSet if needed.- Returns:
- true id has cmdInformation
-
getResultSet
public SelectResultSet getResultSet()
-
getCallableResultSet
public SelectResultSet getCallableResultSet()
-
loadFully
public void loadFully(boolean skip, Protocol protocol) throws java.sql.SQLExceptionLoad fully current results.Lock must be set before using this method
- Parameters:
skip- must result be available afterwhileprotocol- current protocol- Throws:
java.sql.SQLException- if any connection error occur
-
abort
public void abort() throws java.sql.SQLExceptionConnection.abort() has been called, abort remaining active result-set- Throws:
java.sql.SQLException- exception
-
isFullyLoaded
public boolean isFullyLoaded(Protocol protocol)
Indicate if result contain result-set that is still streaming from server.- Parameters:
protocol- current protocol- Returns:
- true if streaming is finished
-
getMoreResults
public boolean getMoreResults(int current, Protocol protocol) throws java.sql.SQLExceptionPosition to next resultSet.- Parameters:
current- one of the followingStatementconstants indicating what should happen to currentResultSetobjects obtained using the methodgetResultSet:Statement.CLOSE_CURRENT_RESULT,Statement.KEEP_CURRENT_RESULT, orStatement.CLOSE_ALL_RESULTSprotocol- current protocol- Returns:
- true if other resultSet exists.
- Throws:
java.sql.SQLException- if any connection error occur.
-
getFetchSize
public int getFetchSize()
-
getStatement
public MariaDbStatement getStatement()
-
isBatch
public boolean isBatch()
-
getExpectedSize
public int getExpectedSize()
-
isBinaryFormat
public boolean isBinaryFormat()
-
removeFetchSize
public void removeFetchSize()
-
getResultSetScrollType
public int getResultSetScrollType()
-
getSql
public java.lang.String getSql()
-
getParameters
public ParameterHolder[] getParameters()
-
getGeneratedKeys
public java.sql.ResultSet getGeneratedKeys(Protocol protocol) throws java.sql.SQLException
Send a resultSet that contain auto generated keys. 2 differences :- Batch will list all insert ids.
- in case of multi-query is set, resultSet will be per query.
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.
- Parameters:
protocol- current protocol- Returns:
- a ResultSet containing generated ids.
- Throws:
java.sql.SQLException- if autoGeneratedKeys was not set to Statement.RETURN_GENERATED_KEYS
-
close
public void close()
-
getMaxFieldSize
public int getMaxFieldSize()
-
setAutoIncrement
public void setAutoIncrement(int autoIncrement)
-
getResultSetConcurrency
public int getResultSetConcurrency()
-
getAutoGeneratedKeys
public int getAutoGeneratedKeys()
-
isRewritten
public boolean isRewritten()
-
setRewritten
public void setRewritten(boolean rewritten)
-
-