#51 Re: mORMot 1 » synzip compress & uncompress » 2015-01-02 11:55:26

Many tx AB,

so i can't use uncompress to deflate a pdf stream : is there a synzyp function that may I use ?

#52 Re: mORMot 1 » synzip compress & uncompress » 2015-01-02 08:01:44

P.S.
I'm using dephy XE4; synopse updated with  NightlyBuild.

#53 mORMot 1 » synzip compress & uncompress » 2015-01-02 07:48:52

mariomoretti
Replies: 5

Bonjour AB and good 2015 !!
I'm troubling wirh pdf stream and synzip uncompress.
After many attempts i've done this test with compress and uncompress : the uncompress function returns Error -3 during zip/deflate process.
Perhaps i'm doing something wrong, but cannot understand where it is.

program testsynzip;

{$I Synopse.inc} 

uses
  {$I SynDprUses.inc}
  Forms,
  main in 'main.pas' {Form1};

{$R *.res}
{$R Vista.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


unit main;

interface

uses
  Winapi.Windows,
  Winapi.Messages,
  System.SysUtils,
  System.Variants,
  System.Classes,
  Vcl.Graphics,
  Vcl.Controls,
  Vcl.Forms,
  Vcl.Dialogs,
  syncommons,
  synzip, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var si, s1, s2 : tHeapmemorystream;
    li, lo : integer;
begin
     si := tHeapMemoryStream.Create;
     s1 := tHeapMemoryStream.Create;
     s2 := tHeapMemoryStream.Create;
     si.LoadFromFile('main.pas');
     lo := compressstream(si.Memory, si.Size, s1, 7, true);
     s1.SaveToFile('main.zpd');
     li := uncompressstream(s1.Memory, s1.Size, s2, nil);
     s2.SaveToFile('main.cpy');
     s2.Free;
     s1.Free;
     si.Free;
end;

end.

#54 Re: mORMot 1 » Sharding » 2014-11-21 07:27:03

AB, sorry to noise you :
certainly i've many and many things to learn because i cannot understand how to solve my problem.

I want to create an object like this :

   tRecordArrayToGrid = class
   protected
            fGrid       : tDbGrid;
            fRecInfo    : pointer;
            fValue      : ppointer;
            fDataset    : tClientDataset;
            fDatasource : tDataSource;
   public
         constructor create(aGrid : tDBGrid;
                                   aRecInfo : tTypeInfo;
                                   Var Value);
         destructor destroy;
   end;

The create method  has to create the dataset from Value and associate it to the dbgrid : I have understood how to do this.
The destroy method has to synchronize Value with dataset content  : I don't understand how to do this without create a method for each different record type.

#55 Re: mORMot 1 » Sharding » 2014-11-20 19:22:10

Sounds good and fast but the ultimate purpose is to add,edit, delete array's data.
JSONToDataset returns a readonly dataset.
Well i can create from it a clientdataset but .... is there a simply way, when edited,  to synchronize array values to dataset ones? (I,ve not found a DatasetToJSON).

#56 mORMot 1 » Sharding » 2014-11-20 07:11:40

mariomoretti
Replies: 4
SAD wrote:

Starting with the revision 1.13 of the framework, dynamic arrays, TStrings and TCollection can be used as published properties in the TSQLRecord class definition. This won't be strong enough to implement all possible "Has many" architectures, but could be used in most case, when you need to add a list of records within a particular record, and when this list won't have to be referenced as a stand-alone table.

I've many cases in which this could be e very good solution  but... they are many and often need array of (packed) record.
So I tried to implement a generic new class tDynArrayToGrid, similar to SQLTableToGrid, able to display and edit any tDynArray of record but my knowledge of framework and of RTTI is not so good and, after a long time , i've not found a solution.

Can anyone help me please? Tx

#58 Re: mORMot 1 » TRecordReference and Datetime » 2014-10-24 21:53:50

Yes AB,
i'll not maintain 2^32 rows in db, because i'll reorganize the table periodically, so there will be on line much less records, but the id will increase.
Perhaps restart from zero will not be a problem , because the id will not have a refererence on other tables.
The fact is that we are using up to 64 bit to store values,  without having the opportunity to reuse them.

#59 Re: mORMot 1 » TRecordReference and Datetime » 2014-10-23 06:22:19

Hi AB,
I'm beginning to know a bit more your fantastic framework and have a question about ID field : it is defined as Integer.
As stated in doc, in sqlite it is an int64 , but in delphi , AFAIK, it is an int32.
One of my tables will grow till int32 capability in short time (few years I suppose) : is it possible , or planned, to use an int64 for the id property ?

#60 mORMot 1 » engineexecuteall ? » 2014-10-10 04:41:03

mariomoretti
Replies: 1

I've updated to trunk.
Engineexecuteall is dead  : perhaps to maintain the framework light...may be a good reason.
Searching among new functions i've found StoredProcExecute : I need only to submit an sql statement to the server...
How can I do this now  ?
tx smile

#61 Re: mORMot 1 » sqlite and field before a variant field » 2014-10-07 08:05:48

Hi AB,

it isn't a varint issue, but a null field issue.

in mormotsqlite3 , line 644 :

    result^.BindNull(i) else

should be :

    result^.BindNull(i+1) else

#62 Re: mORMot 1 » sqlite and field before a variant field » 2014-10-01 02:29:25

I've debugged and , client side , is all ok (json string contains correct values).
Owing to the refreshing mechanism of the ribbon it's a bit difficult for me to understand what is wrong on server side.
To reproduce this event , i've modified FileTabs in synfile project such a way (added a variant type after keywords):

  TSQLFile = class(TSQLRecordSigned)
  public
    fName: RawUTF8;
    fModified: TTimeLog;
    fCreated: TTimeLog;
    fPicture: TSQLRawBlob;
    fKeyWords: RawUTF8;
    fDocProps: variant;
  published
    property Name: RawUTF8 read fName write fName;
    property Created: TTimeLog read fCreated write fCreated;
    property Modified: TTimeLog read fModified write fModified;
    property Picture: TSQLRawBlob read fPicture write fPicture;
    property KeyWords: RawUTF8 read fKeyWords write fKeyWords;
    property DocPropr: variant read fDocProps write fDocProps;
    property SignatureTime;
    property Signature;
  end;

KeyWords is never saved in the db.

#63 mORMot 1 » sqlite and field before a variant field » 2014-09-30 08:46:37

mariomoretti
Replies: 4

I've defined these tsqlrecord descendants :

    tSqlMyRecordSigned = class(tSqlRecordSigned)
    protected
             fCreated : tCreateTime;
             fModified : tModTime;
             fSyncState,        
             fState : byte;  
    published
             property Created : tCreateTime read fCreated write fCreated;
             property Modified : tModTime read fModified write fModified;
             property State : byte read fState write fState;
             property SyncState : byte read fSyncState write fSyncState;
    end;


    tSqlDominion = class(tSQLMyRecordSigned)
    public
          fDescription : RawUtf8;
          fLocDescription : RawUtf8;
    published
             property Description : RawUtf8 index 255 read fDescription write fDescription stored as_Unique;
             property LocDescription : RawUtf8 index 255 read fLocDescription write fLocDescription;
    end;


    tSqlEB_DocType = class(tSqlDominion)
    private
           fDocProps : Variant;
    published
             property DocProps : variant read fDocProps write fDocProps;
    end;

In the model i've added only tSqlEB_DocType , togheter with other objects.
The server is a restserverdb.
Adding or editing  data with tRecordEditForm doesn't update the LocDescription field.
Also managing the sqlite db with SQliteSpy , isn't possible edit data in the field wich appears in a different color (the same of field DocProps).
As a workaround i've added a new dummy boolean property before DocProps : this solves the problem
I'm using 1.18 downloaded one month ago.

#64 Re: mORMot 1 » how to hide a tSQLRibbonTab » 2014-09-11 02:58:04

Well,
thank you for your quick support.
This incredible framework has so feature that , also if documented with a two thousands page pdf , often requires a debugging to find answers.
Perhaps the problem resides in my english : what i'm asking is how to hide a tab and not how to persist it's visible property.
There is a simple answer : you have to set properly the aUserRights parameter of the tSQLRibbon.create metod. This parameter is a set [0..63]  integer that has to contain the indexes of the tables that can be managed by the user.
Perhaps a visible property in TSQLRibbonTabParameters could help : i'll  open a ticket.

#65 Re: mORMot 1 » how to hide a tSQLRibbonTab » 2014-09-10 16:30:43

Hi tech,
sorry to noise you but, where do you apply the visible property of tSQlMenus to menutabs ?

#66 Re: mORMot 1 » TSQLTableJson with no ID field » 2014-09-09 13:21:04

te gà rasùn : in milanese means that you are right.
I've recreated the tables to send you not all the project, and now works well.
But table definition in old db is the same  : may be i have changed something in property definition of other tables of the model ?

#67 mORMot 1 » TSQLTableJson with no ID field » 2014-09-09 05:07:45

mariomoretti
Replies: 2

Hi,
i'm trying to create a tSQLTableJson to view rows in a tSQLTableToGrid.

     fTableJSON := fClient.ExecuteList([fTable], 'select * from eb_currencies');

fTable is the table EB_CURRENCIES of the model.
fClient is a tSQLHTTPClient.
The table is external and has 8 fields the first of them is ID , added by the framework.

FTableJSON return only 7 fields , all except ID.

I've debugged the server side and , after call to sqlite3.prepare_v2 with 'select * from eb_currencies', the line

  fFieldCount := sqlite3.column_count(fRequest);

returns 7 in ffieldcount and, obviuosly, the table returns all fields except ID.

May someone help me ?
Thanks.

#69 Re: mORMot 1 » how to hide a tSQLRibbonTab » 2014-08-28 17:59:44

hi tech ,
thanks for reply.
May you give me an axample of how can you use a dynamic array ?
The constructor method of the ribbon apllies this control on line 1448 :

  assert(TableIndex=Tab.PageIndex); // as expected in SetAction()

that is, if i have correctly undertstood : the tfileribbontabparameter must contain exactly the same tables of the model.

#70 mORMot 1 » how to hide a tSQLRibbonTab » 2014-08-26 18:17:42

mariomoretti
Replies: 8

My project contains 23 tables.
I'm trying to let maintain them with a view similar to Synfile project , but i've the need to hide some of them.
Is there a simple way to obtain this ? I've not been able to find it.
tx

#72 Re: mORMot 1 » Suggestions for improvement » 2014-07-27 13:55:30

Well,
i've read the SAD.
I'll try to do something using tsqlrecordmany or dynarray as you suggest. The fact is that there are so many feature documented or not that i am a bit confused. This is why i think , and perhaps not only i , that more complete samples could help a lot.
If i'll bring to any result , i'll post here.
Thanks

#73 Re: mORMot 1 » Suggestions for improvement » 2014-07-27 04:38:53

I have to be more explicit...
The relation among customer and orders is clear : in the order there is a tSQLCustomer...
But what about order and items ?
I think that adding a tSQLOrder in tSQLItem is not a good idea. It is an order property.
Does the framework automatically support this without the need of create a new class TSQLOrdereItems , but simply adding a TSQLItem to TSQLOrder declared as having multiply cadinality ?
Thank you very much

#74 Re: mORMot 1 » Suggestions for improvement » 2014-07-26 22:18:03

AB,

I'd like to know how maintain a master-detail relationship whit your framework like customer-orders. How can I obtain this ?
Thanks.

#75 Re: mORMot 1 » Suggestions for improvement » 2014-07-26 18:24:14

I'm unlike to agreed with WarleyAlex : what a neewby of the frameword needs are elementary samples ,not sources of complex projects.
The master detail explanation in SAD is NOT a master detail sample : how can you say that a one to many relationship is one like this ?
(from SAD) :

TSQLMyFile = class(TSQLRecord) 
private 
    FSecondOne: TSQLMyFileInfo; 
    FFirstOne: TSQLMyFileInfo; 
    FMyFileName: RawUTF8; 
published 
         property MyFileName: RawUTF8 read FMyFileName write FMyFileName; 
         property FirstOne: TSQLMyFileInfo read FFirstOne write FFirstOne; 
         property SecondOne: TSQLMyFileInfo read FSecondOne write FSecondOne; 
end; 

this is a ONE TO TWO relationship : I have perhaps to write also ONE TO THREE ... ONE TO MILLION  classes to satisfy real world cases ?
Your framework has much documentation , but after month of reading and reading it i'm yet not able to do nothing more that not useful project, like your maindemo sample.

Regards

#76 Re: mORMot 1 » changed properties » 2014-06-23 06:34:41

bien, mais est largement mériter

#77 Re: mORMot 1 » changed properties » 2014-06-22 18:15:23

ab,
i've no words !
I cannot understand how you, sleeping as a mormot , can do all what you do.
Weel , clearly thanks, and also the adoption of a little mormot , also if i'm yet far from making a profit from my project!

Mario

#78 Re: mORMot 1 » changed properties » 2014-06-18 09:54:02

Yes ab, it's a mine request but... do you think to implement it ?

#79 Re: mORMot 1 » changed properties » 2014-06-17 23:35:38

Well,

the idea is

Create a new class , inherited from tsqlrecordsigned , with :
a new huge field which will contain all changes , not published;
a startdate  and an enddate published property containing the validity interval (UTC) of properties actually stored in published properties : a row deletion could be marked by and enddate of 0.
The version indicator will be a public property of type tTimeLog with UTC values.
Setting the indicator to a date will permit to store and retrieve values at the desired timestamp (updates will be accepted only for now or  a future date : in this case the changes wil be stored in the log and automatically applied when the date will be reached). Setting the version timelog to 0, will permit to store and retrieve values at current_date.
Define an interface with some common methods, i.e.
  setversiondate(aDate : tTimelog) that will set the version tTimelog to aDate.
  resetversiondate that will set the version property to 0.
  .....
This can be made in a new unit (i hope also fro not published huge field) , but how to define the methods needed to maintain versioning on insert, update, delete and returning values at a desired timestamp on get? Any suggestion will be appreciated.

#80 Re: mORMot 1 » changed properties » 2014-06-17 17:39:50

I'm debugging... So finally i,ve stated that stateless is stateless !
Sorry : i'm a rest beginner.
If i've understood correctly, there are two chanches to recognize changed values : (i'll use your acronym)
a) return from client only modified values : good but safe only with delphi clients.
b) read from table before apply updates. In this case , cache could help, but the documentation states that should be used only when data doesn't change frequently, so...

