Package org.h2.command
Class CommandRemote
- java.lang.Object
-
- org.h2.command.CommandRemote
-
- All Implemented Interfaces:
java.lang.AutoCloseable,CommandInterface
public class CommandRemote extends java.lang.Object implements CommandInterface
Represents the client-side part of a SQL statement. This class is not used in embedded mode.
-
-
Field Summary
Fields Modifier and Type Field Description private intcmdTypeprivate intcreatedprivate intfetchSizeprivate intidprivate booleanisQueryprivate java.util.ArrayList<ParameterInterface>parametersprivate booleanreadonlyprivate SessionRemotesessionprivate java.lang.Stringsqlprivate Tracetraceprivate java.util.ArrayList<Transfer>transferList-
Fields inherited from interface org.h2.command.CommandInterface
ALTER_DOMAIN_ADD_CONSTRAINT, ALTER_DOMAIN_DEFAULT, ALTER_DOMAIN_DROP_CONSTRAINT, ALTER_DOMAIN_ON_UPDATE, ALTER_DOMAIN_RENAME, ALTER_DOMAIN_RENAME_CONSTRAINT, ALTER_INDEX_RENAME, ALTER_SCHEMA_RENAME, ALTER_SEQUENCE, ALTER_TABLE_ADD_COLUMN, ALTER_TABLE_ADD_CONSTRAINT_CHECK, ALTER_TABLE_ADD_CONSTRAINT_PRIMARY_KEY, ALTER_TABLE_ADD_CONSTRAINT_REFERENTIAL, ALTER_TABLE_ADD_CONSTRAINT_UNIQUE, ALTER_TABLE_ALTER_COLUMN_CHANGE_TYPE, ALTER_TABLE_ALTER_COLUMN_DEFAULT, ALTER_TABLE_ALTER_COLUMN_DEFAULT_ON_NULL, ALTER_TABLE_ALTER_COLUMN_DROP_EXPRESSION, ALTER_TABLE_ALTER_COLUMN_DROP_IDENTITY, ALTER_TABLE_ALTER_COLUMN_DROP_NOT_NULL, ALTER_TABLE_ALTER_COLUMN_NOT_NULL, ALTER_TABLE_ALTER_COLUMN_ON_UPDATE, ALTER_TABLE_ALTER_COLUMN_RENAME, ALTER_TABLE_ALTER_COLUMN_SELECTIVITY, ALTER_TABLE_ALTER_COLUMN_VISIBILITY, ALTER_TABLE_DROP_COLUMN, ALTER_TABLE_DROP_CONSTRAINT, ALTER_TABLE_RENAME, ALTER_TABLE_RENAME_CONSTRAINT, ALTER_TABLE_SET_REFERENTIAL_INTEGRITY, ALTER_USER_ADMIN, ALTER_USER_RENAME, ALTER_USER_SET_PASSWORD, ALTER_VIEW, ANALYZE, BACKUP, BEGIN, CALL, CHECKPOINT, CHECKPOINT_SYNC, COMMENT, COMMIT, COMMIT_TRANSACTION, CREATE_AGGREGATE, CREATE_ALIAS, CREATE_CONSTANT, CREATE_DOMAIN, CREATE_INDEX, CREATE_LINKED_TABLE, CREATE_ROLE, CREATE_SCHEMA, CREATE_SEQUENCE, CREATE_SYNONYM, CREATE_TABLE, CREATE_TRIGGER, CREATE_USER, CREATE_VIEW, DEALLOCATE, DELETE, DROP_AGGREGATE, DROP_ALIAS, DROP_ALL_OBJECTS, DROP_CONSTANT, DROP_DOMAIN, DROP_INDEX, DROP_ROLE, DROP_SCHEMA, DROP_SEQUENCE, DROP_SYNONYM, DROP_TABLE, DROP_TRIGGER, DROP_USER, DROP_VIEW, EXECUTE, EXECUTE_IMMEDIATELY, EXPLAIN, EXPLAIN_ANALYZE, GRANT, HELP, INSERT, MERGE, NO_OPERATION, PREPARE, PREPARE_COMMIT, REPLACE, REVOKE, ROLLBACK, ROLLBACK_TO_SAVEPOINT, ROLLBACK_TRANSACTION, RUNSCRIPT, SAVEPOINT, SCRIPT, SELECT, SET, SET_AUTOCOMMIT_FALSE, SET_AUTOCOMMIT_TRUE, SHUTDOWN, SHUTDOWN_COMPACT, SHUTDOWN_DEFRAG, SHUTDOWN_IMMEDIATELY, TRUNCATE_TABLE, UNKNOWN, UPDATE
-
-
Constructor Summary
Constructors Constructor Description CommandRemote(SessionRemote session, java.util.ArrayList<Transfer> transferList, java.lang.String sql, int fetchSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancel this current statement.private voidcheckParameters()voidclose()Close the statement.ResultInterfaceexecuteQuery(long maxRows, boolean scrollable)Execute the query.ResultWithGeneratedKeysexecuteUpdate(java.lang.Object generatedKeysRequest)Execute the statementintgetCommandType()Get command type.ResultInterfacegetMetaData()Get an empty result set containing the meta data of the result.java.util.ArrayList<ParameterInterface>getParameters()Get the parameters (if any).booleanisQuery()Check if this is a query.private voidprepare(SessionRemote s, boolean createParams)private voidprepareIfRequired()private voidsendParameters(Transfer transfer)voidstop()Stop the command execution, release all locks and resourcesjava.lang.StringtoString()
-
-
-
Field Detail
-
transferList
private final java.util.ArrayList<Transfer> transferList
-
parameters
private final java.util.ArrayList<ParameterInterface> parameters
-
trace
private final Trace trace
-
sql
private final java.lang.String sql
-
fetchSize
private final int fetchSize
-
session
private SessionRemote session
-
id
private int id
-
isQuery
private boolean isQuery
-
cmdType
private int cmdType
-
readonly
private boolean readonly
-
created
private final int created
-
-
Constructor Detail
-
CommandRemote
public CommandRemote(SessionRemote session, java.util.ArrayList<Transfer> transferList, java.lang.String sql, int fetchSize)
-
-
Method Detail
-
stop
public void stop()
Description copied from interface:CommandInterfaceStop the command execution, release all locks and resources- Specified by:
stopin interfaceCommandInterface
-
prepare
private void prepare(SessionRemote s, boolean createParams)
-
isQuery
public boolean isQuery()
Description copied from interface:CommandInterfaceCheck if this is a query.- Specified by:
isQueryin interfaceCommandInterface- Returns:
- true if it is a query
-
getParameters
public java.util.ArrayList<ParameterInterface> getParameters()
Description copied from interface:CommandInterfaceGet the parameters (if any).- Specified by:
getParametersin interfaceCommandInterface- Returns:
- the parameters
-
prepareIfRequired
private void prepareIfRequired()
-
getMetaData
public ResultInterface getMetaData()
Description copied from interface:CommandInterfaceGet an empty result set containing the meta data of the result.- Specified by:
getMetaDatain interfaceCommandInterface- Returns:
- the empty result
-
executeQuery
public ResultInterface executeQuery(long maxRows, boolean scrollable)
Description copied from interface:CommandInterfaceExecute the query.- Specified by:
executeQueryin interfaceCommandInterface- Parameters:
maxRows- the maximum number of rows returnedscrollable- if the result set must be scrollable- Returns:
- the result
-
executeUpdate
public ResultWithGeneratedKeys executeUpdate(java.lang.Object generatedKeysRequest)
Description copied from interface:CommandInterfaceExecute the statement- Specified by:
executeUpdatein interfaceCommandInterface- Parameters:
generatedKeysRequest-nullorfalseif generated keys are not needed,trueif generated keys should be configured automatically,int[]to specify column indices to return generated keys from, orString[]to specify column names to return generated keys from- Returns:
- the update count and generated keys, if any
-
checkParameters
private void checkParameters()
-
sendParameters
private void sendParameters(Transfer transfer) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close()
Description copied from interface:CommandInterfaceClose the statement.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceCommandInterface
-
cancel
public void cancel()
Cancel this current statement.- Specified by:
cancelin interfaceCommandInterface
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getCommandType
public int getCommandType()
Description copied from interface:CommandInterfaceGet command type.- Specified by:
getCommandTypein interfaceCommandInterface- Returns:
- one of the constants above
-
-