/// <summary> /// Deletes one or several records in file, synchronously only. /// </summary> /// <param name="credentialOptions">Object with data necessary to access the Linkar Server: Username, Password, EntryPoint, Language, FreeText.</param> /// <param name="filename">The file name where the records are going to be deleted. DICT in case of deleting a record that belongs to a dictionary.</param> /// <param name="records">Buffer of records to be deleted. Use StringFunctions.ComposeDeleteBuffer (Linkar.Strings library) function to compose this string.</param> /// <param name="deleteOptions">Object with options to manage how records are deleted, including optimisticLockControl, recoverRecordIdType.</param> /// <param name="inputFormat">Indicates in what format you wish to send the resultant writing data: MV, XML or JSON.</param> /// <param name="outputFormat">Indicates in what format you want to receive the data resulting from the operation: MV, XML or JSON.</param> /// <param name="customVars">Free text sent to the database allows management of additional behaviours in SUB.LK.MAIN.CONTROL.CUSTOM, which is called when this parameter is set.</param> /// <param name="receiveTimeout">Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.</param> /// <returns>The results of the operation.</returns> /// <remarks> /// Inside the records argument, the recordIds always must be specified. But the originalRecords not always. /// When <see cref="DeleteOptions">deleteOptions</see> argument is specified and the <see cref="DeleteOptions.OptimisticLockControl"/> property is set to true, /// a copy of the record must be provided before the deletion to use the Optimistic Lock technique. /// This copy can be obtained from a previous <see cref="Read"/> operation. The database, before executing the deletion, /// reads the record and compares it with the copy in originalRecords, if they are equal the record is deleted. /// But if they are not equal, it means that the record has been modified by other user and the record will not be deleted. /// The record will have to be read, and deleted again. /// </remarks> public static string Delete(CredentialOptions credentialOptions, string filename, string records, DeleteOptions deleteOptions = null, DATAFORMAT_TYPE inputFormat = DATAFORMAT_TYPE.MV, DATAFORMAT_TYPE outputFormat = DATAFORMAT_TYPE.MV, string customVars = "", int receiveTimeout = 0) { string deleteArgs = OperationArguments.GetDeleteArgs(filename, records, deleteOptions, customVars); byte opCode = (byte)OPERATION_CODE.DELETE; byte byteInputFormat = (byte)inputFormat; byte byteOutputFormat = (byte)outputFormat; string result = Linkar.ExecuteDirectOperation(credentialOptions, opCode, deleteArgs, byteInputFormat, byteOutputFormat, receiveTimeout); return(result); }
/// <summary> /// Deletes one or several records in file, synchronously only /// </summary> /// <param name="filename">The file name where the records are going to be deleted. DICT in case of deleting a record that belongs to a dictionary.</param> /// <param name="records">Buffer of records to be deleted. Use StringFunctions.ComposeDeleteBuffer (Linkar.Strings library) function to compose this string.</param> /// <param name="deleteOptions">Object with options to manage how records are deleted, including optimisticLockControl, recoverRecordIdType.</param> /// <param name="inputFormat">Indicates in what format you wish to send the resultant writing data: MV, XML or JSON.</param> /// <param name="outputFormat">Indicates in what format you want to receive the data resulting from the operation: MV, XML or JSON.</param> /// <param name="customVars">Free text sent to the database allows management of additional behaviours in SUB.LK.MAIN.CONTROL.CUSTOM, which is called when this parameter is set.</param> /// <param name="receiveTimeout">Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.</param> /// <returns>The results of the operation.</returns> /// <remarks> /// Inside the records argument, the recordIds always must be specified. But the originalRecords not always. /// When <see cref="DeleteOptions">deleteOptions</see> argument is specified and the <see cref="DeleteOptions.OptimisticLockControl"/> property is set to true, /// a copy of the record must be provided before the deletion (originalRecords argument) to use the Optimistic Lock technique. /// This copy can be obtained from a previous <see cref="Read"/> operation. The database, before executing the deletion, /// reads the record and compares it with the copy in originalRecords, if they are equal the record is deleted. /// But if they are not equal, it means that the record has been modified by other user and the record will not be deleted. /// The record will have to be read, and deleted again. /// </remarks> public string Delete(string filename, string records, DeleteOptions deleteOptions = null, DATAFORMAT_TYPE inputFormat = DATAFORMAT_TYPE.MV, DATAFORMAT_TYPE outputFormat = DATAFORMAT_TYPE.MV, string customVars = "", int receiveTimeout = 0) { string deleteArgs = OperationArguments.GetDeleteArgs(filename, records, deleteOptions, customVars); byte opCode = (byte)OPERATION_CODE.DELETE; byte byteInputFormat = (byte)inputFormat; byte byteOutputFormat = (byte)outputFormat; string connectionInfo = this._ConnectionInfo.ToString(); string result = Linkar.ExecutePersistentOperation(this._ConnectionInfo, opCode, deleteArgs, byteInputFormat, byteOutputFormat, receiveTimeout); return(result); }