Package org.apache.calcite.avatica

# Class QueryState

java.lang.Object
org.apache.calcite.avatica.QueryState

public class QueryState extends Object
A struct used to encapsulate the necessary information to reconstitute a ResultSet in the Avatica server.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`QueryState.StateType`
An enumeration that represents how a ResultSet was created.

## Field Summary

Fields
Modifier and Type
Field
Description
`final MetaDataOperation`
`metaDataOperation`
`final Object[]`
`operationArgs`
`final String`
`sql`
`final QueryState.StateType`
`type`

## Constructor Summary

Constructors
Constructor
Description
`QueryState()`
Not intended for external use.
`QueryState(String sql)`
Constructor encapsulating a SQL query used to create a result set.
`QueryState(QueryState.StateType type, String sql, MetaDataOperation op, Object... args)`
Not intended for external use.
`QueryState(MetaDataOperation op, Object... args)`
Constructor encapsulating a metadata operation's result set.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object o)`
`static QueryState`
`fromProto(org.apache.calcite.avatica.proto.Common.QueryState protoState)`
`MetaDataOperation`
`getMetaDataOperation()`
`Object[]`
`getOperationArgs()`
`String`
`getSql()`
`QueryState.StateType`
`getType()`
`int`
`hashCode()`
`ResultSet`
`invoke(Connection conn, Statement statement)`
`org.apache.calcite.avatica.proto.Common.QueryState`
`toProto()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### type

public final QueryState.StateType type

### sql

public final String sql

### metaDataOperation

public final MetaDataOperation metaDataOperation

### operationArgs

public final Object[] operationArgs

## Constructor Details

### QueryState

public QueryState(String sql)
Constructor encapsulating a SQL query used to create a result set.

Parameters:
  `sql` - The SQL query.

### QueryState

public QueryState(MetaDataOperation op, Object... args)
Constructor encapsulating a metadata operation's result set.

Parameters:
  `op` - A pointer to the `DatabaseMetaData` operation being invoked.
  `args` - The arguments to the method being invoked.

### QueryState

public QueryState(QueryState.StateType type, String sql, MetaDataOperation op, Object... args)
Not intended for external use. For Jackson-databind only.

### QueryState

public QueryState()
Not intended for external use. For Jackson-databind only.

## Method Details

### getType

public QueryState.StateType getType()

Returns:
  The `QueryState.StateType` for this encapsulated state.

### getSql

public String getSql()

Returns:
  The SQL expression to invoke.

### getMetaDataOperation

public MetaDataOperation getMetaDataOperation()

Returns:
  The metadata operation to invoke.

### getOperationArgs

public Object[] getOperationArgs()

Returns:
  The Arguments for the given metadata operation.

### invoke

public ResultSet invoke(Connection conn, Statement statement) throws SQLException

Throws:
  `SQLException`

### toProto

public org.apache.calcite.avatica.proto.Common.QueryState toProto()

### fromProto

public static QueryState fromProto(org.apache.calcite.avatica.proto.Common.QueryState protoState)

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`