net.snowflake.client.core

## Class StmtUtil

- java.lang.Object
- - net.snowflake.client.core.StmtUtil

    public class StmtUtil
    extends Object

Created by jhuang on 1/28/16.

### Nested Class Summary

Nested Classes
`static class` `StmtUtil.StmtInput` Input for executing a statement on server
`static class` `StmtUtil.StmtOutput` Output for running a statement on server

### Field Summary

Fields
`static String` `SF_HEADER_AUTHORIZATION`
`static String` `SF_HEADER_SNOWFLAKE_AUTHTYPE`
`static String` `SF_HEADER_TOKEN_TAG`
`static String` `SF_PATH_ABORT_REQUEST_V1`
`static String` `SF_PATH_QUERY_V1`
`static String` `SF_QUERY_REQUEST_ID`

### Constructor Summary

Constructors
Constructor and Description
`StmtUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `cancel(StmtUtil.StmtInput stmtInput)` Cancel a statement identifiable by a request id
`static StmtUtil.StmtOutput` `execute(StmtUtil.StmtInput stmtInput)` Execute a statement side effect: stmtInput.prevGetResultURL is set if we have started ping pong and receives an exception from session token expiration so that during retry we don't retry the query submission, but continue the ping pong process.
`protected static String` `getQueryResult(com.fasterxml.jackson.databind.JsonNode inProgressResponse, String mediaType, String previousGetResultPath, StmtUtil.StmtInput stmtInput)` Issue get-result call to get query result given an in progress response.

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

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

### Field Detail

#### SF_PATH_QUERY_V1

    public static final String SF_PATH_QUERY_V1

See Also:
  Constant Field Values

#### SF_PATH_ABORT_REQUEST_V1

    public static final String SF_PATH_ABORT_REQUEST_V1

See Also:
  Constant Field Values

#### SF_QUERY_REQUEST_ID

    public static final String SF_QUERY_REQUEST_ID

See Also:
  Constant Field Values

#### SF_HEADER_AUTHORIZATION

    public static final String SF_HEADER_AUTHORIZATION

See Also:
  Constant Field Values

#### SF_HEADER_SNOWFLAKE_AUTHTYPE

    public static final String SF_HEADER_SNOWFLAKE_AUTHTYPE

See Also:
  Constant Field Values

#### SF_HEADER_TOKEN_TAG

    public static final String SF_HEADER_TOKEN_TAG

See Also:
  Constant Field Values

### Constructor Detail

#### StmtUtil

    public StmtUtil()

### Method Detail

#### execute

    public static StmtUtil.StmtOutput execute(StmtUtil.StmtInput stmtInput)
                                       throws SFException,
                                              SnowflakeSQLException

Execute a statement side effect: stmtInput.prevGetResultURL is set if we have started ping pong and receives an exception from session token expiration so that during retry we don't retry the query submission, but continue the ping pong process.

Parameters:
  `stmtInput` - input statement
Returns:
  StmtOutput output statement
Throws:
  `SFException` - exception raised from Snowflake components
  `SnowflakeSQLException` - exception raised from Snowflake components

#### getQueryResult

    protected static String getQueryResult(com.fasterxml.jackson.databind.JsonNode inProgressResponse,
                                           String mediaType,
                                           String previousGetResultPath,
                                           StmtUtil.StmtInput stmtInput)
                                    throws SFException,
                                           SnowflakeSQLException

Issue get-result call to get query result given an in progress response.

Parameters:
  `inProgressResponse` - In pregress response in JSON form
  `mediaType` - media type name
  `previousGetResultPath` - previous get results path
  `stmtInput` - input statement
Returns:
  results in string form
Throws:
  `SFException` - exception raised from Snowflake components
  `SnowflakeSQLException` - exception raised from Snowflake components

#### cancel

    public static void cancel(StmtUtil.StmtInput stmtInput)
                       throws SFException,
                              SnowflakeSQLException

Cancel a statement identifiable by a request id

Parameters:
  `stmtInput` - input statement
Throws:
  `SFException` - if there is an internal exception
  `SnowflakeSQLException` - if failed to cancel the statement