You are not logged in.
Pages: 1

Hi,
I have to create a query between many tables in order to create a ticket (ticket like McDonald's for example). I must take a lot of informations in these tables. So I have to create joins. I read these parts of documentation : http://synopse.info/files/html/Synopse% … ml#TITL_70 and synopse.info/files/html/Synopse mORMot … l#TITL_129 but I didn't understand all.
Firstly, for the cardinalities, I'll have a number of articles on my tickets, but this number may change every ticket. So I have to declare a number of attributs in my virtual table ? Like this :
property FirstOne: TSQLMyFileInfo read FFirstOne write FFirstOne;
property SecondOne: TSQLMyFileInfo read FSecondOne write FSecondOne;Or only one time ?
Secondly, the join must be created with the ID of the table I want to join or with the attribut ?
  MyFile := TSQLMyFile.CreateJoined(Client,aMyFileID); I didn't find a sample with an example of joins.
For now, I have this :
 { Table cat_passself }
  TSQLcat_passself = class(TSQLRecord)
  private
    fid_passage: Integer;
    fdate_passself, flibelle_repas, fnumero_ticket, foperateur, fprix_repas, fprix_repas_recalcul,
    fsubvention_fixe, fsubvention_cent : RawUTF8;
  published
    property id_passage: Integer Read fid_passage Write fid_passage;
    property date_passself: RawUTF8 Read fdate_passself Write fdate_passself;
    property libelle_repas: RawUTF8 Read flibelle_repas Write flibelle_repas;
    property numero_ticket: RawUTF8 Read fnumero_ticket Write fnumero_ticket;
    property operateur: RawUTF8 Read foperateur Write foperateur;
    property prix_repas: RawUTF8 Read fprix_repas Write fprix_repas;
    property prix_repas_recalcul: RawUTF8 Read fprix_repas_recalcul Write fprix_repas_recalcul;
    property subvention_fixe: RawUTF8 Read fsubvention_fixe Write fsubvention_fixe;
    property subvention_cent: RawUTF8 Read fsubvention_cent Write fsubvention_cent;
  end;And in few tables :
   { Table com_personne }
  TSQLcom_personne = class(TSQLRecord)
  private
    fid_entite: Integer;
    fnom, fprenom1: RawUTF8;
    fcat_passself: TSQLcat_passself;
  published
    property id_entite: Integer Read fid_entite Write fid_entite;
    property nom: RawUTF8 Read fnom Write fnom;
    property prenom1: RawUTF8 Read fprenom1 Write fprenom1;
    property cat_passself: TSQLcat_passself read fcat_passself write fcat_passself;
  public
  end;with the join with "cat_passself"
I only declared attributs in my virtual tables. I didn't create joins for now.
Thank you !
Last edited by Thomas-Acia (2015-07-02 15:21:19)
Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline
For such an information to write, I would not use the relational model, but a plain list of ticket entries, e.g. using a TCollection or a T*ObjArray of records.
See http://synopse.info/files/html/Synopse% … ml#TITL_29
The RDBMS concept is making thinks worse than necessary, IMHO.
Offline

Hi,
I decided to use views with the ORM.
Now I have another question. Is possble to compare two values with a "IF" section in Mustache ?? 
(Example : {{#qte > 1}} {{qte}} {{/qte}} )
Thank you
Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline
Try with the latest version of Mustache:
{{#if qte>1}}{{qte}}{{/if}}Offline

Try with the latest version of Mustache:
{{#if qte>1}}{{qte}}{{/if}}
Ok, I don't have the latest version ! Thank you !
Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline

I just updated my sources. I have a problem with this code :
STicket.GetRestServer.ServiceRegister(TServiceSignaling,[TypeInfo(ITicketSignaling)],sicShared);Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline
How is your ITicketSignaling.ServerSetDB() method defined?
The error is pretty clear IMHO: the "wrapper" parameter of this method is not known.
Or perhaps even not compatible with interface-based services, which transmit values per representation, so need to be serializable as JSON.
See http://synopse.info/files/html/Synopse% … l#TITL_154
Offline

How is your ITicketSignaling.ServerSetDB() method defined?
The error is pretty clear IMHO: the "wrapper" parameter of this method is not known.
Or perhaps even not compatible with interface-based services, which transmit values per representation, so need to be serializable as JSON.
See http://synopse.info/files/html/Synopse% … l#TITL_154
procedure TServiceSignaling.ServerSetDB(Wrapper: TACIASQLWrapper);
begin
  DB:=Wrapper.Rest;
  TSQLRestServerDB(DB).DB.LockingMode:=lmExclusive;
end;Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline

A compatiblity problem would be strange because it worked before my update
Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline

I have no idea. I looked my code and the mORMot unit but I found nothing
Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline
I do not understand how it may remotely work at all.
In the same process, it may work, but remotely, via JSON, transmitting a TACIASQLWrapper instance and accessing its TACIASQLWrapper.Rest property won't just work.
So it may be allowed before, but the new stronger policy is much better.
Offline

ERROR FOUND !
Line 45518 in mORMot.pas, we have to add oTSQLRecord :
if ClassHasPublishedFields(ClassType) or
       (JSONObject(ClassType,IsObjCustomIndex,[cpRead,cpWrite]) in
         [{$ifndef LVCL}oCollection,{$endif}oObjectList,oUtfs,oStrings,
          [color=#FF0000]oSQLRecord[/color],oException,oCustom]) thenYou deleted this the 18th of June at 11:03.
Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline
Pages: 1