deleteIndexes

JSON DB "deleteIndexes" action deletes indexes

The "deleteIndexes" action deletes one or more indexes in a single transaction. All specified indexes are deleted or none are.

 

Request examples

For a list and detailed description of the common properties in an action request message, see JSON Action request.

 

Minimal

{
  "api":"db",
  "action": "deleteIndexes",
  "params": {
    "tableName": "test1",
    "indexNames": [
      "name"
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

 

Maximal

{
  "requestId": "2",
  "api": "db",
  "action": "deleteIndexes",
  "params": {
    "databaseName": "ctreeSQL",
    "ownerName": "admin",
    "tableName": "test1",
    "indexNames": [
      "name"
    ]
  },
  "responseOptions": {
    "binaryFormat": "hex",
    "dataFormat": "objects",
    "numberFormat": "string"
  },
  "apiVersion": "1.0",
  "debug": "max",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

 

Response examples

For a list and detailed description of the common properties in an action response message, see JSON Action response.

Note If the target object does not exist, the response returns success, and the debug property contains a warning that the object was not found.

 

Minimal

{
  "result": {
    "data": [
      {
        "collectStats": true,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "name",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_test1.idx",
        "immutableKeys": false,
        "indexName": "name",
        "indexNumber": 1,
        "ownerName": "admin",
        "tableName": "test1",
        "unique": false
      }
    ]
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

 

Maximal

{
  "result": {
    "data": [
      {
        "collectStats": true,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "name",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_test1.idx",
        "immutableKeys": false,
        "indexName": "name",
        "indexNumber": 1,
        "ownerName": "admin",
        "tableName": "test1",
        "unique": false
      }
    ]
  },
  "requestId": "2",
  "debugInfo": {
    "request": {
      "api": "db",
      "action": "deleteIndexes",
      "params": {
        "databaseName": "ctreeSQL",
        "ownerName": "admin",
        "tableName": "test1",
        "indexNames": [
          "name"
        ]
      },
      "apiVersion": "1.0",
      "requestId": "2",
      "responseOptions": {
        "binaryFormat": "hex",
        "dataFormat": "objects",
        "numberFormat": "string"
      },
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    },
    "serverSuppliedValues": {
      "databaseName": "ctreeSQL",
      "ownerName": "admin"
    },
    "errorData": {
      "errorData": null
    },
    "warnings": []
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

 

"params"

The "params" property is an object that contains an action's request parameters as defined by a set of properties. Each action defines its own required and optional properties. See System limits for a comprehensive overview of property requirements and limitations.

deleteIndexes "params" property summaries
Property Description Default Type Limits (inclusive)
databaseName

(optional) specifies the name of a database.

Defaults to the "defaultDatabaseName" value that is set during "createSession". If no default is set during "createSession", then "faircom" is used.

string

1 to 64 bytes
indexNames

defines the name of an index

Required - No default value

array  

ownerName

(optional) specifies the unique name of a schema in a database.

"" string 1 to 64 bytes
tableName specifies the name of a table

Required - No default value

string 1 to 64 bytes

 

"databaseName"

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 length limit is from 0 to 64 bytes.
  • If the "databaseName" property is omitted or set to null, the server will use the default database name specified at login.
  • If no default database is specified during "createSession", "databaseName" will be set to the "defaultDatabaseName" value that is specified in the services.json file.
"params": {
  "databaseName": "mainDatabase"
  }

 

"ownerName"

The "ownerName" property is an optional string from 1 to 64 bytes that identifies the user who owns an object (see Object owner). If it is omitted or set to "" or null, the server uses the default owner name supplied during the "createSession" action or uses the account's "username" as the owner name.

"params": {
  "ownerName": "SuperUser"
}

 

"tableName"

The required "tableName" property is a string containing the name of a table.

See table name in System limits for the table naming requirements and limitations.

Example request

"params": {
  "tableName": "ctreeTable"
}

 

"result"

This section covers the unique properties of the "result" property.

deleteIndexes "result" properties summary
Property Description Type Limits (inclusive)
data is an array of objects or arrays. Each item in the array describes a record. The array is empty if no results are available. array The action determines its contents.

 

Troubleshooting errors

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.