public abstract class SFBaseStatement extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SFBaseStatement.CallingMethod
The type of query that is being executed.
|
| Modifier and Type | Field and Description |
|---|---|
protected static int |
MAX_STATEMENT_PARAMETERS |
protected int |
queryTimeout |
protected Map<String,Object> |
statementParametersMap |
| Constructor and Description |
|---|
SFBaseStatement() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProperty(String propertyName,
Object propertyValue)
Add a statement parameter
|
abstract SFBaseResultSet |
asyncExecute(String sql,
Map<String,ParameterBindingDTO> parametersBinding,
SFBaseStatement.CallingMethod caller)
Execute sql asynchronously.
|
abstract void |
cancel()
Aborts the statement.
|
abstract void |
close()
Closes the statement.
|
abstract SFStatementMetaData |
describe(String sql)
Describe a statement.
|
abstract SFBaseResultSet |
execute(String sql,
Map<String,ParameterBindingDTO> parametersBinding,
SFBaseStatement.CallingMethod caller)
Executes the given SQL string.
|
void |
executeSetProperty(String sql)
Sets a property within session properties, i.e., if the sql is using set-sf-property
|
abstract String[] |
getChildQueryIds(String queryID) |
abstract long |
getConservativeMemoryLimit() |
abstract int |
getConservativePrefetchThreads() |
abstract boolean |
getMoreResults(int current)
Sets the result set to the next one, if available.
|
abstract SFBaseResultSet |
getResultSet()
Retrieves the current result as a ResultSet, if any.
|
abstract SFBaseSession |
getSFBaseSession()
Returns the SFBaseSession associated with this SFBaseStatement.
|
abstract boolean |
hasChildren()
If this is a multi-statement, i.e., has child results.
|
static 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 static final int MAX_STATEMENT_PARAMETERS
protected int queryTimeout
public void addProperty(String propertyName, Object propertyValue) throws SFException
Make sure a property is not added more than once and the number of properties does not exceed limit.
propertyName - property namepropertyValue - property valueSFException - if too many parameters for a statementpublic abstract SFStatementMetaData describe(String sql) throws SFException, SQLException
sql - The SQL string of the query/statement.SQLException - if connection is already closedSFException - if result set is nullpublic abstract SFBaseResultSet execute(String sql, Map<String,ParameterBindingDTO> parametersBinding, SFBaseStatement.CallingMethod caller) throws SQLException, SFException
sql - The SQL string to execute, synchronously.parametersBinding - parameters to bindcaller - the JDBC interface method that called this method, if anySQLException - if failed to execute sqlSFException - exception raised from Snowflake componentsSQLException - if SQL error occurspublic abstract SFBaseResultSet asyncExecute(String sql, Map<String,ParameterBindingDTO> parametersBinding, SFBaseStatement.CallingMethod caller) throws SQLException, SFException
sql - sql statement.parametersBinding - parameters to bindcaller - the JDBC interface method that called this method, if anySQLException - if failed to execute sqlSFException - exception raised from Snowflake componentsSQLException - if SQL error occurspublic abstract void close()
public abstract void cancel()
throws SFException,
SQLException
SFException - if the statement is already closed.SQLException - if there are server-side errors from trying to abort.public void executeSetProperty(String sql)
sql - the set property sqlpublic static boolean isFileTransfer(String sql)
sql - sql statementpublic abstract boolean hasChildren()
public abstract SFBaseSession getSFBaseSession()
public abstract SFBaseResultSet getResultSet()
public abstract boolean getMoreResults(int current)
throws SQLException
current - What to do with the current result. One of Statement.CLOSE_CURRENT_RESULT,
Statement.CLOSE_ALL_RESULTS, or Statement.KEEP_CURRENT_RESULTSQLException - if something fails while getting the next resultpublic abstract long getConservativeMemoryLimit()
public abstract int getConservativePrefetchThreads()
public abstract String[] getChildQueryIds(String queryID) throws SQLException
SQLExceptionCopyright © 2022. All rights reserved.