Skip to main content

"deleteIndexes"

The deleteIndexes action deletes one or more indexes in a single transaction

Abstract

deleteIndexes deletes one or more indexes in a single transaction.

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

Request examples

Minimal request example

{
  "api":"db",
  "authToken": "replaceWithValidAuthtoken",
  "action": "deleteIndexes",
  "params": {
    "tableName": "test1",
    "indexNames": [
      "name"
    ]
  }
}
{
  "requestId": "2",
  "authToken": "replaceWithValidAuthtoken",
  "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"
}

Response examples

{
  "authToken": "replaceWithValidAuthtoken",
  "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": "replaceWithValidAuthtoken",
  "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": {
      "authToken": "replaceWithValidAuthtoken",
      "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"
    },
    "serverSuppliedValues": {
      "databaseName": "ctreeSQL",
      "ownerName": "admin"
    },
    "errorData": {
      "errorData": null
    },
    "warnings": []
  },
  "errorCode": 0,
  "errorMessage": ""
}

"params"

The "params" property is an object that contains an action's parameters. Each action defines its own required and optional properties.

Properties summary

Table 1. "params" properties summary

Property

Description

Default

Type

Limits (inclusive)

databaseName

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

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



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.

Things to know:
  • A zero-length "databaseName" is invalid.

  • Its limits are 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", "defaultDatabaseName" will be set to the "defaultDatabaseName" value that is specified in the services.json file.

The "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object.

Things to know:
  • The "ownerName" property is optional and has a dynamic default value.

  • If the "ownerName" property is omitted or set to null, the server uses the value of the "defaultOwnerName" property supplied during the "createSession" action.

  • If the "defaultOwnerName" property is not defined, the server uses the "admin" as the owner name.

  • The owner of an object has administrative rights over that object.

  • The "ownerName" property is a namespace for an object. You can think of it as a container of objects.

    The "ownerName" allows users to use any name for the objects they create — for example, a QA engineer may copy tables into their owner space to run a set of tests.

    It is common for a user to create their own copies of objects from other accounts for testing, troubleshooting, and fixing data. The copied objects can retain the same name because the "ownerName" distinguishes between them.

  • The fully qualified name of an object is the "databaseName", "ownerName", and the object's name, such as "tableName" meaning a FairCom server may contain many tables with the name "mytable" as long as each one is in a different database or in a different owner space.

    For example, an organization often creates different databases for different phases of the development lifecycle, such as dev, test, stage, ua, and prod. Each of these databases contains the same set of objects with the same names. Applications leave the "databaseName" out of their JSON actions and use the "defaultDatabaseName" property to specify the target database.

  • Queries and scripts are often written without specifying "databaseName" and/or "ownerName", allowing queries and scripts to work properly when run in different databases or in different schemas.

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

Things to know:
  • A table name may contain up to 64 ASCII characters and must not start with a number.

"result"

Properties summary

Table 2. "result" properties summary

Property

Description

Type

Limits (inclusive)

data

specifies an array or object that the server returns, such as records returned by a query

Note

It is an empty array when there are no results available.

array

Its contents are determined by the action



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.