Jump to content

Sonjli

Members
  • Content Count

    94
  • Joined

  • Last visited

Community Reputation

5 Neutral

Recent Profile Visitors

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

  1. Very strange you never heard about FidoLib: the best library after the invention of programming (and Sprign4d, for sure ) jokes apart, Thanks for your help!
  2. Yes. The code is in FidoLib (I collaborate in the project). The file is this: https://github.com/mirko-bianco/FidoLib/blob/develop/source/Json/Fido.JSON.Marshalling.pas
  3. This was not the point, for me. I just would like to know why the RTTI doesn't know nothing about IScarafuglio until it is declared. Anyway I am looking for the use of that prop in my code.
  4. Hello. In this source unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Spring.Collections; type IScarafuglio = interface(IInvokable) ['{8E5CC1F0-8759-4965-BF83-0C2DC5E1153C}'] function Nome: string; function cognome: string; function Eta: Integer; end; IPippo = interface(IInvokable) ['{C6B11B79-F08C-47D0-9E21-EBE4788E43E1}'] function PlutoList: IReadOnlyList<IScarafuglio>; end; TForm2 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation {$R *.dfm} procedure TForm2.Button1Click(Sender: TObject); var a: IPippo; begin // Use the RTTI in Unmarshal a := Unmarshal<IPippo>( ''' { "PlutoList": [ { "Nome": "Eddy", "cognome": "Mazzarini", "Eta": 22 }, { "Nome": "Luca", "cognome": "Vecchiato", "Eta": 56 } ] } ''' ); ShowMessage(a.PlutoList[1].Nome); // AV because IScarafuglio instance is nil end; end. the interface IScarafuglio is never found with Context.FindType('Unit2.IScarafuglio'); The result i always nil. But if I add a simple field or anything else that reference the IScarafuglio in interface, then everything is fine: unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Spring.Collections; type IScarafuglio = interface(IInvokable) ['{8E5CC1F0-8759-4965-BF83-0C2DC5E1153C}'] function Nome: string; function cognome: string; function Eta: Integer; end; IPippo = interface(IInvokable) ['{C6B11B79-F08C-47D0-9E21-EBE4788E43E1}'] function PlutoList: IReadOnlyList<IScarafuglio>; end; TForm2 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } XYZ: IScarafuglio; // From now everything is fine and RTTI "know" who IScarafuglio is... public { Public declarations } end; implementation {$R *.dfm} procedure TForm2.Button1Click(Sender: TObject); var a: IPippo; begin // Use the RTTI in Unmarshal a := Unmarshal<IPippo>( ''' { "PlutoList": [ { "Nome": "Eddy", "cognome": "Mazzarini", "Eta": 22 }, { "Nome": "Luca", "cognome": "Vecchiato", "Eta": 56 } ] } ''' ); ShowMessage(a.PlutoList[1].Nome); // WORKING!!! end; end. Why this behaviour? Thanks
  5. I stepped on shit... ok, I clean my shoe and Wirth can go back to rest in peace...
  6. It would be nice to add inline methods writing in classes. I mean declaration and implementation all in the class. Example: // Inline implementation type TMyClass = class private procedure DoSomething; begin ShowMessage('Hello guys!'); end; public end;
  7. Sonjli

    FireDAC SQLite MetaDefCatalog

    FYI everything works like a charm. Thanks again
  8. Sonjli

    FireDAC SQLite MetaDefCatalog

    wooo, never used this feature... thank you!
  9. Sonjli

    FireDAC SQLite MetaDefCatalog

    Thank you very much. I try.
  10. Sonjli

    FireDAC SQLite MetaDefCatalog

    I use a multi database framework that need to do its queries using the schema name. It supposes that I can have many dbs and that I can mix tables in SQL, like all schema-based db does (SQLServer, Oracle, etc.) example: select dbusers.dbo.users.name, dbauth.dbo.athentications.read, etc.
  11. Sonjli

    FireDAC SQLite MetaDefCatalog

    How do you make it work with FireDAC? Do you use two connections? Can you better explain with examples? Thanks
  12. Sonjli

    FireDAC SQLite MetaDefCatalog

    Hello, I am trying to execute this SQL with FireDAC in D12 ent: create table if not exists mydb.mytable (name varchar(100) unique not null); With FDConnection.ExecSQL(...); These are the params I pass to the connection: DriverID=SQLite Database=mydatabase.db MetaDefCatalog=mydb CreateDatabase=True As I read in Embarcadero docs: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Connect_to_SQLite_database_(FireDAC) Well, the SQL with the "mydb" alias does not work. If I use "MAIN" (look at next sql) then it works, whatever "MetaDefCatalog" value I set! create table if not exists MAIN.mytable (name varchar(100) unique not null); -- <-- WORKS! create table if not exists mytable (name varchar(100) unique not null); -- <-- WORKS! create table if not exists mydb.mytable (name varchar(100) unique not null); -- <-- DOESN'T WORK! Thanks, Eddy
  13. Sonjli

    A lot of data...

    Hello, I have a Firebird table with hundred millions of record as time series. For example: DateTime: 01-01-2023-10:00 Data: Some fields with amazing data 🙂 Now I have to made some analysis on them and I am looking for a good system to extract data and build some "datamart" or snapshots or whatever you want. I was looking for Apache Hadhoop that looks great for my scope, but I have not experience and I'd prefer some Delphi-istic solution. Great ideas appreciated, Thanks
  14. Sonjli

    Format function params

    Hi, Embarcadero will probably no more support the .net formatter, so the GExperts one is the best on the market. I am studying it and looks very good, with some small lacks. Method params Is it possible for the formatter to format method parameters one per line? The Delphi default formatter can do this. Example: // not formatted procedure myproc(const a: string; b: integer); // formatted one per line procedure myproc( const a: string; b: integer); Blank lines Is it possible to remove these lines? // not formatted procedure myproc(const a: string; b: integer) var a: integer; begin end; // formatted, the blank line remains procedure myproc(const a: string; b: integer) !!! <---- var a: integer; begin end; Thanks (more to come... )
  15. Sonjli

    LSP processes

    Thank you. My question is more stupid and generic. I am not specifically interested with LSP... How can I run my Process with "children" processes as the IDE does with LSP? I am usual to run tasks or threads but I don't see them in Windows "Task manager"
×