"rebuildTables"
JSON DB "rebuildTables"
action rebuilds specified tables
The "rebuildTables"
action rebuilds specified tables.
"rebuildTables"
executes the rebuild on each table in the order they are specified so if an error occurs, all tables previous to the table causing the error are rebuilt and tables following the table causing the error are not.This action is not transactional.
As many tables as possible in the list are rebuilt.
A failure to rebuild one or more tables does not stop others from being rebuilt.
If a table contains many records, the rebuild process may take a while.
Request examples
Minimal request
{ "api": "db", "authToken": "replaceWithValidAuthtoken", "action": "rebuildTables", "params": { "tableNames": [ "test1" ] } }
{ "requestId": "2", "authToken": "replaceWithValidAuthtoken", "api": "db", "action": "rebuildTables", "params": { "databaseName": "ctreeSQL", "ownerName": "admin", "tableNames": [ "test1" ] }, "responseOptions": { "binaryFormat": "hex", "dataFormat": "objects", "numberFormat": "string" }, "apiVersion": "1.0", "debug": "max" }
{ "authToken": "replaceWithValidAuthtoken", "result": { "dataFormat": "objects", "data": [ { "changeIdField": "changeId", "createRecByteIndex": false, "databaseName": "ctreeSQL", "fieldDelimiterValue": 0, "fields": [ { "autoValue": "incrementOnInsert", "defaultValue": null, "length": null, "name": "id", "nullable": false, "primaryKey": 1, "scale": null, "type": "bigint" }, { "autoValue": "changeId", "defaultValue": null, "length": null, "name": "changeId", "nullable": true, "primaryKey": 0, "scale": null, "type": "bigint" }, { "autoValue": "none", "defaultValue": null, "length": 50, "name": "name", "nullable": true, "primaryKey": 0, "scale": null, "type": "varchar" } ], "folder": ".\\ctreeSQL.dbs", "growthExtent": 0, "indexFileExtension": ".idx", "indexes": [ { "collectStats": false, "compression": "off", "conditionalExpression": null, "databaseName": "ctreeSQL", "deferIndexing": false, "fields": [ { "caseInsensitive": false, "name": "id", "reverseCompare": false, "sortDescending": false } ], "filename": "admin_test1.idx", "immutableKeys": false, "indexName": "id_pk", "indexNumber": 0, "ownerName": "admin", "tableName": "test1", "unique": true } ], "ownerName": "admin", "padValue": 0, "path": ".\\ctreeSQL.dbs\\admin_test1.dat", "primaryKeyFields": [ "id" ], "smallFile": false, "tableFileExtension": ".dat", "tableName": "test1", "totalRecordCount": 0, "transactionModel": "logTransactions", "uid": 1181 } ] }, "errorCode": 0, "errorMessage": "" }
{ "authToken": "replaceWithValidAuthtoken", "result": { "dataFormat": "objects", "data": [ { "changeIdField": "changeId", "createRecByteIndex": false, "databaseName": "ctreeSQL", "fieldDelimiterValue": 0, "fields": [ { "autoValue": "incrementOnInsert", "defaultValue": null, "length": null, "name": "id", "nullable": false, "primaryKey": 1, "scale": null, "type": "bigint" }, { "autoValue": "changeId", "defaultValue": null, "length": null, "name": "changeId", "nullable": true, "primaryKey": 0, "scale": null, "type": "bigint" }, { "autoValue": "none", "defaultValue": null, "length": 50, "name": "name", "nullable": true, "primaryKey": 0, "scale": null, "type": "varchar" } ], "folder": ".\\ctreeSQL.dbs", "growthExtent": 0, "indexFileExtension": ".idx", "indexes": [ { "collectStats": false, "compression": "off", "conditionalExpression": null, "databaseName": "ctreeSQL", "deferIndexing": false, "fields": [ { "caseInsensitive": false, "name": "id", "reverseCompare": false, "sortDescending": false } ], "filename": "admin_test1.idx", "immutableKeys": false, "indexName": "id_pk", "indexNumber": 0, "ownerName": "admin", "tableName": "test1", "unique": true } ], "ownerName": "admin", "padValue": 0, "path": ".\\ctreeSQL.dbs\\admin_test1.dat", "primaryKeyFields": [ "id" ], "smallFile": false, "tableFileExtension": ".dat", "tableName": "test1", "totalRecordCount": 0, "transactionModel": "logTransactions", "uid": 1181 } ] }, "requestId": "2", "debugInfo": { "request": { "authToken": "replaceWithValidAuthtoken", "api": "db", "action": "rebuildTables", "params": { "databaseName": "ctreeSQL", "ownerName": "admin", "tableNames": [ "test1" ] }, "apiVersion": "1.0", "requestId": "2", "responseOptions": { "binaryFormat": "hex", "dataFormat": "objects", "numberFormat": "string" }, "debug": "max" }, "serverSuppliedValues": { "databaseName": "ctreeSQL", "ownerName": "admin" }, "errorData": { "errorData": null }, "warnings": [] }, "errorCode": 0, "errorMessage": "" }
Use the rebuildTables JSON API action to create a new table in a FairCom database
The "params"
property is an object that contains an action's parameters. Each action defines its own required and optional properties.
Property summary
"params"
property summariesProperty | Description | Default | Type | Limits (inclusive) |
---|---|---|---|---|
specifies the name of a database | Defaults to the | string | 1 to 64 bytes | |
specifies the unique name of a schema in a database |
| string | 1 to 64 bytes | |
lists table names to return in the response message | Required - No default value | string | 1 to 64 bytes |
The "databaseName"
property is an optional string that specifies the database that contains the tables. It defaults to the database name supplied at login.
Note
In the API Explorer, "defaultDatabaseName"
is set to "ctreeSQL"
in the "createSession"
action that happens at login.
A zero-length
"databaseName"
is invalid.Its limits are from 0 to 64 bytes.
If the
"databaseName"
property is omitted or set tonull
, the server will use the default database name specified at login.If no default database is specified during
"createSession"
,"defaultDatabaseName"
will be set to the"defaultDatabaseName"
value that is specified in theservices.json
file.
The "ownerName"
property is an optional string from 1 to 64 bytes that specifies the account that owns an object.
The "tableNames"
property is a required array of strings. Each string is from 1 to 64 bytes.
Contains at least one string.
Each string is the name of a table.
A zero-length
"tableName"
is invalid.A client should force the uniqueness of items in the array because the server ignores duplicate items.
You cannot modify a table while it is in use. When a table has no activity for a default of 2 seconds, it will be closed so you can modify it.
When a table is in use, the following actions return an error, such as -8 or 4012:
"alterTable"
"rebuildTables"
"deleteTables"
"createIndex"
"deleteIndexes"
"rebuildIndexes"
"runSqlStatements"
A table is in use when any account is performing one or more of the following actions with the table:
"insertRecords"
"updateRecords"
"deleteRecords"
"truncateRecords"
"getRecords..."
Has open cursors on the table.
Has open transactions on the table (such "createTransaction").
Modify the
SQL_IDLE_WAKE
startup configuration setting to change the number of seconds the server waits before closing a table. A larger number keeps the table open longer for better performance. A smaller number allows you to modify the table sooner.Modify the
SQL_IDLE_WAKE
startup configuration setting to change the number of tables the server keeps open after they are no longer being actively used. A larger number caches more tables and improves performance. A smaller number allows you to modify tables sooner.