"listTransactions"
JSON DB "listTransactions"
action returns a list of all active transactions that the logged-in account is authorized to see
The "listTransactions"
action returns a list of all active transactions in the current session.
Note
The "authToken"
property identifies the current session.
The purpose of this action is for an application to troubleshoot issues with transactions, such as an application creating multiple sessions and accidentally using the wrong transaction ID with the wrong session.
This action does not support pagination because the number of active transactions in a session is unlikely to grow larger than a few transactions.
If the account has administrative privileges,
"listTransactions"
returns all transactions.The list can be filtered by the
"username"
property to include transactions only from specific sessions.
Request examples
Minimal request
{ "api": "db", "action": "listTransactions", "authToken": "replaceWithAuthtokenFromCreateSession" }
{ "api": "db", "action": "listTransactions", "params": {}, "responseOptions": { "binaryFormat": "hex", "dataFormat": "objects", "numberFormat": "string", "includeFields": [], "excludeFields": [] }, "authToken": "replaceWithAuthtokenFromCreateSession", "apiVersion": "1.0", "requestId": "2", "debug": "max" }
{ "authToken": "authtoken", "result": { "dataFormat": "objects", "fields": [ { "name": "authToken", "type": "varchar", "length": 64, "scale": null, "defaultValue": null, "nullable": false, "primaryKey": 0, "autoValue": "none" }, { "name": "username", "type": "varchar", "length": 64, "scale": null, "defaultValue": null, "nullable": false, "primaryKey": 0, "autoValue": "none" }, { "name": "transactionId", "type": "varchar", "length": 64, "scale": null, "defaultValue": null, "nullable": false, "primaryKey": 0, "autoValue": "none" }, { "name": "transactionDescription", "type": "varchar", "length": 255, "scale": null, "defaultValue": null, "nullable": false, "primaryKey": 0, "autoValue": "none" } ], "data": [ { "authToken": "authtoken", "transactionDescription": "", "transactionId": "transactionId1", "username": "ADMIN" }, { "authToken": "authtoken", "transactionDescription": "user supplied description of a transaction", "transactionId": "transactionId12", "username": "ADMIN" } ] }, "errorCode": 0, "errorMessage": "" }
Use the listTransactions JSON API action to return a list of all active transactions that the logged-in account is authorized to see
The "params"
property is an object that contains an action's parameters. Each action defines its own required and optional properties.
Properties summary
"params"
properties summaryProperty | Description | Default | Type | Limits (inclusive) |
---|---|---|---|---|
usernameFilter | contains strings of usernames of accounts in order to filter a list of sessions |
| array | 1 to 64 bytes |
Properties summary
"result"
properties summaryProperty | Description | Type | Limits (inclusive) | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
specifies an array or object that the server returns, such as records returned by a query. It is an empty array when no results are available. | array | Its contents are determined by the action | ||||||||||||||||||||||
specifies the format of the data in the | string |
| ||||||||||||||||||||||
specifies an array of objects set by the server, where each object is the definition of a field in a table defining the details of each field returned by a query | array | |||||||||||||||||||||||
| controls when and how the server automatically sets the field value | string |
| |||||||||||||||||||||
| specifies the default value of a field | string | 0 to 65,500 bytes | |||||||||||||||||||||
| specifies the length of a field's value in a record | integer |
| |||||||||||||||||||||
| specifies a new name of the field | string | 0 to 64 bytes | |||||||||||||||||||||
| allows a field to contain a NULL value when | Boolean |
| |||||||||||||||||||||
| adds a field to the specifies ordinal position of the table's primary key when > 0 | integer |
| |||||||||||||||||||||
| specifies the number of places to the right of the decimal point | integer |
| |||||||||||||||||||||
| defines the type of field | string |
|
This property controls when and how the server automatically sets the field value.
Specify only one of these values per field.
"none"
indicates the server does not automatically set the field's value."incrementOnInsert"
indicates the server automatically increments a field’s value each time the server inserts a new record. It applies to fields that are of the type of decimal or one of the integer types, such as"bigint"
. Only one field per table can have this attribute. The server returns an error when assigning this attribute to multiple fields. The JSON DB API automatically creates the"id"
field as an"incrementOnInsert"
field. If you apply this attribute to another field, it becomes the only automatically incremented field in the table. If you want that field to be the primary key, assign"primaryKey": 1
to it."timestampOnInsert"
indicates the server automatically sets a field’s value to the current date and time of an insert. It applies only to fields with a type of"timestamp"
."timestampOnUpdate"
indicates the server automatically sets a field’s value to the current date and time of an update. It applies only to timestamp fields."timestampOnUpdateAndInsert"
indicates the server automatically sets a field’s value to the current date and time of an insert and an update. It applies only to fields with a type of"timestamp"
."changeId"
indicates the server uses the field for optimistic locking. The server automatically sets the field's value to the internal transaction number used during the last update of the record. This value changes each time the server updates the record. A table may only have one change tracking field. The field type must be"bigint"
.The JSON DB API automatically creates a
"changeid"
field with change-tracking functionality.Change tracking is optional in the CTDB and ISAM APIs. The application must create a 64-bit integer field and assign change-tracking functionality to it.
The "data"
property contains a response message. Its contents are defined by the action. It is an empty array when no results are available.
Example
arrays
"data": [ ["test1", ".\\test1.dbs\\SQL_SYS", 1003] ]
objects
"data": [ { "databaseName": "test7", "path": ".\\test7.dbs\\SQL_SYS", "uid": 1015 } ]
The "dataFormat"
property is an optional, case-insensitive string enum that defines the format of the response in the "data"
property. The default format is an array of arrays. The alternative is an array of objects. The default for "dataFormat"
can be changed during a "createSession"
action by assigning a different value to the "dataFormat"
property in "defaultResponseOptions"
.
"dataFormat"
property:Two of those versions occur in a request and another occurs in a response. They all indicate how data is formatted.
"dataFormat"
in the request inside"responseOptions"
determines how the"data"
property in the response is formatted.Possible values include:
"arrays"
This is the default and causes the server to return results as an array of arrays, which is the most efficient.
"objects"
This returns results as an array of objects. This is less efficient but is simpler to generate, read, and troubleshoot.
"dataFormat"
in the request in the"params"
object notifies the server how the"sourceData"
property is formatted in the request. This version is rarely used because of the default"autoDetect"
behavior.Possible values include:
"arrays"
This causes the server to return results as an array of arrays, which is the most efficient.
"objects"
This returns results as an array of objects. This is less efficient but is simpler to generate, read, and troubleshoot.
"autoDetect"
This is the default and causes the server to automatically detect the format of the data in the
"sourceData"
property.
"dataFormat"
in the response shows the client how the server formatted the"data"
property.Possible values include:
"arrays"
This is the default and causes the server to return results as an array of arrays, which is the most efficient.
"objects"
This returns results as an array of objects. This is less efficient but is simpler to generate, read, and troubleshoot.
The "fields"
property is a required array of field-type objects. There is one object for each top-level field in the array. Each object identifies the actual data type of the field as stored in the database.
A field-type object is used when creating a table. It contains one object for each field definition returned in the data.
Full request example
"fields": [ { "name": "name", "type": "varchar", "length": 50, "scale": null, "defaultValue": null, "nullable": false, "primaryKey":1 } ]
Full response example
"fields": [ { "name": "id", "type": "bigint", "length": null, "scale": null, "autoValue": "none", "defaultValue": null, "nullable": false, "primaryKey": 1 } ]