# Class BigQueryStatement (2.65.0)

2.65.0 (latest) 2.62.0 2.61.0 2.60.0 2.59.0 2.58.0 2.57.2 2.56.0 2.55.3 2.54.2 2.53.0 2.52.0 2.51.0 2.50.1 2.49.0 2.48.1 2.47.0 2.46.0 2.45.0 2.44.0 2.43.3 2.42.3 2.41.0 2.40.3 2.39.1 2.38.2 2.37.2 2.36.0 2.35.0 2.34.2 2.33.2

    public class BigQueryStatement extends BigQueryNoOpsStatement

An implementation of [java.sql.Statement](https://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html) for executing BigQuery SQL statement and
returning the results it produces.
See Also: [BigQueryConnection#createStatement](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.jdbc.BigQueryConnection#com_google_cloud_bigquery_jdbc_BigQueryConnection_createStatement_), [ResultSet](https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html)

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement \> BigQueryStatement

## Inherited Members

com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.\<T\>unwrap(java.lang.Class\<T\>) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.execute(java.lang.String,int) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.execute(java.lang.String,int\[\]) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.execute(java.lang.String,java.lang.String\[\]) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.executeUpdate(java.lang.String,int) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.executeUpdate(java.lang.String,int\[\]) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.executeUpdate(java.lang.String,java.lang.String\[\]) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.getGeneratedKeys() com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.isWrapperFor(java.lang.Class\<?\>) com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.setCursorName(java.lang.String) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Fields

### queryTaskExecutor

    protected static ExecutorService queryTaskExecutor

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html` |   |

## Constructors

### BigQueryStatement(BigQueryConnection connection)

    public BigQueryStatement(BigQueryConnection connection)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `connection` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.jdbc.BigQueryConnection` |

## Fields

### batchQueries

    protected List<String> batchQueries

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### cancelLock

    protected Object cancelLock

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |

### closeOnCompletion

    protected boolean closeOnCompletion

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### connection

    protected BigQueryConnection connection

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.jdbc.BigQueryConnection` |   |

### currentJobIdIndex

    protected int currentJobIdIndex

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### currentResultSet

    protected ResultSet currentResultSet

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html` |   |

### currentUpdateCount

    protected long currentUpdateCount

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isCanceled

    protected boolean isCanceled

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isClosed

    protected boolean isClosed

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### jobIds

    protected List<JobId> jobIds

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.JobId>` |   |

### maxFieldSize

    protected int maxFieldSize

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### maxRows

    protected int maxRows

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### parentJobId

    protected BigQueryStatement.JobIdWrapper parentJobId

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.bigquery.jdbc.BigQueryStatement.JobIdWrapper` |   |

### poolable

    protected boolean poolable

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### queryTimeout

    protected int queryTimeout

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### warning

    protected SQLWarning warning

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLWarning.html` |   |

## Methods

### \<T\>unwrap(Class\<T\> iface)

    public T <T>unwrap(Class<T> iface)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `iface` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<T>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` |   |

**Overrides** com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.\<T\>unwrap(java.lang.Class\<T\>)

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### addBatch(String sql)

    public void addBatch(String sql)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `sql` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### cancel()

    public void cancel()

Cancels this `Statement` object, the running threads, and BigQuery jobs.

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` | if a BigQuery access error occurs or this method is called on a closed `Statement` |

### clearBatch()

    public void clearBatch()

### clearWarnings()

    public void clearWarnings()

### close()

    public void close()

Releases this Statement's BigQuery and JDBC resources immediately instead of waiting for this
to happen when it is automatically closed. These resources include the `ResultSet`
object, batch queries, job IDs, and BigQuery connection   

Calling the method close on a Statement object that is already closed has no effect.

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` | if a BigQuery access error occurs |

### closeOnCompletion()

    public void closeOnCompletion()

### execute(String sql)

    public boolean execute(String sql)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `sql` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### executeBatch()

    public int[] executeBatch()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### executeLargeUpdate(String sql)

    public long executeLargeUpdate(String sql)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `sql` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### executeQuery(String sql)

    public ResultSet executeQuery(String sql)

This method executes a BigQuery SQL query, return a single `ResultSet` object.

Example of running a query:

Connection connection = DriverManager.getConnection(CONNECTION_URL);
Statement bigQueryStatement = bigQueryConnection.createStatement();
ResultSet result = bigQueryStatement.executeQuery(QUERY);

See Also: java.sql.Statement#executeQuery(String)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `sql` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` BigQuery SQL query |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html` | `ResultSet` containing the output of the query |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` | if a BigQuery access error occurs, this method is called on a closed `Statement`, the given SQL statement produces multiple or no result sets. |

### executeUpdate(String sql)

    public int executeUpdate(String sql)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `sql` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### getConnection()

    public Connection getConnection()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html` |   |

### getExtraLabels()

    public Map<String,String> getExtraLabels()

Gets the extra labels for this statement.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` | A map of the extra labels. |

### getFetchDirection()

    public int getFetchDirection()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getFetchSize()

    public int getFetchSize()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getLargeUpdateCount()

    public long getLargeUpdateCount()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getMaxFieldSize()

    public int getMaxFieldSize()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getMaxRows()

    public int getMaxRows()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getMoreResults()

    public boolean getMoreResults()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### getMoreResults(int current)

    public boolean getMoreResults(int current)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `current` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### getQueryTimeout()

    public int getQueryTimeout()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getResultSet()

    public ResultSet getResultSet()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html` |   |

### getResultSetConcurrency()

    public int getResultSetConcurrency()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getResultSetHoldability()

    public int getResultSetHoldability()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getResultSetType()

    public int getResultSetType()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getUpdateCount()

    public int getUpdateCount()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getWarnings()

    public SQLWarning getWarnings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLWarning.html` |   |

### hasMoreResults()

    public boolean hasMoreResults()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isCloseOnCompletion()

    public boolean isCloseOnCompletion()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isClosed()

    public boolean isClosed()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isPoolable()

    public boolean isPoolable()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isWrapperFor(Class\<?\> iface)

    public boolean isWrapperFor(Class<?> iface)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `iface` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<?>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** com.google.cloud.bigquery.jdbc.BigQueryNoOpsStatement.isWrapperFor(java.lang.Class\<?\>)

### logQueryExecutionStart(String sql)

    protected void logQueryExecutionStart(String sql)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `sql` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

### setEscapeProcessing(boolean enable)

    public void setEscapeProcessing(boolean enable)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `enable` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### setExtraLabels(Map\<String,String\> extraLabels)

    public void setExtraLabels(Map<String,String> extraLabels)

Sets the extra labels for this statement.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `extraLabels` | `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` A map of the extra labels. |

### setFetchDirection(int direction)

    public void setFetchDirection(int direction)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `direction` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html` |   |

### setFetchSize(int rows)

    public void setFetchSize(int rows)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `rows` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### setMaxFieldSize(int max)

    public void setMaxFieldSize(int max)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `max` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### setMaxRows(int max)

    public void setMaxRows(int max)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `max` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### setPoolable(boolean poolable)

    public void setPoolable(boolean poolable)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `poolable` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### setQueryTimeout(int seconds)

    public void setQueryTimeout(int seconds)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `seconds` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |