<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent”></a> Interface IDatabaseTableAgent
Namespace: SuperOffice.WebApi.AgentsAssembly: SuperOffice.WebApi.dll Agent used for CRUD operations on database tables. Read, add, update, delete rows in tables.
Implements
IAgentBase, IDisposableMethods
<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_DeleteAsync_System_String_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> DeleteAsync(string, int[], RequestOptions)
Delete rows, by primary key; traveltransactionlog and WebHooks are supportedParameters
tableName string
The name of the table where rows should be deleted
iDs int[]
Primary keys of the rows to be deleted
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<MassOperationResult> Summary of results<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_DeleteRowAsync_System_String_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteRowAsync(string, int, RequestOptions)
Delete a row from a tableParameters
tableName string
The name of the table to delete from; in the current release this must be an ‘extratable’. Use the database name, on the form y_aTable
id int
The id of the row to delete
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_InsertAsync_System_String_System_String___System_String_____SuperOffice_WebApi_RequestOptions_”></a> InsertAsync(string, string[], string[][], RequestOptions)
Mass-insert rows, with or without primary keys specified. Works on physical tables with no special processing for udef etc.; traveltransactionlog and WebHooks are supportedParameters
tableName string
The name of the table where rows should be inserted
columns string[]
List of column names, in the same order as in the Data parameter
data string[][]
Outer array = rows, inner = columns in specified order; use CultureDataFormatter to format values that aren’t string or int
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<MassOperationResult> Summary of results<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_InsertRowAsync_System_String_SuperOffice_WebApi_Data_StringDictionary_SuperOffice_WebApi_RequestOptions_”></a> InsertRowAsync(string, StringDictionary, RequestOptions)
Insert a row into a tableParameters
tableName string
The name of the table to insert into; in the current release this must be an ‘extratable’. Use the database name, on the form y_aTable
values StringDictionary
A StringDictionary with the values to insert. You do not need to specify all the values in the table. The omitted ones will get default values
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<int> The id of the newly inserted row<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_ReadRowAsync_System_String_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ReadRowAsync(string, int, RequestOptions)
Read a row from a tableParameters
tableName string
The name of the table to fetch; in the current release this must be an ‘extratable’. Use the database name, on the form y_aTable
id int
The id of the row to fetch
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TableRecord> The row from the table<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_TruncateAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> TruncateAsync(string, RequestOptions)
Drop all rows in a table. This clearance is not individually logged in TravelTransactionlog or Webhook/script callsParameters
tableName string
Name of table to be truncated
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<MassOperationResult> Summary of results<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_UpdateRowAsync_System_String_System_Int32_SuperOffice_WebApi_Data_StringDictionary_SuperOffice_WebApi_RequestOptions_”></a> UpdateRowAsync(string, int, StringDictionary, RequestOptions)
Update a row in a tableParameters
tableName string
The name of the table to update; in the current release this must be an ‘extratable’. Use the database name, on the form y_aTable
id int
The id of the row to update
values StringDictionary
A StringDictionary with the values to update. You do not need to specify all the values in the table. The omitted ones will remain unchanged
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_IDatabaseTableAgent_UpsertAsync_System_String_System_String___System_String___System_String_____SuperOffice_WebApi_Data_UpsertNomatchAction_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> UpsertAsync(string, string[], string[], string[][], UpsertNomatchAction, bool, RequestOptions)
Insert or update rows, optionally deleting/zeroing ‘leftover’ rows. Special support for UDEF, as well as optional extensive information return. Traveltransactionlog and WebHooks are supportedParameters
tableName string
The name of the table where rows should be inserted or updated
columns string[]
List of column names, in the same order as in the data
keys string[]
List of columns that are to be used as keys, to match any existing rows
data string[][]
Outer array = row, inner = column in specified order; use CultureDataFormatter to format values
nomatchAction UpsertNomatchAction
Action to take on rows in the target table, that are not matched by any rows in the incoming data. Use the deletion options with care. NEVER use deletion if your Upsert is so large you need to divide it into multiple batches.
returnRowStatus bool
If true, then the ‘RowStatus’ member of the return carrier will be populated with a per-row status, for each incoming row
requestOptions RequestOptions
Override language/culture codes on this request.