Package oracle.nosql.driver.ops

## Class TableRequest

- java.lang.Object
- - oracle.nosql.driver.ops.Request
  - - oracle.nosql.driver.ops.TableRequest

-     public class TableRequest
      extends Request

  TableRequest is used to create, modify, and drop tables. The operations allowed are those supported by the Data Definition Language (DDL) portion of the query language. The language provides for table creation and removal (drop), index add and drop, as well as schema evolution via alter table. Operations using DDL statements infer the table name from the query statement itself, e.g. "create table mytable(...)". Table creation requires a valid `TableLimits` object to define the throughput desired for the table. If TableLimits is provided with any other type of query statement an exception is thrown.

  This request is also used to modify the limits of throughput and storage for an existing table. This case is handled by specifying a table name and limits without a query statement. If all three are specified it is an error.

  Execution of operations specified by this request is implicitly asynchronous. These are potentially long-running operations. `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)` returns a `TableResult` instance that can be used to poll until the table reaches the desired state.

  See Also:
    `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TableRequest()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `getStatement()` | Returns the statement, or null if not set
    `TableLimits` | `getTableLimits()` | Returns the table limits, or null if not set
    `TableRequest` | `setCompartment​(String compartment)` | Cloud service only.
    `TableRequest` | `setDefaults​(NoSQLHandleConfig config)` |
    `TableRequest` | `setStatement​(String statement)` | Sets the query statement to use for the operation.
    `TableRequest` | `setTableLimits​(TableLimits tableLimits)` | Cloud service only.
    `TableRequest` | `setTableName​(String tableName)` | Sets the table name to use for the operation.
    `TableRequest` | `setTimeout​(int timeoutMs)` | Sets the request timeout value, in milliseconds.
    `String` | `toString()` |
    `void` | `validate()` |

    - ### Methods inherited from class oracle.nosql.driver.ops.Request

      `getCompartment, getReadRateLimiter, getRetryStats, getTableName, getWriteRateLimiter, setReadRateLimiter, setWriteRateLimiter`

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TableRequest

          public TableRequest()

  - ### Method Detail

    - #### setCompartment

          public TableRequest setCompartment​(String compartment)

      Cloud service only.

      Sets the name or id of a compartment to be used for this operation.

      The compartment may be specified as either a name (or path for nested compartments) or as an id (OCID). A name (vs id) can only be used when authenticated using a specific user identity. It is not available if authenticated as an Instance Principal which can be done when calling the service from a compute instance in the Oracle Cloud Infrastructure. See `SignatureProvider.createWithInstancePrincipal()`

      Parameters:
        `compartment` - the name or id. If using a nested compartment, specify the full compartment path `compartmentA.compartmentB`, but exclude the name of the root compartment (tenant).
      Returns:
        this

    - #### getStatement

          public String getStatement()

      Returns the statement, or null if not set
      Returns:
        the statement

    - #### getTableLimits

          public TableLimits getTableLimits()

      Returns the table limits, or null if not set
      Returns:
        the limits

    - #### setStatement

          public TableRequest setStatement​(String statement)

      Sets the query statement to use for the operation. This parameter is required unless the operation is intended to change the limits of an existing table.
      Parameters:
        `statement` - the statement
      Returns:
        this

    - #### setTableName

          public TableRequest setTableName​(String tableName)

      Sets the table name to use for the operation. The table name is only used to modify the limits of an existing table, and must not be set for any other operation.
      Parameters:
        `tableName` - the name
      Returns:
        this

    - #### setTableLimits

          public TableRequest setTableLimits​(TableLimits tableLimits)

      Cloud service only.

      Sets the table limits to use for the operation. Limits are used in only 2 cases -- table creation statements and limits modification operations. It is not used for other DDL operations.

      If limits are set for an on-premise service they are silently ignored.

      Parameters:
        `tableLimits` - the limits
      Returns:
        this

    - #### setTimeout

          public TableRequest setTimeout​(int timeoutMs)

      Sets the request timeout value, in milliseconds. This overrides any default value set in `NoSQLHandleConfig`. The value must be positive.
      Parameters:
        `timeoutMs` - the timeout value, in milliseconds
      Returns:
        this
      Throws:
        `IllegalArgumentException` - if the timeout value is less than or equal to 0

    - #### setDefaults

          public TableRequest setDefaults​(NoSQLHandleConfig config)

    - #### validate

          public void validate()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`