Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

17 Good

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I used templates from scratch and it worked just fine. I could not find what was wrong though. Thanks.
  2. Hello, I normally use UniDAC with MARS. This time, I have to use FireDAC and I am not used to FireDAC at all. I checked MARS demo applications to prepare my INI file as below: [DefaultEngine] Port=8085 ThreadPoolSize=100 FireDAC.MAIN_DB.DriverID=FB FireDAC.MAIN_DB.Database="D:\rest_server\SAMPLE.FDB" FireDAC.MAIN_DB.User_Name=SYSDBA FireDAC.MAIN_DB.Password=mypassword FireDAC.MAIN_DB.Protocol=TCPIP FireDAC.MAIN_DB.Server=localhost FireDAC.MAIN_DB.Pooled=True FireDAC.MAIN_DB.POOL_MaximumItems=100 FireDAC.MAIN_DB.TxOptions.Isolation=xiReadCommitted When server tries to establish a database connection, client receives below error: Internal server error: [EFDException] [FireDAC][Stan][Def]-254. Definition [MAIN_DB] is not found in [] Server EXE is built as a windows service application. Fbclient.dll file with correct bitness and version is in the same directory as my EXE file. I have following in my code to make sure MARS uses certain definition in INI file. [Connection('MAIN_DB'), Path('token')] TTokenResource = class(TMARSTokenResource) Any help is appreciated. Thanks & Regards, Ertan
  3. Can you share some code that fails? With exact error message you receive? Thanks. Ertan
  4. Hello, There is an application that consumes a SOAP web service. From time to time this web service is not stable and sending various html error messages instead of a valid response. Using Delphi 10.4.2 I would like to read incoming html data and display this to the user. Currently, all we can display is "Received content of invalid Content-Type setting: text/html - SOAP expect "text/xml" error message. I have searched the internet. Someone suggested to modify Soap.SOAPHTTPTrans.THTTPReqResp.CheckContentType and prevent it from raising an exception but this does not sound like a decent solution and might cause other troubles with other applications using SOAP. What I am after is a solution to be used just with this specific application of ours. I wonder if there is an alternative solution that can be used. Thanks & Regards, Ertan
  5. ertank

    Type Library (COM) Problem

    It is a shame that I did not see that at all. Changing into ARP_CODE and there is no access violation on that line. Thanks. However, when I try to post an invoice, now I get "Catastrophic failure" error. Below is the final state of my test code. It works down to LInvoice.Post() I compared code with C# working code. Price, Code, quantity etc assigned are identical. They are test values anyway. LInvoice := FComConnection.NewDataObject(doSalesInvoice); try LInvoice.New(); LInvoice.DataFields.FieldByName('TYPE').Value := 8; LInvoice.DataFields.FieldByName('NUMBER').Value := '~'; LInvoice.DataFields.FieldByName('DATE').Value := '29.01.2022'; FComConnection.PackTime(12, 12, 12, LTime); LInvoice.DataFields.FieldByName('TIME').Value := LTime; LInvoice.DataFields.FieldByName('ARP_CODE').Value := '320.01.002'; LInvoiceLines := LInvoice.DataFields.FieldByName('TRANSACTIONS').Lines; LInvoiceLines.AppendLine(); LInvoiceLines[I].FieldByName('TYPE').Value := 0; LInvoiceLines[I].FieldByName('MASTER_CODE').Value := 'M.01.003'; LInvoiceLines[I].FieldByName('QUANTITY').Value := 5.5 + I; LInvoiceLines[I].FieldByName('PRICE').Value := 3.5 + I; LInvoiceLines[I].FieldByName('VAT_RATE').Value := 8; LInvoiceLines[I].FieldByName('UNIT_CODE').Value := 'KG'; if not LInvoice.Post() then // <--- Here Catastrophic failure begin if LInvoice.ErrorCode <> 0 then begin FLog.LogError('Cannot post invoice: ' + IntToStr(LInvoice.ErrorCode) + ', ' + LInvoice.ErrorDesc); Exit(); end; end; FLog.LogInfo('Internal reference: ' + LInvoice.DataFields.FieldByName('INTERNAL_REFERENCE').Value); Code is actually in try..except block, "Catastrophic error" is catched in except and logged. But I did not include it here IQuery is an interface from the COM library, yes. Below part is what I see in TLB file for IQuery. I can share whole TLB it in private message if you would like to look at different parts of it. It is almost 10k lines. // Initial definition IQuery = interface; // another line Query = IQuery; // function definition inside COM main interface function NewQuery: IQuery; safecall; // *********************************************************************// // Interface: IQuery // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {3A1DB335-35DB-463B-AF5C-6BA2B143E65A} // *********************************************************************// IQuery = interface(IDispatch) ['{3A1DB335-35DB-463B-AF5C-6BA2B143E65A}'] function Get_name: WideString; safecall; procedure Set_name(const Value: WideString); safecall; function Get_Statement: WideString; safecall; procedure Set_Statement(const Value: WideString); safecall; function Get_Error: Integer; safecall; function Get_QueryFields: IQueryFields; safecall; function FieldByName(const fieldName: WideString): IQueryField; safecall; function Execute: WordBool; safecall; function OpenDirect: WordBool; safecall; procedure Close; safecall; function First: WordBool; safecall; function Next: WordBool; safecall; function Previous: WordBool; safecall; function Last: WordBool; safecall; function Get_SQLClause: ISQLClause; safecall; function GetDateString(ADate: TDateTime): WideString; safecall; function Get_DBErrorDesc: WideString; safecall; property name: WideString read Get_name write Set_name; property Statement: WideString read Get_Statement write Set_Statement; property Error: Integer read Get_Error; property QueryFields: IQueryFields read Get_QueryFields; property SQLClause: ISQLClause read Get_SQLClause; property DBErrorDesc: WideString read Get_DBErrorDesc; end; I doubt FMainConnection (now FComConnection) setting is wrong as I can do some other operations using it. Login, Disconnect, GetVersion, LastError, LastErrorString, GetTablename etc. But, it is a fact that I could not see that "hyphen" and "underscore" thing for a couple of days. Thanks & Regards, Ertan
  6. Hello, I am using Delphi 10.4.2. There is a type library that can be accessed using COM. I can import it and use some parts like login, disconnect, version. There are other parts to do database operations and it seems Delphi has problems using those parts of it. 1- No interface retrieved var LQuery: IQuery; begin LQuery := FMainConnection.NewQuery(); // Here LQuery still remains as nil end; 2- Access Violation var LInvoice: IData; LInvoiceLines: ILines ATime: OleVariant; begin LInvoice := FMainConnection.NewDataObject(doSalesInvoice); try LInvoice.New(); LInvoice.DataFields.FieldByName('TYPE').Value := 8; LInvoice.DataFields.FieldByName('NUMBER').Value := 'L0129002'; LInvoice.DataFields.FieldByName('DOC_NUMBER').Value := 'L0129002'; LInvoice.DataFields.FieldByName('AUXIL_CODE').Value := 'AUTO'; LInvoice.DataFields.FieldByName('DATE').Value := '29.01.2022'; FMainConnection.PackTime(12, 12, 12, ATime); LInvoice.DataFields.FieldByName('TIME').Value := ATime; LInvoice.DataFields.FieldByName('ARP-CODE').Value := '320.01.002'; // Here Access Violation raises LInvoiceLines := LInvoice.DataFields.FieldByName('TRANSACTIONS').Lines; However, If I try all of these using Visual Studio C#.NET, everything works. Since this is COM object, codes on both Visual Studio and Delphi are almost identical. Both Delphi and Visual Studio installed on my development computer. They are using same Type Library, same dll files and it is only Delphi fails to use its parts. I wonder if there is some catch to do with Delphi to fix such problems as I am not experienced much using type libraries. Any help is appreciated. Thanks & Regards, Ertan
  7. ertank

    Receiving multiples JSON on Rest API Horse

    I only checked Horse framework in the past and do not have deep knowledge about it. It was not to my taste. I like MARS-Curiosity more. I do not know how you coded Horse side of the things. I do know for sure that Horse is a multi-threaded framework. You should really check your codes on the Horse side.
  8. ertank

    Firebird 4.0 Unknown sql type err.

    I would still stick with FirebirdSQL v4.0 and use advised DataTypecompatibility = 3.0 parameter. You should be just fine and moreover, you will only need to disable that parameter once Delphi adds support for it in the future (most likely next year).
  9. Hello, My installation is directly open to the internet. Is it possible to identify incoming remote IPv4 numbers in MARS? Additionally, is it possible to allow permission to a method only for a specific IPv4 number? Thanks & Regards, Ertan
  10. These numbers are read from a scale generated barcode for calculating price of a product like cheese. Barcode has weight, unit price and amount of that weight printed in numbers on it. Application was calculating total amount 0.01 wrongly. I was trying to fix that old code to have exact amount displayed on that barcode. Turns out Currency type is the way to go. I tried it and works correctly on all samples I have. The code otherwise is same including rounding functions.
  11. Hello, Using Delphi 10.4.2 I get different rounded values using below code. Purpose is to round up and have 13.98 for both. uses System.Math; procedure TForm1.Button1Click(Sender: TObject); var ToBeRounded: Double; Rounded: Double; begin ToBeRounded := 55.9 * 0.25; Rounded := SimpleRoundTo(ToBeRounded, -2); ShowMessage(ToBeRounded.ToString() + ' ' + Rounded.ToString()); // ToBeRounded is 13.975 and Rounded is 13.97 at this point Rounded := SimpleRoundTo(13.975, -2); ShowMessage(Rounded.ToString); // Rounded is 13.98 at this point end; If one reads help file it has following table for expected results I do not have deep floating point knowledge. I basically know they have a lot more digits than displayed. My question is, how can I always get 13.98 as result using multiplications and such. Thanks & Regards, Ertan
  12. ertank

    Simple app for Android 5.0.2

    That was my mistake. Though, it is still not working even above quote error is fixed. I was thinking, can this be because of new template values of recent Android versions? For example, I think Android 5.0.2 does not have following android:usesCleartextTraffic="true" Since my test phone has recent versions of Android, I had to add it in order to be able to test the app.
  13. ertank

    Simple app for Android 5.0.2

    It was in Turkish and I did not have access to original message. You can find it attached. Thanks. AndroidManifest.xml
  14. ertank

    Simple app for Android 5.0.2

    Hello, I am using Delphi 10.4.2. There is a very simple app (needs internet and network status permissions, 3 pages total) that I need to run on Android 5.0.2. I compiled it with stock SDK 25.2.5 targeting Android32. When package tried to be loaded on Android 5.0.2 it says Compiler error There is a problem with the packet parsing. Docwiki says Delphi 10.4.2 supports Android 6 minimum. Even Delphi 10.3.3 supports Android 5.2 mimimum. I wonder if there is some "workaround" that I can use without installing an older version. Thanks & Regards, Ertan
  15. ertank

    thread-safe ways to call REST APIs in parallel

    Not a direct reply to the question. But, if I ever need to run parallel requests, I should be really thinking about building a custom thread class or two with main thread synchronization where needed.