/// <summary> /// Creates one or several records of a 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 created.</param> /// <param name="records">Buffer of records to write. Inside this string are the recordIds, and the records. Use StringFunctions.ComposeNewBuffer (Linkar.Strings library) function to compose this string.</param> /// <param name="newOptions">Object with write options for the new record(s), including recordIdType, readAfter, calculated, dictionaries, conversion, formatSpec, originalRecords.</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 Read, New, Update and Select operations: MV, XML, XML_DICT, XML_SCH, JSON, JSON_DICT or JSON_SCH.</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 records always must be specified. But the recordIds only must be specified when <see cref="NewOptions"/> argument is null, or when the <see cref="RecordIdType"/> argument of the <see cref="NewOptions"/> constructor is null. /// </remarks> public static string New(CredentialOptions credentialOptions, string filename, string records, NewOptions newOptions = null, DATAFORMAT_TYPE inputFormat = DATAFORMAT_TYPE.MV, DATAFORMATCRU_TYPE outputFormat = DATAFORMATCRU_TYPE.MV, string customVars = "", int receiveTimeout = 0) { string newArgs = OperationArguments.GetNewArgs(filename, records, newOptions, customVars); byte opCode = (byte)OPERATION_CODE.NEW; byte byteInputFormat = (byte)inputFormat; byte byteOutputFormat = (byte)outputFormat; string result = Linkar.ExecuteDirectOperation(credentialOptions, opCode, newArgs, byteInputFormat, byteOutputFormat, receiveTimeout); return(result); }
/// <summary> /// Creates one or several records of a file, synchronously only. /// </summary> /// <param name="filename">The file name where the records are going to be created.</param> /// <param name="records">Buffer of records to write. Inside this string are the recordIds, and the records. Use StringFunctions.ComposeNewBuffer (Linkar.Strings library) function to compose this string.</param> /// <param name="newOptions">Object with write options for the new record(s), including recordIdType, readAfter, calculated, dictionaries, conversion, formatSpec, originalRecords.</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 Read, New, Update and Select operations: MV, XML, XML_DICT, XML_SCH, JSON, JSON_DICT or JSON_SCH.</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 records always must be specified. But the recordIds only must be specified when <see cref="NewOptions"/> argument is null, or when the <see cref="RecordIdType"/> argument of the <see cref="NewOptions"/> constructor is null. /// </remarks> public string New(string filename, string records, NewOptions newOptions = null, DATAFORMAT_TYPE inputFormat = DATAFORMAT_TYPE.MV, DATAFORMATCRU_TYPE outputFormat = DATAFORMATCRU_TYPE.MV, string customVars = "", int receiveTimeout = 0) { string newArgs = OperationArguments.GetNewArgs(filename, records, newOptions, customVars); byte opCode = (byte)OPERATION_CODE.NEW; byte byteInputFormat = (byte)inputFormat; byte byteOutputFormat = (byte)outputFormat; string connectionInfo = this._ConnectionInfo.ToString(); string result = Linkar.ExecutePersistentOperation(this._ConnectionInfo, opCode, newArgs, byteInputFormat, byteOutputFormat, receiveTimeout); return(result); }