Jump to content

c0d3r

Members
  • Content Count

    129
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by c0d3r


  1. Sometimes when I ctrl+enter on some units in uses clause, I was keeping get:

     

    [MSBuild Warning] There is a circular reference involving the import of file "c:\program files (x86)\embarcadero\studio\21.0\Bin\CodeGear.Delphi.Targets". This file may have been imported more than once, or you may have attempted to import the main project file. All except the first instance of this file will be ignored.

     

    What is it about,  any idea how to get rid of it?  some of these unit are used by the project only.


  2. 1 hour ago, Anders Melander said:

    Ah yes. Shouldn't TServerServiceMethod be declared like this then:

    
    type
      TServerServiceMethod = function(Sender: TObject; const ClientIdent: TkbmMWClientIdentity;  const Args:array of Variant): variant of object;

    (add "of object")

    Also I think you need to call it like this:

    
    var
      ServiceMethod: TMethod;
    begin
      ServiceMethod.Data := Self;
      ServiceMethod.Code := MethodAddress(Func);
    
      TServerServiceMethod(ServiceMethod)(Self, ClientIdent, Args);
    end;

     

    Yes. That was it. Thanks much!


  3. 1 minute ago, Anders Melander said:

    I think you'll have to ask @Kim Madsen for help on this one. I would imagine that it's supposed to work with 64-bit but since I don't have the source I can't tell.

    These 2 lines codes aren't related to kbmMW, they are delphi RTTL related codes, that you can call all the published methods in a class.

     

      @ServiceMethod := MethodAddress(Func)

     ServiceMethod(Self, ClientIdent, Args) 


  4. 47 minutes ago, Anders Melander said:

    Strange. Could be caused by a previous stack or heap corruption, maybe in the calling method. Or it could simply be a compiler bug. I don't think it's one that I've heard of though.

     

    If it's not evident, looking at the source, where the value comes from you can try to trace through the assembler in the CPU view to determine it.

    Also make sure to do a full build to ensure that there isn't a dcu mismatch somewhere.

    I'm looking into:  @ServiceMethod := MethodAddress(Func) and  ServiceMethod(Self, ClientIdent, Args)    wondering if it works for 64 bit or not. when I trace to the actual method code,  all the properties in that "Self" is all reset, which tells me the 'Self' isn't the one.

     

    Edit:  WOW, something is wrong for sure, in that TMyService.Init method, calling a class function got 'c0000005 ACCESS_VIOLIATION' error:

     

    class function TMyService.GetPrefServceName: string

    begin

        Result := 'ABC';

    end;

     

    function TMyService.Init(const ClientIdent: TkbmMWClientIdentity; const Args: array of Variant): Variant;
    var
       ds: TDataset

       S:  string;
    begin
      s := GetPrefServiceName;  <---- raising "c0000005 ACCESS_VIOLATION" in 64 bit application

      ...

    end;


  5. Just want to make it clear.  This is a Windows service project, includes several Micro services that serve client requests.  Here are what we have in codes:

     

    Type

      TServerServiceMethod = function(Sender: TObject; const ClientIdent: TkbmMWClientIdentity;  const Args:array of Variant): variant;

     

    Function to process client request, the result will be send back to client:

     

    function TMybaseService.ProcessRequest(const Func: string; const ClientIdent: TkbmMWClientIdentity; const Args: array of Variant): Variant;

    var
      ServiceMethod: TServerServiceMethod;
    begin

      @ServiceMethod := MethodAddress(Func);
      if Assigned(ServiceMethod) then
        Result := ServiceMethod(Self, ClientIdent, Args)
      else
        Result := inherited ProcessRequest(Func, ClientIdent, Args);

    end;

     

    The problem code is one of the micro service method defined in the service's  Published section:

     

    function TMyService.Init(const ClientIdent: TkbmMWClientIdentity; const Args: array of Variant): Variant;
    var
       ds: TDataset
    begin
      Result := '';  <---- raising "Invalid variant type" in 64 bit application

      ...

    end;

     

    The codes were working in 32 bit application,  so I was wondering if there is something missing in the above ProcessRequest in 64 bit, but don't know what I'm missing.

     


  6. Hi, All

     

    I got very confused for the following code which is working in our 32 bit application but not in 64 bit application (using Delphi 10.4.1):

     

    function TMyService.Init(const ClientIdent: TkbmMWClientIdentity; const Args: array of Variant): Variant;
    var
       ds: TDataset
    begin
      Result := '';  <---- raising "Invalid variant type" in 64 bit application

      ...

    end;

     

    Any idea?   Thanks.


  7. 3 hours ago, Jacek Laskowski said:

    @c0d3r

    I guess you write to me.
    Well, you're wrong. The database has declared UTF8 type for text fields. The connection is also made with the parameter UTF8.

    Ah, OK.  Sorry about that.  I don't use FireDAC,  I'm always using UIB to work with Firebird databases with UTF8/Unicode,  I got the same error when I was using UTF8 to connect to a NONE set of Firebird database.


  8. I think you were using UTF8 character set while connecting a Firebird database which created with NONE/ANSI/... character set, which caused Firebird raised this exception.  Its NOT a FireDAC issue.   In order to make it works, either you use NONE character set while connecting to your database, or convert your Firebird database to UTF8.


  9. 3 hours ago, panie said:

    I have now updated with the latest MAP-file and got a crash. Hop it clears out what is happening.

     

    Access violation at address 50F48027 in module 'vcl270.bpl'. Read of address 00000005.

    [50F48027]{vcl270.bpl  } Vcl.Styles.TCustomStyle.DoDrawElement (Line 1085, "Vcl.Styles.pas" + 7) + $1C
    [50064109]{rtl270.bpl  } System.@InitializeRecord (Line 32563, "System.pas" + 33) + $14
    [50CFBF66]{vcl270.bpl  } Vcl.Controls.TWinControl.DefaultHandler (Line 10465, "Vcl.Controls.pas" + 30) + $19
    [50CFD0FB]{vcl270.bpl  } Vcl.Controls.TWinControl.WMMove (Line 10940, "Vcl.Controls.pas" + 3) + $2
    [50CD0000]{vcl270.bpl  } Vcl.Graphics.TFont.GetHandle (Line 2687, "Vcl.Graphics.pas" + 85) + $1D
    [2103FA16]{designide270.bpl} DeskUtil.SetFocusHook (Line 473, "DeskUtil.pas" + 4) + $C
    [50DEE362]{vcl270.bpl  } Vcl.Themes.TCustomStyleServices.DrawElement (Line 2623, "Vcl.Themes.pas" + 1) + $11
    [11D36CC4]{mmx_bds21.dll} VirtualTrees.TVirtualTreeHintWindow.Paint (Line 5603, "VirtualTrees.pas" + 64) + $34
    [50CD1623]{vcl270.bpl  } Vcl.Graphics.TCanvas.MoveTo (Line 4004, "Vcl.Graphics.pas" + 2) + $8
    [50D02963]{vcl270.bpl  } Vcl.Controls.TCustomControl.PaintWindow (Line 14396, "Vcl.Controls.pas" + 6) + $5
    [50CFC021]{vcl270.bpl  } Vcl.Controls.TWinControl.PaintHandler (Line 10508, "Vcl.Controls.pas" + 4) + $14
    [50CD6FA3]{vcl270.bpl  } Vcl.Graphics.FreeMemoryContexts (Line 7279, "Vcl.Graphics.pas" + 12) + $8
    [50CFB3B0]{vcl270.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 10113, "Vcl.Controls.pas" + 3) + $6
    [50CFB3C5]{vcl270.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 10116, "Vcl.Controls.pas" + 6) + $0
    [50CFC978]{vcl270.bpl  } Vcl.Controls.TWinControl.WMPaint (Line 10711, "Vcl.Controls.pas" + 6) + $5
    [13B122A5]{CnWizards_D104S.DLL} CnWizNotifier.IsMsgRegistered (Line 1941, "CnWizNotifier.pas" + 3) + $8
    [13B1230C]{CnWizards_D104S.DLL} CnWizNotifier.TCnWizNotifierServices.DoMsgHook$qqrp20System.Classes.TListt1p6HWND__rx24Winapi.Messages.TMessage (Line 1948, "CnWizNotifier.pas" + 1) + $19
    [13B123BF]{CnWizards_D104S.DLL} CnWizNotifier.TCnWizNotifierServices.DoMsgHook$qqrp20System.Classes.TListt1p6HWND__rx24Winapi.Messages.TMessage (Line 1959, "CnWizNotifier.pas" + 12) + $15
    [50D028FD]{vcl270.bpl  } Vcl.Controls.TCustomControl.WMPaint (Line 14385, "Vcl.Controls.pas" + 2) + $4
    [50CF6F46]{vcl270.bpl  } Vcl.Controls.TControl.WndProc (Line 7480, "Vcl.Controls.pas" + 91) + $6
    [5005A240]{rtl270.bpl  } System.@GetMem (Line 4840, "System.pas" + 20) + $0
    [50061E16]{rtl270.bpl  } System.@NewUnicodeString (Line 25649, "System.pas" + 10) + $0
    [500622B1]{rtl270.bpl  } System.@UStrAsg (Line 26639, "System.pas" + 19) + $0
    [5005A25C]{rtl270.bpl  } System.@FreeMem (Line 4888, "System.pas" + 20) + $0
    [50061F35]{rtl270.bpl  } System.@UStrArrayClr (Line 26018, "System.pas" + 16) + $0
    [50CF8ADF]{vcl270.bpl  } Vcl.Controls.TControl.IsCustomStyleActive (Line 8526, "Vcl.Controls.pas" + 😎 + $15
    [50CFBE5B]{vcl270.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10424, "Vcl.Controls.pas" + 169) + $6
    [50CF6B80]{vcl270.bpl  } Vcl.Controls.TControl.Perform (Line 7258, "Vcl.Controls.pas" + 10) + $8
    [50CFC8AC]{vcl270.bpl  } Vcl.Controls.TWinControl.PaintTo (Line 10687, "Vcl.Controls.pas" + 43) + $D
    [50D0254F]{vcl270.bpl  } Vcl.Controls.THintWindow.WMPrint (Line 14230, "Vcl.Controls.pas" + 1) + $9
    [50CF6F46]{vcl270.bpl  } Vcl.Controls.TControl.WndProc (Line 7480, "Vcl.Controls.pas" + 91) + $6
    [2103FA16]{designide270.bpl} DeskUtil.SetFocusHook (Line 473, "DeskUtil.pas" + 4) + $C
    [5005A240]{rtl270.bpl  } System.@GetMem (Line 4840, "System.pas" + 20) + $0
    [50061E16]{rtl270.bpl  } System.@NewUnicodeString (Line 25649, "System.pas" + 10) + $0
    [500622B1]{rtl270.bpl  } System.@UStrAsg (Line 26639, "System.pas" + 19) + $0
    [5005A25C]{rtl270.bpl  } System.@FreeMem (Line 4888, "System.pas" + 20) + $0
    [50061F35]{rtl270.bpl  } System.@UStrArrayClr (Line 26018, "System.pas" + 16) + $0
    [50CF8ADF]{vcl270.bpl  } Vcl.Controls.TControl.IsCustomStyleActive (Line 8526, "Vcl.Controls.pas" + 😎 + $15
    [50CFBE5B]{vcl270.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10424, "Vcl.Controls.pas" + 169) + $6
    [50CFB3B0]{vcl270.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 10113, "Vcl.Controls.pas" + 3) + $6
    [50181450]{rtl270.bpl  } System.Classes.StdWndProc (Line 18021, "System.Classes.pas" + 😎 + $0
    [50D022C8]{vcl270.bpl  } Vcl.Controls.THintWindow.ActivateHint (Line 14181, "Vcl.Controls.pas" + 35) + $1B
    [50D02337]{vcl270.bpl  } Vcl.Controls.THintWindow.ActivateHintData (Line 14194, "Vcl.Controls.pas" + 1) + $5
    [50E5CBFD]{vcl270.bpl  } Vcl.Forms.TApplication.ActivateHint (Line 12104, "Vcl.Forms.pas" + 70) + $14
    [50E5C555]{vcl270.bpl  } Vcl.Forms.TApplication.HintTimerExpired (Line 11835, "Vcl.Forms.pas" + 😎 + $4
    [50E58D5E]{vcl270.bpl  } Vcl.Forms.HintTimerProc (Line 9472, "Vcl.Forms.pas" + 3) + $5
    [50E5B23F]{vcl270.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 11028, "Vcl.Forms.pas" + 23) + $1
    [50E5B282]{vcl270.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 11058, "Vcl.Forms.pas" + 1) + $4
    [50E5B5B5]{vcl270.bpl  } Vcl.Forms.TApplication.Run (Line 11196, "Vcl.Forms.pas" + 26) + $3
    [0051E178]{bds.exe     } bds.bds (Line 222, "" + 13) + $2

     

     

    You have CnWizard installed, could be where the issues came from:

     

    13B1230C]{CnWizards_D104S.DLL} CnWizNotifier.TCnWizNotifierServices.DoMsgHook$qqrp20System.Classes.TListt1p6HWND__rx24Winapi.Messages.TMessage (Line 1948, "CnWizNotifier.pas" + 1) + $19
    [13B123BF]{CnWizards_D104S.DLL} CnWizNotifier.TCnWizNotifierServices.DoMsgHook$qqrp20System.Classes.TListt1p6HWND__rx24Winapi.Messages.TMessage (Line 1959, "CnWizNotifier.pas" + 12) + $15

     

     


  10. 5 hours ago, Arnaud Bouchez said:

    Did you try with another SQLite3 library?
    That was my point. 

    Our production back end database is Firebird,  we just want to run some queries against in memory datasets at client side applications for reporting purpose, I was told FireDAC Local SQL was based on embedded SQLite3 (?) and doesn't need any other libraries since the entire engine codes are embedded directly into applications(?)  Please let me know how to try another SQLite3 library??  Anyway,  I'm working and testing with kbmMWMemSQL at the moment, so far its good although lack of some features, missing some standard SQL syntax like HAVING, .., etc.


  11. 3 hours ago, Dany Marmur said:

    Seems TxQuery is a TDataSet-based component implementing SQL. Like kbmMemTable's add-on. So that SQL is parsed and "transplied" to TDataSet operations (?).

    Anyways, IMHO Arnaud wanted you to run your actual query in another tool/ide/whatever far away from FireDAC.

    Modern DACs to process the SQL, adjustment, additions, et.al before sending to the server so this could be a FireDAC problem.

    I do NOT understand from above that you actually executed the query (you do not publish it) sucessfully outside FireDAC.

    Confusion grows exponentially when you mention FireBird. Did you run that query on FireBird using FireDAC or ISQL? What happened to SQLLite?

    If FireDAC wants to help with a positioning cursor or locking cursor or whatever thingy "behind the scenes", problems can arise for just one combination of RDBMS, drivers and a specific feature.

    So did you confirm the query is ok? Not just looking at FireBird/SQLLite docs and check that is is listed?

    Yeah, query is OK:  "select clientid, sum(iif(price > 0, amount, 0))  as total_amount from sales group by clientid",   ran the query with TxQuery, got right result,  ran the query with Firebird iSQL, got right result too.  Using SQLite Local SQL, it listed all the ClientIDs but the Total_Amount fields were all blank. In order to test "iif" works or not,  I then tried FireDAC local sql demo program (the sample installed by Delphi 10.4.1) connected to demo db, 'select clientid, freight from qOrders' was working,  but:  "select clientid, iif(freight > 0, 10, -10) as test from qOrders" wasn't working,  it listed all the ClientIDs but the "Test" fields were all blank.


  12. 2 hours ago, Arnaud Bouchez said:

    Now I am confused.

    Is you SQL statement correct outside of FireDAC?
    You need to try it to be sure that the problem is in FireDAC configuration, not in your SQL itself.

    The SQL statement works with TxQuery,  works with Firebird,  ..., pretty much all the modern SQL engines supported IIF function nowadays.


  13. 1 hour ago, Arnaud Bouchez said:

    Your usage seems coherent with https://sqlite.org/lang_corefunc.html#iif

     

    Does your SQL statement returns the data on an external SQlite3 explorer program?

    If it does, then the problem is in FireDAC.

    No, I didn't use SQLite3 explorer,  I had few memory datasets (mostly from Reports), try finding a local sql engine to run queries against them. so far I found only TxQuery is working.  However, if Delphi 10.4.1's Compiling Optimization is turned on (Release mode), it seriously  screwed TxQuery engine codes and causing AVs, so I'm looking for an alternative, try FireDAC SQLite Local SQL, it doesn't work as long as using IIF function, try FireDAC samples/Local SQL demo, it doesn't work with IIF either.


  14. Any one know if IIF function works in FireDAC SQLite local SQL or not, I can't make it work:

     

    select iif(xx>0, 10, -1) as field1, .... from..

     

    select iif(xx>0, 'Yes', 'No') as field1, ... from...

     

    select sum(iif(xx>0, 0, 1)) as field1, ... from ...

     

     

    field1 always returned blank/empty.

     


  15. Try deleting one component on an ancient form, causing all sorts of AVs on inherited forms. Turns out you have to open each inherited forms at design time after the deletion, to answer a dump question "if the reference is deleted or renamed"..., then save them.  What were these $&&*%$$ EMBR guys thinking?  The worse part was that some of inherited forms were OK no AVs and some of inherited forms weren't OK and AVs.

     

    Imagine if you have hundreds inherited forms....


  16. I'm really frustrating with this dump "Welcome Page" implementation.  Is it too hard to these guys to implement a "Welcome Page"??,   Ever since 10.4 now 10.4.1, I have to disable this sh!t so that I could make Ctrl-Click works without crashing the Delphi with a fairly large project.  Is that so difficulty to have a working "Welcome Page"??

     

    I can't imagine how a software company would provide us a good/reliable system and they can't even make a "Welcome Page" working properly?!

×