You can execute the describe statement to query information about tables, such as the field names and field types.
Note For more information about the describe statement, see Query the information about a table.
Prerequisites
- An OTSClient instance is initialized. For more information, see Initialization.
- A mapping table is created. For more information, see Create mapping tables.
Parameters
Parameter | Description |
---|---|
query | The SQL statement. Configure the parameter based on the required feature. |
Examples
The following code provides an example on how to execute the DESCRIBE `tableName`;
statement to query information about the table named tableName:
$request = array(
'query' => 'DESCRIBE `tableName`;',
);
$response = $this->otsClient->sqlQuery ($request);
$sqlRows = $response['sql_rows'];
print json_encode($sqlRows, JSON_PRETTY_PRINT);