#81 Re: mORMot 1 » changed properties » 2014-06-17 15:25:12

Yes,  i've read it.
Insertion
no problem old values are all null.
Deletion
I'll add a status field to mark record no more valid : no need to write to log.
Update
I need to know old property values to save them in log structure : are them available at this time ?

#82 Re: mORMot 1 » changed properties » 2014-06-17 08:50:03

Hi ab,

I'm trying to inherit a class from tSQLRecord or tSQLRecordSigned.
I've thought to use OnUpdateEvent , but it is called AFTER update. Could you give me any suggestion ? Than you very much
Mario

#83 Re: mORMot 1 » changed properties » 2014-06-10 17:36:40

Certainly also clients may benefit.
About the patch container it could be, depending on cases, a single table, a specific table for each versioned table or, also , a new variant field ,never exposed to clients : where changes are limited to very few properties and version retrival is frequently asked , this could improve performances.

#84 mORMot 1 » changed properties » 2014-06-09 17:11:28

mariomoretti
Replies: 22

Hi,
sorry to noise you but I'm not able to find a solution : on server side, is there a way to know what properties have been changed in a tsqlRecord before update the database ?
I'd like to write a log containing timestamp and old values of modified properties.
Thank you very much.
Regards
Mario

#86 Re: mORMot 1 » TRecordReference and Datetime » 2014-05-20 05:21:03

TDatetime.
Perhaps I haven't correctly understood 5.1.2 of SAD : "Delphi TDateTime properties will be stored as ISO 8601 text in the database".
What are the delphi published property that the framework threats as a DB date , time or timestamp ? (In some cases I need milliseconds).

#87 mORMot 1 » TRecordReference and Datetime » 2014-05-16 22:40:46

mariomoretti
Replies: 7

Hi,
first of all : thanks for your great job !

I'm trying to understand how it works....

I've two questions.

TRecordReference : perhaps a limit of 64 tables could be few for some projects. Could be used an int64 instead of a 32 bits reference ?

TTimelog is certainly good in most cases but... why db date and time data types are not supported at all ?

Thank you.
kind regards

Mario

Board footer

Powered by FluxBB