net.snowflake.client.core

## Class SFStatement

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

    public class SFStatement
    extends Object

Snowflake statement

Author:
  jhuang

### Constructor Summary

Constructors
Constructor and Description
`SFStatement(SFSession session)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addProperty(String propertyName, Object propertyValue)` Add a statement parameter Make sure a property is not added more than once and the number of properties does not exceed limit.
`void` `cancel()`
`void` `close()`
`SFStatementMetaData` `describe(String sql)` Describe a statement
`SFBaseResultSet` `execute(String sql, Map<String,ParameterBindingDTO> parametersBinding)` Execute sql
`Object` `executeHelper(String sql, String mediaType, Map<String,ParameterBindingDTO> bindValues, boolean describeOnly)` A helper method to build URL and submit the SQL to snowflake for exec
`void` `executeSetProperty(String sql)`
`protected SFSession` `getSession()`
`void` `setHasUnsupportedStageBind(boolean hasUnsupportedStageBind)`

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

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

### Constructor Detail

#### SFStatement

    public SFStatement(SFSession session)

### Method Detail

#### addProperty

    public void addProperty(String propertyName,
                            Object propertyValue)
                     throws SFException

Add a statement parameter Make sure a property is not added more than once and the number of properties does not exceed limit.

Parameters:
  `propertyName` - property name
  `propertyValue` - property value
Throws:
  `SFException` - if too many parameters for a statement

#### describe

    public SFStatementMetaData describe(String sql)
                                 throws SFException,
                                        SQLException

Describe a statement

Parameters:
  `sql` - statement
Returns:
  metadata of statement including result set metadata and binding information
Throws:
  `SQLException` - if connection is already closed
  `SFException` - if result set is null

#### executeHelper

    public Object executeHelper(String sql,
                                String mediaType,
                                Map<String,ParameterBindingDTO> bindValues,
                                boolean describeOnly)
                         throws SnowflakeSQLException,
                                SFException

A helper method to build URL and submit the SQL to snowflake for exec

Parameters:
  `sql` - sql statement
  `mediaType` - media type
  `bindValues` - map of binding values
  `describeOnly` - whether only show the result set metadata
Returns:
  raw json response
Throws:
  `SFException` - if query is canceled
  `SnowflakeSQLException` - if query is already running

#### execute

    public SFBaseResultSet execute(String sql,
                                   Map<String,ParameterBindingDTO> parametersBinding)
                            throws SQLException,
                                   SFException

Execute sql

Parameters:
  `sql` - sql statement.
  `parametersBinding` - parameters to bind
Returns:
  whether there is result set or not
Throws:
  `SQLException` - if failed to execute sql
  `SFException` - exception raised from Snowflake components
  `SQLException` - if SQL error occurs

#### close

    public void close()
               throws SQLException

Throws:
  `SQLException`

#### cancel

    public void cancel()
                throws SFException,
                       SQLException

Throws:
  `SFException`
  `SQLException`

#### executeSetProperty

    public void executeSetProperty(String sql)

#### getSession

    protected SFSession getSession()

#### setHasUnsupportedStageBind

    public void setHasUnsupportedStageBind(boolean hasUnsupportedStageBind)