You are not logged in.
hi,
probably a stupid question...
i have a base class TSQLBase with properties Created, CreatedFrom, Modified, ModifiedFrom.
All Object inherited from TSQLBase.
when i fill stringrid with sqlite3ui.FillStringGrid i find Created, CreatedFrom, Modified, ModifiedFrom in the first column while i would like to put in the last!
how can i do?
thanks,
Emanuele.
hi,
i need to compare object for identity.
for identity i mean that if all properties of two object, these object are identity.
i think about using rtti with something like this:
function CompareObject(Object1, Object2: TObject): Boolean;
var aContext: TRttiContext;
aRtti: TRttiType;
aProperty: TRttiProperty;
Equality: Boolean;
begin
Equality := False;
if (Object1.ClassType = Object2.ClassType) then
begin
aContext := TRttiContext.Create;
try
aRtti := aContext.GetType(Object1.ClassType);
for aProperty in aRtti.GetProperties do
begin
//THIS NOT WORK. HOW TO COMPARE TWO TVALUE?
if (aProperty.GetValue(Object1) = aProperty.GetValue(Object2))
then
Equality := True
else
Equality := False;
end;
finally
aContext.Free;
end;
end;
Result := Equality;
end;Is this a correct way or there is more simple one?
How can compare two TValue?
Maybe i must to cast TValue to his base type and then compare?
all suggestions are welcome!
thanks!
Emanuele
I see the documentation and i think that lazy loading its perfect, but there are some cases where i need that the object is all initialized.
Its possible to add a method in the orm to do this?
this can help just me?anybody have this necessity?
hi ab,
i think that use a non published variable to store the instance break data consistency because i can update an object (i.e. Provincia) so i should update all instance stored in other object.
I think to use a getter for Provincia ID but i must pass a TSQLRest Instance so the getter isn't automatic...
what do you think?
Emanuele.
Hi,
i see that when i retrieve a TSQLRecord object if one property is TSQLRecord too, i have just the ID.
for example
i have TSQLComune = class(TSQLRecord) with two properties Nome: String; and Provincia: TSQLProvincia;
so when i retrieve a TSQLComune object in Provincia i have just the ID of TSQLProvincia object.
and its ok.
but in some case i would like to retrieve a complete object.
for example
objectTSQLComune := retrieveComplete(TSQLComune, ID);
and in objectTSQLComune.Provincia have the object, not the ID.
this because in some case i would like to pass my object to other class that can access all properties, but i wont that know orm function!
Its possible? How?
Thanks,
Emanuele.
can you post a sample code?
but this is not clear.
when you try to download the license page tell that beta version is for evaluation purpose. In the forum Farshad tell that there isn't limitation about developer commercial software with unigui beta version. This is a contradiction.
Who tell me that when the license terms of unigui will be final Farshad will charge or i must retire my software developer with unigui?
i'll have to make a choice, luckily not now, but when will be i hope that the situation is more clear!
if you have news tell me please!
thanks,
Emanuele
thanks ab,
when i will integrate option with SQLite3UIOption in my application i'll post the code for example.
Emanuele.
Hi,
how is the right way to use Option in mormot?
i read documentation and i see SQLite3UIOption.
I understand that i can create an object (TSQLRecord descendant??) and pass it to TOptionsForm to show ed edit all properties. it's right?
thanks,
Emanuele.
Hi Junior,
im interested in unigui way but in unigui forum i find that unigui isn't free!
beta version is for evaluating only and Farshad decide license terms and price from 1.0 version of unigui!
do i mistake?
Have you other information?
thanks,
Emanuele
ps - something about raudus?onyone that use it?
hi junior,
unigui it's free?
did you use unigui with mormot togheter?
what are your experience?
thanks,
Emanuele.
hi ab,
now im just looking for in freetime, but only for future use...now i haven't time to try backbone.js and smart studio.
But im oriented to a free framework until the benefits of an expensive framework its very big than a free framework.
For you, what are the benefits to choice smartstudio?
hi,
have you try something with backbone.js?
i'm looking for to develop web client to work with mormot.
what are the solutions?
thanks,
Emanuele
hi Marmot76it,
i think either solution its ok. what is the best solution depend how you would like to embrace this framework.
if you are interested just at DB part you can use the secondo solution, but if you would really think "mormot"tian you should prefer first solution.
Emanuele.
hi marmot76it,
about mormot i think there is a good choice but you can discover using it.
about auto generated UI, i don't use it. it's an option, not an obligation.
about the grid you can search in the SADness
documentation about FillStringGrid (sqlite3ui.pas) if you use TStringGrid or SQLTableToGrid if you use a TDrawGrid.
about other component, if you are ancored to DBControl you can use the new .pas to generate TDataset from mormot TSQLTable or you can fill the record by hand if you don't use DBControl ( i use this way).
Some post ago i read in the forum that someone use livebinding to bind TSQLRecord to VCL controls. i haven't time to try but i think its the best solution if you use a recent delphi version.
i hope this can help you.
Emanuele.
oh sessionDelete exists!great!
so its implementable all in the serverside.
client just do the autenthication without know nothing.
mmm...this is unnecessary for me...
to call a clientside service to logout the user you must know that client have a service with that name and that do exactly what you think to do...so you have the control of the client application.
if you have its unnecessary that you create a client service to logout the user, you can callback the server service from client with an out parameter and then logout the user.
another way, most interessant, is to able the server application to force logout a specific user, so you can check license onUserLogin and force logout if license is not valid, and the client don't must to know nothing.
In this case you, and me too
can expose a real restful server without think if the client check or not the license, because the client simply dont know the license!
i hope that my idea its clear!my english isn't good...
ab you can help for this way?
Emanuele.
hi corchi,
yes, you must to login to comunicate with server, but where is the problem?
you can login, check license with service and, if necessary, logout.
another way it's to create two server.
one for configuration and license, and one for your application.
so you can login to "configuration_server" and check license, and if ok, login to "application_server".
But for me this solution its just a complication!
Emanuele.
hi corchi,
maybe you can check the users loggedin with session in the serverside.
Create a services that tell you if you can login.
the services can check if number of users logged <= MAX_LOGGED_USERS_LICENCE //this is a consts or variable that you can valorize serverside.
I think that can work.
Emanuele.
Hi BrentG,
when i find mormot i forget TDataset! I "think Object"! Right AB?:D
for SQL oint of view, when i have complex joined query i use ExecuteList command
i.e.
Self.Elenco := ControllerMain.Client.ExecuteList([TSQLPersona, TSQLComune, TSQLProvincia, TSQLRegione],
'SELECT PERSONA.ID, PERSONA.RAGIONESOCIALE, PERSONA.DESCRIZIONE, PERSONA.TITOLO, PERSONA.CODICEFISCALE, PERSONA.PARTITAIVA, PERSONA.DATANASCITA, PERSONA.SESSO, PERSONA.INDIRIZZO, C.NOME AS COMUNE, C.PROVINCIA, C.CAP, C.REGIONE ' +
'FROM PERSONA LEFT OUTER JOIN (SELECT COMUNE.ID, COMUNE.NOME, P.SIGLA as Provincia, P.Regione as Regione, COMUNE.CAP ' +
'FROM COMUNE LEFT OUTER JOIN (SELECT PROVINCIA.ID, PROVINCIA.NOME, PROVINCIA.SIGLA, REGIONE.NOME as Regione FROM PROVINCIA LEFT OUTER JOIN REGIONE on PROVINCIA.REGIONE = REGIONE.ID) P ' +
'on COMUNE.PROVINCIA = P.ID) C ON PERSONA.COMUNE = C.ID;');for fastReport see onGetValue event of Report and CompareTextCommand
i.e.
procedure TControllerAssemblea.RepAssembleaGetValue(const VarName: string;
var Value: Variant);
...
if CompareText(VarName, 'NomeCondominio') = 0 then //in the report i have a MemoText with value like this "Nome Condominio: [NomeCondominio]"
Value := TSQLAssemblea(self.ObjectsList[i]).Condominio.Nome;
...
this code substitute value with [] in report with my object properties.
I hope this help you.
Emanuele.
hi ab,
maybe there is something that i dont understand because dont work.
can u show me an example with a toolbar created from enum in a tms component that i put manually in the form?
hi ab,
excuse me but i try this code with USETMSPACK defined
tb: TSQLCustomToolBar;
tb.Init(self, TypeInfo(TmieAction),prova,nil,''); //self is TFormand create the toolbar in my form, but if i would like to create the toolbar in an advofficepager that is in the form how can i do?
if try this
tb: TSQLCustomToolBar;
tb.Init(AdvOfficePager1, TypeInfo(TmieAction),prova,nil,''); //AdvOfficePager1 is TAdvOfficePageri have assert false because TAdvOfficePager isnt a tsynpager.
thanks,
Emanuele.
ooooooohhhhh
sorry...it's friday...!!
hi,
can i use TSQLCustomToolBar with something else of TCustomForm, TSynPager and TSynPage?
i see the code and if i pass something else i falling in assert(false).
i would like to use TSQLCustomToolBar to create a toolbar from enum in a specific TAdvOfficePage that i have.
its possible?
thanks,
Emanuele.
hi ab,
i finish to write my first real (very simple) application with orm, so it's time to refactoring!
i could need to update some tsqlrecord property/ modify / or add tsqlrecord when i add/update/delete some other tsqlrecord.
for example i'm thinking about insert/update/delete an invoice must update other tsqlrecord like article, store, customer...
i read this http://synopse.info/forum/viewtopic.php?id=342
and its interesting but its that i would if i thinking database, but now i would think object!
when i tell this i realize that im falling in love for this orm...ahahah!
then what is the correct way to do?
thanks,
Emanuele.
ok, now i set aUsername e aPassword and all work ok.
thanks,
Emanuele.
hi,
u have found solution for OnAuthentificationFailed?
thanks,
Emanuele
hi there,
i have a ttimelog property in a tsqlrecordclass where i would like to store only the time.
and i wouold like to show in the grid (with fillstringgrid) only the time.
i dont use SQLite3i18n.
i dont understand how do this.
thanks,
Emanuele.
hi ab,
i have this tsqlrecord class
TSQLAssemblea = class (TSQLRecord)
private
FComune: TSQLComune;
FOraInizio: TTime;
FOraFine: TTime;
FPresenze: TSQLPresenzeAssemblea;
FOrdineDelGiorno: RawUTF8;
FIndirizzo: RawUTF8;
FCondominio: TSQLCondominio;
FData: TDateTime;
FUltimaModifica: TModTime;
FDataCreazione: TCreateTime;
public
function getMillesimiPresenti: Integer;
function getCollection(aClient: TSQLRest): TPresenze;
procedure setCollection(aClient: TSQLRest; aColl: TPresenze);
published
property Data: TDateTime read FData write FData;
property OraInizio: TTime read FOraInizio write FOraInizio;
property OraFine: TTime read FOraFine write FOraFine;
property Indirizzo: RawUTF8 read FIndirizzo write FIndirizzo;
property Comune: TSQLComune read FComune write FComune;
property Condominio: TSQLCondominio read FCondominio write FCondominio;
property OrdineDelGiorno: RawUTF8 read FOrdineDelGiorno write FOrdineDelGiorno;
property Presenze: TSQLPresenzeAssemblea read FPresenze write FPresenze;
//property MillesimiPresenti: Integer read getMillesimiPresenti;
property DataCreazione: TCreateTime read FDataCreazione write FDataCreazione;
property UltimaModifica: TModTime read FUltimaModifica write FUltimaModifica;
end;i istantiate a tsqlAssemblea object with
Assemblea := TSQLAssemblea.Create(ControllerMain.Client, IDAssemblea);now i istantiate a tsqlCondominio object with
Assemblea.Condominio := TSQLCondominio.Create(ControllerMain.Client, Assemblea.Condominio.ID);because in the orm i have just the ID (sharding), and it's ok for me.
now i would modify some property of Assemblea object like this
Assemblea.OraFine := Time();and then i would save the change with
ControllerMain.Client.Update(Assemblea);and i aspect its right instead i loss Assemblea.Condominio.
i must to do before the update
Assemblea.Condominio := TSQLCondominio(Assemblea.Condominio.ID);but why if i don't modify Condominio?
thanks,
Emanuele.
hi ab,
i know...from yesterday you hate me
i have another question about sqlrecordmany.
in a class i can declare a property like this
property XXX: Integer read getXXX;
where getXXX is a function that find XXX value.
so, can i have, for example, a property like this in my TSQLCondominio class:
property MillesimiTot: Integer read getMillesimiTot;
where getMillesimiTot loop in TSQLCondomini (TSQLRecordMany property) to find the sum of Millesimi of each Condomino in the Pivot Table.
it's possible?or the only way is declare a public function getMillesimiTot(aClient: tsqlRest): Integer and loop with fillmany/fillone?
thanks,
Emanuele.
i understand...thanks for the answer!
hi ab,
i use sqlite3ui.FillStringGrid to fill a TSQLTableJSON in a TAdvGrid.
i would like to use MarkAllowed capability that is present in TSQLTableToGrid.
how can i have this behavior rapidly?
thanks,
Emanuele
thanks i understand! now its ok!
And what's happen if i use manyadd method when source record is new record (id =0)?
hi ab,
your help its perfect always.
another, i think stupid question but i try...
i can save to orm TSQLCondomini in the same moment of TSQLCondominio?
more generic can i save to orm TSQLRecord Dest in the same moment of TSQLRecord Source or is necessary save the source, get the id and then save the dest?
ooops...
published
property Source: TSQLCondominio read FCondominio;
property Persona: TSQLPersona read FPersona; --> property Dest: TSQLPersona read FPersona;
property Millesimi: Integer read FMillesimi write FMillesimi;
end;hi ab,
thanks for the answer. so the correct way is something like this?
type
TSQLCondominio = class;
TSQLCondomini = class (TSQLRecordMany)
private
FCondominio: TSQLCondominio;
FPersona: TSQLPersona;
FMillesimi: Integer;
published
property Source: TSQLCondominio read FCondominio;
property Persona: TSQLPersona read FPersona;
property Millesimi: Integer read FMillesimi write FMillesimi;
end;
TSQLCondominio = class (TSQLRecord)
private
FNome: RawUTF8;
FIndirizzo: RawUTF8;
FComune: TSQLComune;
FCondomini: TSQLCondomini;
FDataCreazione: TCreateTime;
FUltimaModifica: TModTime;
published
property Nome: RawUTF8 read FNome write FNome;
property Indirizzo: RawUTF8 read FIndirizzo write FIndirizzo;
property Comune: TSQLComune read FComune write FComune;
property Condomini: TSQLCondomini read FCondomini write FCondomini;
property DataCreazione: TCreateTime read FDataCreazione write FDataCreazione;
property UltimaModifica: TModTime read FUltimaModifica write FUltimaModifica;
end;its right?
thanks,
Emanuele.
hi there,
i have a TSQLRecord class with a TCollection property.
This property store a collection of TCollectionItem descendant thant contain a TSQLRecord property.
a little example:
type
TCondomino = class (TCollectionItem)
private
FPersona: TSQLPersona;
FMillesimi: Integer;
procedure setPersona(const Value: TSQLPersona);
published
property Persona: TSQLPersona read FPersona write setPersona;
//property Persona: TSQLPersona read FPersona write FPersona;
property Millesimi: Integer read FMillesimi write FMillesimi;
end;
TCondomini = class (TCollection)
end;
TSQLCondominio = class (TSQLRecord)
private
FNome: RawUTF8;
FIndirizzo: RawUTF8;
FComune: TSQLComune;
FCondomini: TCondomini;
FDataCreazione: TCreateTime;
FUltimaModifica: TModTime;
public
constructor Create; Override;
destructor Destroy; Override;
published
property Nome: RawUTF8 read FNome write FNome;
property Indirizzo: RawUTF8 read FIndirizzo write FIndirizzo;
property Comune: TSQLComune read FComune write FComune;
property Condomini: TCondomini read FCondomini write FCondomini;
property DataCreazione: TCreateTime read FDataCreazione write FDataCreazione;
property UltimaModifica: TModTime read FUltimaModifica write FUltimaModifica;
end;
implementation
{ TSQLCondominio }
constructor TSQLCondominio.Create;
begin
inherited;
FCondomini := TCondomini.Create(TCondomino);
end;
destructor TSQLCondominio.Destroy;
begin
FreeAndNil(FCondomini);
inherited;
end;
{ TCondomino }
procedure TCondomino.setPersona(const Value: TSQLPersona);
begin
Self.FPersona := TSQLPersona(Value.ID);
end;when i save TSQLCondominio Object with empty collection its all ok but if there is a collectionitem in collection i have an access violation
in TJSONSerializer.WriteObject (SQLLite3Commons).
Where i mistake?
thanks,
Emanuele
hi ab,
actually i don't use SQLite3i18n unit.
the only way to have formatted date as expected is to use SQLite3i18n?
thanks,
Emanuele.
thanks ab,
now work as expected but, i always see date in english format. i would like in italian. Or i would like to change the format.
for expample:
now i see "Sep, 25 1983".
i would like to see "25/09/1983" in short format or "25 settembre 1983" in long format.
how can i do?
thanks,
Emanuele.
Hi there,
I have a tsqlrecord with a tdate property (not tdatetime, i need just the date) and when i fill tsqltable in a tadvstringgrid the tdate property isn't formatted as date.
I see that in the function expandstring (i think this is the name, i haven't the sourcecode now) miss the tdate formatting code, there is just tdatetime formatting code. I think is easy to add but my question is "why there isn't?"
Another question.
How can i Localize format of tdatetime in tsqltable?
Thanks,
Emanuele.
hi ab,
i know thats its just my problem but i need to understand why updatefromserver don't work for me...
have u any idea?
thanks,
Emanuele.
hi ab,
have u any idea for my question?
can i help u in other way?
thanks,
Emanuele.
hi ab,
before parsing JSON is
'[]'#$A
that i think its right because the table is empty, but if i have error on parsing updatefromserver dont refresh self.elenco and i have an exception.
where i mistake?
thanks
hi ab,
any idea why i have this behavior?
thanks,
emanuele
hi,
i step into update from server...
updatefrom server return false for a parsing error (return code 2).
i step also into ParseAndConvert.
i arrive at line 9973 repeat inc(P); if P^=#0 then exit; until P^='{'; // go to object beginning
then i have count 3 loop before exit.
loop 1 P^ = '['
loop 2 P^ = ']'
loop 3 P^ = #10
this can help u?
thanks,
Emanuele
hi,
this is the portion of code for delete a record.
if Application.MessageBox('Sei sicuro di voler eliminare il record?',
'CONFERMA', MB_YESNO + MB_ICONQUESTION) = IDYES then
begin
ControllerMain.Client.TransactionBegin(Self.Tabella);
Try
ControllerMain.Client.Delete(Self.Tabella, ID);
ControllerMain.Client.Commit();
Except
on E: Exception do
begin
ControllerMain.Client.RollBack();
Application.MessageBox(PWideChar('Errore durante l''eliminazione del record: ' +
E.ClassName + #13#10 + E.Message),
'ERRORE', MB_OK + MB_ICONERROR);
end;
End;
end;hi ab,
Self.Elenco is a TSQLTableJSON created onCreate of datamodule, and free onDestroy so self.Elenco wasn't deleted.
if u need i can post the code for delete record...
hi,
i m doing some test and i have this preblem.
after insert/update/delete of a record i return in the form where i display all record in a grid.
so i use updatefromserver to know if my grid need a refresh.
this works fine except if i delete the only one record (last).
if not ControllerMain.Client.UpdateFromServer([Self.Elenco], NeedRefresh) then
begin
//raise exception //HERE WHEN I DELETE LAST RECORD! WHY?
end
else
begin
if NeedRefresh then
begin
// the client refresh all GUI about TSQLTestTable.
end;
end;Thanks,
Emanuele