public class SFStatement extends Object
| Constructor and Description |
|---|
SFStatement(SFSession session) |
SFStatement(SFSession session,
String sql) |
| Modifier and Type | Method and Description |
|---|---|
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() |
protected void |
cancelHelper(String sql,
String mediaType)
A helper method to build URL and cancel the SQL for exec
|
void |
close() |
SFStatementMetaData |
describe()
Describe the statement
|
SFStatementMetaData |
describe(String sql)
Describe a statement
|
SFBaseResultSet |
execute(String sql)
Execute sql
|
protected SFBaseResultSet |
executeFileTransfer(String sql) |
Object |
executeHelper(String sql,
String mediaType,
Map<String,Map<String,Object>> bindValues,
boolean describeOnly)
A helper method to build URL and submit the SQL to snowflake for exec
|
protected SFBaseResultSet |
executeQuery(String sql)
Execute SQL query
|
protected SFBaseResultSet |
executeQuery(String sql,
boolean describeOnly)
Execute SQL query with an option for describe only
|
protected SFBaseResultSet |
executeQueryInternal(String sql,
Map<String,Map<String,Object>> parameterBindings,
boolean describeOnly)
Internal method for executing a query with bindings accepted.
|
void |
executeSetProperty(String sql) |
protected SFSession |
getSession() |
protected boolean |
isFileTransfer(String sql)
A method to check if a sql is file upload statement with consideration for
potential comments in front of put keyword.
|
protected void |
releaseConnection() |
void |
setValue(String parameterName,
String value,
String sqlType)
Bind value with the given type for the parameter with the
given index.
|
void |
setValues(String parameterName,
List<String> values,
String sqlType)
Bind the list of values with the given type for the parameter with the
given index.
|
public SFStatement(SFSession session)
public void addProperty(String propertyName, Object propertyValue) throws SFException
propertyName - property namepropertyValue - property valueSFException - if too many parameters for a statementprotected SFBaseResultSet executeQuery(String sql) throws SQLException, SFException
sql - sql statementSQLException - if failed to execute the querySFException - if failed to execute the queryprotected SFBaseResultSet executeQuery(String sql, boolean describeOnly) throws SQLException, SFException
sql - sql statementdescribeOnly - true if describe onlySQLException - if connection is already closedSFException - if result set is nullpublic SFStatementMetaData describe(String sql) throws SFException, SQLException
sql - statementSQLException - if connection is already closedSFException - if result set is nullpublic SFStatementMetaData describe() throws SFException, SQLException
SQLException - if connection is already closedSFException - if result set is nullprotected SFBaseResultSet executeQueryInternal(String sql, Map<String,Map<String,Object>> parameterBindings, boolean describeOnly) throws SQLException, SFException
sql - sql statementparameterBindings - binding informationdescribeOnly - true if just showing result set metadataSQLException - if connection is already closedSFException - if result set is nullpublic Object executeHelper(String sql, String mediaType, Map<String,Map<String,Object>> bindValues, boolean describeOnly) throws SnowflakeSQLException, SFException
sql - sql statementmediaType - media typebindValues - map of binding valuesdescribeOnly - whether only show the result set metadataSFException - if query is canceledSnowflakeSQLException - if query is already runningprotected void cancelHelper(String sql, String mediaType) throws SnowflakeSQLException, SFException
sql - sql statementmediaType - media typeSnowflakeSQLException - if failed to cancel the statementSFException - if statement is already closedprotected void releaseConnection()
protected boolean isFileTransfer(String sql)
sql - sql statementpublic SFBaseResultSet execute(String sql) throws SQLException, SFException
sql - sql statementSQLException - if failed to execute sqlSFException - exception raised from Snowflake componentsprotected SFBaseResultSet executeFileTransfer(String sql) throws SQLException, SFException
SQLExceptionSFExceptionpublic void close()
throws SQLException
SQLExceptionpublic void cancel()
throws SFException,
SQLException
SFExceptionSQLExceptionpublic void executeSetProperty(String sql)
public void setValues(String parameterName, List<String> values, String sqlType)
parameterName - parameter name in the query stringvalues - list of values bound to the parametersqlType - Snowflake SQL type name as defined in SnowflakeType.javapublic void setValue(String parameterName, String value, String sqlType)
parameterName - parameter name in the query stringvalue - value bound to the parametersqlType: - Snowflake SQL type name as defined in SnowflakeType.javaprotected SFSession getSession()
Copyright © 2017. All rights reserved.