#1 Re: mORMot 1 » Error : 'winhttp.dll error 12002 (timeout)' » 2016-04-06 07:49:18

I tried to execute the "callback" but I have the same error when the procedure arrive to line that execute Ctxt.Success();

procedure TSQLLogRestServer.ExecuteSchedules(Ctxt: TSQLRestServerURIContext);
var
 i :Integer;
 IDs: TIntegerDynArray;
 sID:RawUTF8;
 aForce,aPreview: Integer;

begin
  UrlDecodeValue (Ctxt.Parameters,'IDS=',sID,@Ctxt.Parameters);
  if UrlDecodeNeedParameters(Ctxt.Parameters,'FORCE') then
     UrlDecodeInteger(Ctxt.Parameters,'FORCE=',aForce,@Ctxt.Parameters)
  else
    aForce := Integer(false);

  if UrlDecodeNeedParameters(Ctxt.Parameters,'PREVIEW') then
     UrlDecodeInteger(Ctxt.Parameters,'PREVIEW=',aPreview,@Ctxt.Parameters)
  else
    aPreview := Integer(false);

  CSVToIntegerDynArray(PUTF8Char(sID),IDs);


   DmdScheduleServer.ScheduleThread.AExecute(IDs, boolean(aForce),boolean(aPreview)); // This function takes about 30 seconds

   Ctxt.Success(); //when this line is executed the error occurs

end;

#2 mORMot 1 » Error : 'winhttp.dll error 12002 (timeout)' » 2016-04-05 14:58:45

corchi72
Replies: 3

Hi, I have a timeout error when I execute a "IRemoteAction = interface(IInvokable)" that exceeds a few seconds of running time.

I implemented a service that performs a server-side, and after a few seconds you encounter the below error:

" ... raised exception class EWinHTTP with message 'winhttp.dll error 12002 (timeout)'."

and the error:

"TinterfaceObjectFackeClient.FakeCall(IRemoteAction.ExecuteSchedules) failed:'URI root/RemoteAction.ExecuteSchedules[[253],1,0] returned status 'Invalid Request' (501 - Server not reacheable)".


but the operation "ExecuteSchedules" is successful!!!

because waiting for the event execution order, you can only make a call?

//Interface declaration

 IRemoteAction = interface(IInvokable)
   ['{D6369DD7-6E9C-4C73-8283-87957977B2FC}']

    procedure ExecuteSchedules(const aIDs: TIntegerDynArray; Force: Integer;
      Preview: Integer);
   
  end;

..............
//Class declaration

TRemoteAction = class(TInterfacedObject, IRemoteAction)
public
      procedure ExecuteSchedules(const aIDs: TIntegerDynArray; Force: Integer = 1;
      Preview: Integer = 1);
end;

procedure TRemoteAction.ExecuteSchedules(const aIDs: TIntegerDynArray; Force, Preview: Integer);
begin

   if Assigned(DmdScheduleServer) then
     DmdScheduleServer.ExecuteSchedules(aIDs,Boolean(Force),Boolean(Preview));
end;

..........


//Server Side

     MemoryDB := TSQLLogRestServer.Create(MemoryModel,'ScheduleMemory',false,false);
 // register our TRemoteAction implementation
     MemoryDB.ServiceRegister(TRemoteAction,[TypeInfo(IRemoteAction)],sicSingle);
 // launch the HTTP server
     MemoryServer := TSQLHttpServer.Create(inttostr(fNuvRegistry.ScheduleServerHttpPort),[MemoryDB],'+',useHttpApiRegisteringURI);




........
//Client Side

 fClient.ServiceRegister([TypeInfo(IRemoteAction)],sicSingle);
    if fClient.Services['RemoteAction'].Get(I) then
        I.ExecuteSchedules(aIDs,Integer(Force),Integer(Preview));



 

thanks corchi

#4 mORMot 1 » How to convert TIntegerDynArray to TInt64DynArray » 2016-04-04 14:17:52

corchi72
Replies: 2

Hi, I have updated the last version of mORMot and unfortunately I found the changes with CreateAndFillPrepare() where I was using the integer array list, now the list has become of Int64 array list, and I have to convert all calls!!!! I used int array because I used too:

1) CopyAndSortIntegerm
2) DeleteInteger
ecc
where the Values are TIntegerDynArray,

How can to covert the array?

you have created a function / procedure referred I  ignore the existence

Thanks corchi

#5 Re: mORMot 1 » Visual Studio 2015 and mORMot » 2016-03-24 14:58:12

I'd like to see an example, with authentication .. I've already developed the server that uses authentication.
If you could post an example or lines of code that allow me to do the basics:
DELETE,UPDATE,INSERT !!

nothing easier from someone who has already done!!

I'd be very grateful!!!!!:)

Thank corchi72

#6 Re: mORMot 1 » Visual Studio 2015 and mORMot » 2016-03-24 09:06:22

I was referring to a possible example stretch of the project:

https://www.totolotek.pl/MainOdds.aspx

discussed:

http://synopse.info/forum/viewtopic.php?id=1954

develped by:

aloe

Thanks corchi

#7 mORMot 1 » Visual Studio 2015 and mORMot » 2016-03-23 17:25:55

corchi72
Replies: 5

Hi, Can anyone tell me if there is an example of a client written in C#/ASP.NET that reads the mORMot server?

Thanks corchi!

#8 Re: mORMot 1 » TSQLTable.DeleteRow() » 2016-03-21 15:57:38

so I have to delete a list of records should write this:

try



  if (fLsDelete.Count > 0) then
  begin
    fClient.BatchStart(fRecordClass);
    for ID in fLsDelete do
    begin
      fClient.BatchDelete(ID);
      fTable.DeleteRow(fTable.RowFromID(ID));
      fSQLRest.Delete("TSQLRecordClass", ID)
    end;
    fClient.BatchSend(Results);
 
 //and not necessary, but without properly to create the list of records of fTable:

   fClient.UpdateFromServer([fTable], Refreshed);


  end;

  finally
      fLsDelete.Clear;
  end;

#10 mORMot 1 » TSQLTable.DeleteRow() » 2016-03-21 14:11:39

corchi72
Replies: 4

Hi, after performing a TSQLTable.DeleteRow(), what should I do to remuve the recorcord from the table for ever?


Thanks corchi

#11 mORMot 1 » what is the best way to return the data read from a service? » 2015-11-24 12:56:45

corchi72
Replies: 0

what is the best way to return the data read from a service,

I do not understand how can I return an array of objects (multiple records) in JSON format to be read by JS:

TSQLFile = class(TSQLRecordSigned)
  private
  ...
  public
    fName: RawUTF8;
    fModified: TTimeLog;
    fCreated: TTimeLog;
    fPicture: TSQLRawBlob;
    fKeyWords: RawUTF8;
    fLabel: RawUTF8;
    fImageIndex: Integer;
    fEnabled: Boolean;
    function CheckValues(reference: TSQLRecord): Boolean; virtual;
    procedure CopyFrom(ARec: TSQLRecord); // : TSQLRecord;
    procedure CopyTo(var ARec: TSQLRecord);
    property DisplayName: RawUTF8 read GetDisplayName;
    property Check: Boolean read fCheck write fCheck;
  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 SignatureTime;
    property Signature;

   
  end;

  TSQLUserOrders = class(TSQLRecordMany)
  private
    fSource: TSQLUser;
    fDest: TSQLOrder;
  published
    property Source: TSQLUser read fSource;
    property Dest: TSQLOrder read fDest;

  end;
  
  
  TSQLUser = class(TSQLFile)
  private

    fOrders: TSQLUserOrders;
  published
    property Orders: TSQLUserOrders read fOrders;

  end;
  
  TSQLOrder = class(TSQLFile)
  private
    fOwner: RawUTF8;
    ....
	published

    property Users: TSQLUserOrders read fUsers;

  end;
  

 
 
  //Server Side
 

  
  TFileServer =   class(TSQLRestserverDB)
  private
  

  public
  
  published
  
    procedure LoadUserOrders(Ctxt: TSQLRestServerURIContext);
  end;
  
  
  ...
  
//this function returns all orders for a specific user 
procedure TFileServer.LoadUserOrders(Ctxt: TSQLRestServerURIContext);
var
 User:TSQLUser;
 fIds: TIDDynArray;
 aOrder:TSQLOrder;
 UserID: Integer;
 content: RawUTF8;
begin
  
  if not UrlDecodeNeedParameters(Ctxt.Parameters,'UserID') then exit;
  while Ctxt.Parameters<>nil do
  begin
      UrlDecodeInteger(Ctxt.Parameters,'UserID=',UserID,@Ctxt.Parameters);
  end;

  try
      User:=TSQLUser.Create;

      if Self.Retrieve(UserID,User) then
      begin

        User.Orders.DestGet( Self, User.ID, fIds);
        aOrder := TSQLOrder.CreateAndFillPrepare(Self, TInt64DynArray(fIds), CSVOrder);
        while aOrder.FillOne do
        begin
           content := ObjectToJSON(aOrder);
           
        end;

        Ctxt.Returns(content, HTML_SUCCESS, HEADER_CONTENT_TYPE + JSON_CONTENT_TYPE);

      end;
  finally
       User.Free;
  end;

end;

  
  

Thank corchi

#12 Re: mORMot 1 » ModelRoot/TableName/ID/MethodName I do not work for me » 2015-11-20 08:30:03

so, I can not call a public method of a class type TSQLRecord...

ok thanks corchi

#13 Re: mORMot 1 » ModelRoot/TableName/ID/MethodName I do not work for me » 2015-11-19 17:00:20

Excuse me,
   but then I do not understand what gives the heading methodname.
I ask this because I had also implemented a method published in the class TSQLUser that read the orders for user, but is not found in the list of public methods!!!

see this :

procedure TSQLRestServerURIContext.URIDecodeSOAByMethod;
begin
  if Table=nil then
    // check URI as 'ModelRoot/MethodName'
    MethodIndex := Server.fPublishedMethods.FindHashed(URI) else
  if URIBlobFieldName<>'' then
    // check URI as 'ModelRoot/TableName[/TableID]/MethodName'
    MethodIndex := Server.fPublishedMethods.FindHashed(URIBlobFieldName) else
    MethodIndex := -1;
end;


I have to write this method in TSQLRestserverDB or  just write in the class method:

  TFileServer =   class(TSQLRestserverDB)
  private
  public
     function LoadOrders(Ctxt: TSQLRestServerURIContext): string;
  end;


or 



  TSQLUser = class(TSQLFile)
  private
    fOrders: TSQLUserOrders; 
  public
     function LoadOrders(Ctxt: TSQLRestServerURIContext): string;
 published
     property Orders: TSQLUserOrders read fOrders;
  end;


function TSQLUSer.LoadOrdes(Ctxt: TSQLRestServerURIContext): string;
var
  content: RawUTF8;
begin

 
  content := fOrders.FillContext.ToString;
  Ctxt.Returns(content, HTML_SUCCESS, HEADER_CONTENT_TYPE + JSON_CONTENT_TYPE);

end;

#14 mORMot 1 » ModelRoot/TableName/ID/MethodName I do not work for me » 2015-11-19 16:17:41

corchi72
Replies: 4

Hi, I have a problem with the procedure:
http://127.0.0.1:888/service/User/1/Orders, my class is as follows:

 TSQLFile = class(TSQLRecordSigned)
  private
    fOwner: RawUTF8;
    fCheck: Boolean;
    fIsSystem: Boolean;
    fAssociatedRecord: TRecordReference;
    fAssociatedID: Integer;
    function GetDisplayName: RawUTF8; virtual;
  public
    fName: RawUTF8;
    fModified: TTimeLog;
    fCreated: TTimeLog;
    fPicture: TSQLRawBlob;
    fKeyWords: RawUTF8;
    fLabel: RawUTF8;
    fImageIndex: Integer;
    fEnabled: Boolean;
    function CheckValues(reference: TSQLRecord): Boolean; virtual;
    procedure CopyFrom(ARec: TSQLRecord); // : TSQLRecord;
    procedure CopyTo(var ARec: TSQLRecord);
    property DisplayName: RawUTF8 read GetDisplayName;
    property Check: Boolean read fCheck write fCheck;
  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 SignatureTime;
    property Signature;

    property Enabled: Boolean read fEnabled write fEnabled;
    property Label_: RawUTF8 read fLabel write fLabel;
    property ImageIndex: Integer read fImageIndex write fImageIndex;
    property Owner: RawUTF8 read fOwner write fOwner;
    property IsSystem: Boolean read fIsSystem write fIsSystem;
    property AssociatedID:Integer read fAssociatedID write fAssociatedID;
    property AssociatedRecord:TRecordReference read fAssociatedRecord write fAssociatedRecord;

  end;

  TSQLUserOrders = class(TSQLRecordMany)
  private
    fSource: TSQLUser;
    fDest: TSQLOrder;
  published
    property Source: TSQLUser read fSource;
    property Dest: TSQLOrder read fDest;

  end;
  
  
  TSQLUser = class(TSQLFile)
  private

    fOrders: TSQLUserOrders;
  published
    property Orders: TSQLUserOrders read fOrders;

  end;
  
  TSQLOrder = class(TSQLFile)
  private
    fOwner: RawUTF8;
    ....
	published

    property Users: TSQLUserOrders read fUsers;

  end;

I copy this from document "synopse mORMot Framework SAD 1.18 pdf" :page 228,229
....
For instance, you can see the below unique URI format for customer and orders fetched:
Customer data
URI

Get orders placed by customer "smith"
http://www.mysite.com/Customer/smith/Orders
Here, "dupont" and "smith" are used as unique identifiers to specify a customer. In practice, a name is far from unique, therefor most systems use an unique ID (like an integer, a hexadecimal number or a GUID).

...........................

When I create the server must also register the method TSQLUser.Orders

I have also seen this question but I did not understand what I write:
http://synopse.info/forum/viewtopic.php?id=926

if I execute "http://127.0.0.1:888/service/User/1/Orders" from browser error occurs 400, and it returns only the user 1 and not his orders!!

Thank Corchi

#15 Re: mORMot 1 » How to Read TSQLTable in XML format? » 2015-10-21 10:27:17

thanks, but can you post a example, for the simple table TSQLSampleRecord?

Thanks corchi

#16 mORMot 1 » How to Read TSQLTable in XML format? » 2015-10-21 09:50:19

corchi72
Replies: 2

how do I set up a simple server to read all the tables in XML format, I have to read XML and JSON because the program that consumes not read JSON!!!

I read the documentation and found a parameter to be set "ResultAsXMLObject", but I do not understand how can I get there to set it to TRUE,
see this document:
http://blog.synopse.info/post/2014/08/0 … eturns-XML



procedure TForm1.FormCreate(Sender: TObject);
begin
  Model := TSQLModel.Create([TSQLSampleRecord]);
  DB := TSQLRestServerDB.Create(Model,ChangeFileExt(paramstr(0),'.db3'),false);
  // customize RESTful URI parameters as expected by our ExtJS client 
  DB.URIPagingParameters.StartIndex := 'START=';
  DB.URIPagingParameters.Results := 'LIMIT=';
  //DB.URIPagingParameters.SendTotalRowsCountFmt := ',"total":%';
  // initialize and launch the server
  DB.CreateMissingTables;
  Server := TSQLHttpServer.Create('8080',[DB],'+',useHttpApiRegisteringURI);
  Server.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries


//  DB.Services.ResultAsJSONObject ;?????????

end;

Thanks corchi

#17 Re: mORMot 1 » small application in AngularJS » 2015-06-16 07:30:31

I've looked at the code but it seems a little complicated it seems to me that the code has been revised in all three projects and do not know which one to choose, or better your project is more complicated as the "DigDiver" does not work ... I was wondering if you could do a project working and simple.

I simple example that  get a list of records and if you are not logged, it ask you to be must logged

Sorry for my english

Thank corchi

#18 mORMot 1 » small application in AngularJS » 2015-06-15 16:30:09

corchi72
Replies: 7

help me!! I'm trying to do a very small application in AngularJS with Netbeans that must read a simple server mORMot with authentication, but I can not find a very simple example that to do it!!!! ... Can someone help me I have need a very simple example that face authentication and read data from the server?

thanks
corchi

#19 Re: mORMot 1 » VirtualTableExternalRegister: the column name "ID" is invalid » 2014-12-22 11:55:01

"Maintaining a ID/keys pairing in memory (or even better in an external SQLite3 file) is possible, we had this in mind since years"

Table SQLite  /  Key external table (array of fields)
ID               -   COD,MAT,ECC... 


is undoubtedly this would be the best (I can imagine other possible solutions) would be enough to run the post

(saving data referring to the key ID to the server mORMot and then from the server to external database would be enough to use as a key to the actual key of the outer table )



I would create a separate table mapping but when reading data in addition to reading the columns of the query "SELECT * FROM EXTERNALTABLE" add as request the list of fields that are key and add a property to the field type (KEYOrigin) then in mORMot would turn around as framework and only in the case of saving data I would write UPDATE EXTERNALTABLE fields () values () WHERE KEY is (array of fields That type is KEYOrigin)



anyway thanks for your work I think by all...
merry christmas
corchi

#20 Re: mORMot 1 » VirtualTableExternalRegister: the column name "ID" is invalid » 2014-12-19 10:39:27

Then I have to modify the tables of my client to use the mORMot ... this is impossible!!! ... I can't think that it is a common practice to modify tables in a management of a customer, for them to be questioned by an external application.

I thought that the tables of mORMot  childeren in memory the column "ID" and then when you had to do the INSERT / UPDATE/ DELETE the outside  tables "MSSQL"  were simply removed the ID from the SQL string and adding the External table key .

This is just my suggestion!

Thanks Corchi

#21 Re: mORMot 1 » VirtualTableExternalRegister: the column name "ID" is invalid » 2014-12-19 08:17:51

I understood but in my case the key is composed of two text fields, in that case, what should I write to map the ID field?

  TSQLSYS_UTEN = class(TSQLRecord)
  protected
    fSYSUTE: RawUTF8;
    fSYSSAP: RawUTF8;
    fSYSPWD: RawUTF8;
    fSYSTYPE: Int64;
    fSYSUDES: RawUTF8;
  published
    /// match SYS_UTEN.SYSUTE [nvarchar 20 0 0] *
    property SYSUTE: RawUTF8 index 20 read fSYSUTE write fSYSUTE stored AS_UNIQUE;;
    /// match SYS_UTEN.SYSSAP [nvarchar 3 0 0]
    property SYSSAP: RawUTF8 index 3 read fSYSSAP write fSYSSAP stored AS_UNIQUE;;
    /// match SYS_UTEN.SYSPWD [nvarchar 20 0 0]
    property SYSPWD: RawUTF8 index 20 read fSYSPWD write fSYSPWD;
    /// match SYS_UTEN.SYSTYPE [int 0 10 0]
    property SYSTYPE: Int64 read fSYSTYPE write fSYSTYPE;
    /// match SYS_UTEN.SYSUDES [nvarchar 100 0 0]
    property SYSUDES: RawUTF8 index 100 read fSYSUDES write fSYSUDES;
  end;

I should write an array of fields for ID. This is the example:

VirtualTableExternalRegister(Model,TSQLSYS_UTEN,Props,'SYS_UTEN');
  Model.Props[TSQLSYS_UTEN].ExternalDB. // custom field mapping
    MapField('ID',['SYSUTE','SYSSAP'] ). // array of ID in the original MSSQL Table
    MapAutoKeywordFields;



thanks corchi

#22 mORMot 1 » VirtualTableExternalRegister: the column name "ID" is invalid » 2014-12-18 14:42:38

corchi72
Replies: 7

I'm trying to connect to a MSSQL table, without the ID column, but I can not! I'm forced to add a column named ID (Integer) in all tables of an existing database?
I can not modify the tables of the customer!!

Deletefile('testExternal.db3');

var
   aClient: TSQLRestClientDB;
   aServer : TSQLRestServerDB;
   Model : TSQLModel;
   ARec_UTEN : TSQLSYS_UTEN;
begin
  Props := TOleDBConnectionProperties.Create('..\SQLEXPRESS','TestDB','sa',xxx');

  Props.ConnectionString := UTF8ToWideString(Local_Connection);
  //Props.ConnectionStringDialogExecute;

 

  Model := TSQLModel.Create([TSQLSYS_UTEN]);  
 // VirtualTableExternalRegisterAll(Model, Props, false);

  VirtualTableExternalRegister(Model,TSQLSYS_UTEN,Props,'SYS_UTEN');
  Model.Props[TSQLSYS_UTEN].ExternalDB.MapAutoKeywordFields;

  aClient := TSQLRestClientDB.Create(Model,nil,'testExternal.db3',TSQLRestServerDB);
  aClient.Server.StaticVirtualTableDirect := false;
  aClient.Server.CreateMissingTables;                                                                             //here is the error ID not exist!!
  aClient.Server.CreateSQLIndex(TSQLSYS_UTEN,['SYSUTE'],false);

   if aClient.Server.StaticVirtualTable[TSQLSYS_UTEN]=nil then
    Showmessage('error');

  ARec_UTEN := TSQLSYS_UTEN.CreateAndFillPrepare(aClient,'');

while ARec_UTEN.FillOne do
  begin
    showmessage(format('ID=%d - %s',[ARec_UTEN.ID, ARec_UTEN.SYSUTE]) );


  end;

Thanks Corchi

#23 Re: mORMot 1 » Erro testing Samples\30 - MVC Server\MVCServerPostgreSQL » 2014-11-05 13:44:29

ok perfect, thanks guys now it works!!!

I have used the PostgreSQL that you have indicated to me: "postgresql-9.3.5-1-windows-binaries"
 

thank corchi

#24 Re: mORMot 1 » Erro testing Samples\30 - MVC Server\MVCServerPostgreSQL » 2014-11-04 16:06:39

I copied libintl-8.dll and libpq.dll into Samples\30 - MVC Server\MVCServerPostgreSQL, then I correct my code with

 {$ifdef USEZEOSPOSTGRESQL}
    aExternalDB := TSQLDBZEOSConnectionProperties.Create(

      TSQLDBZEOSConnectionProperties.URI(dPostgreSQL,'localhost:5432',
      'C:\Users\corchi\Documents\Test sample\30 - MVC Server\libpq.dll',false),
      //'C:\Users\corchi\Documents\zeoslib\lib\postgresql\libpq72.dll',false),
    {$endif}
    {$ifdef USEFIREDACPOSTGRESQL}
    aExternalDB := TSQLDBFireDACConnectionProperties.Create(
      'PG?Server=localhost;Port=5432',
    {$endif}
      'postgres','postgres','admin');

but not working the exception is :

Project MVCServerPostgresSQL.exe raise exception class Exception with message 'Client-Library
'C:\Users\corchi\Documents\Test sample\30 - MVC Server\libpq.dll'
found but could not be loaded. Check compile-target and library compatibility!.

#25 Re: mORMot 1 » Erro testing Samples\30 - MVC Server\MVCServerPostgreSQL » 2014-11-04 15:41:12

not, it not working 'C:\Program Files\PostgreSQL\9.3\bin\libpq.dll'

#26 Re: mORMot 1 » Erro testing Samples\30 - MVC Server\MVCServerPostgreSQL » 2014-11-04 14:20:32

1)not,  I have downloaded last version of source mORMot 31/10/2014.

2)The postgres 9.3 is new, infact I don't know this database  very well but I  read that it is easy to learn

3) I downloaded zeoslib from this: svn://svn.code.sf.net/p/zeoslib/code-0/trunk

the following lines is written into the file :ZDbcPostgreSqlMetadata
   
The project web site is located on:                     }
{   http://zeos.firmos.at  (FORUM)                        }
{   http://sourceforge.net/p/zeoslib/tickets/ (BUGTRACKER)}
{   svn://svn.code.sf.net/p/zeoslib/code-0/trunk (SVN)    }
{                                                         }
{   http://www.sourceforge.net/projects/zeoslib.

#27 mORMot 1 » Erro testing Samples\30 - MVC Server\MVCServerPostgreSQL » 2014-11-04 11:10:35

corchi72
Replies: 16

I'm testing the example Samples\30 - MVC Server\MVCServerPostgreSQL, and An error occured when it try to creating the table public.bloginfo:

my connection is :

TSQLDBZEOSConnectionProperties.URI(dPostgreSQL,'localhost:5432',
      //'C:\Program Files\PostgreSQL\9.3\lib\libpq.dll',false),
      'C:\Users\corchi\Documents\zeoslib\lib\postgresql\libpq73.dll',false),
    {$endif}
    {$ifdef USEFIREDACPOSTGRESQL}
    aExternalDB := TSQLDBFireDACConnectionProperties.Create(
      'PG?Server=localhost;Port=5432',
    {$endif}
      'postgres','postgres','admin');

I'm tested also with libpq74.dll /80.dll/81.dll

PostgreSQL  version  9.3

file:
mORMotDB

function :
constructor TSQLRestStorageExternal.Create(aClass: TSQLRecordClass;
  aServer: TSQLRestServer);

// create corresponding external table if necessary, and retrieve its fields info
  fProperties.GetFields(fTableName,fFieldsExternal);  ..............................................................   this line create the exception
  if fFieldsExternal=nil then begin



thank corchi

#28 Re: mORMot 1 » Error to read a boolean value (RecordClass.Create).GetFieldVariant » 2014-07-02 07:15:30

the error always happens ... the important thing is to find it as soon as possible .... I'm glad that this time I was the first to find it, so I made it useful to your work of which we are all benefiting ... . than to say thank you.

corchi

#29 Re: mORMot 1 » Error to read a boolean value (RecordClass.Create).GetFieldVariant » 2014-07-01 13:31:39

this is the error
sftBoolean:
   (Value=nil) or (PWord(Value)^=ord('0')) or
     (PInteger(Value)^=FALSE_LOW);

was once written:

sftBoolean:
      Dest := boolean(GetInteger(pointer(result)));

see this:

http://synopse.info/fossil/info/fca6a4a … 623bcd1349

corchi

#30 Re: mORMot 1 » Error to read a boolean value (RecordClass.Create).GetFieldVariant » 2014-07-01 13:13:06

I may have found the error and tell me if it's true. thank you

if I'm not mistaken  1 = true and 0 = false

In this function if I passed  value=1 (true) the funcion turned me False ;

{$ifndef NOVARIANTS}
procedure ValueVarToVariant(Value: PUTF8Char; FT: TSQLFieldType;
  var result: TVarData; createValueTempCopy: boolean);
const
....
sftBoolean:
    result.VBoolean := (Value=nil) or (PWord(Value)^=ord('0')) or
      (PInteger(Value)^=FALSE_LOW);
...

#31 Re: mORMot 1 » Error to read a boolean value (RecordClass.Create).GetFieldVariant » 2014-07-01 08:50:33

I have create a generic datasource for showing data into a QuantumnGrid

I have a base table that is called TSQLfile and a derived table that is called TSQLField. I created a generic datasource based on which step TSQLfield array and read the data with the function :

function TFieldDataSource.GetValue (ARecordHandle: TcxDataRecordHandle;
   AItemHandle: TcxDataItemHandle): Variant;


My TcxCustomDataSource is :

-----FileTable-----

 TSQLFile = class(TSQLRecordSigned)
  private
    fOwner: RawUTF8;
    fCheck: Boolean;
    fIsSystem: Boolean;
    fAssociatedRecord: TRecordReference;
    fAssociatedID: Integer;
    function GetDisplayName: RawUTF8; virtual;
  public
    fName: RawUTF8;
    fModified: TTimeLog;
    fCreated: TTimeLog;
    fPicture: TSQLRawBlob;
    fKeyWords: RawUTF8;
    fLabel: RawUTF8;
    fImageIndex: Integer;
    fEnabled: Boolean;

...
end;

 TSQLField = class(TSQLFile)
  private
    fOwner: RawUTF8;
    fIsMeasure: Boolean;
    fCategory: RawUTF8;
end;

// then fIsMeasure   is not present in parent class (TSQLFile )


----unit UFieldDS;
type
  TFieldDataSource= class(TcxCustomDataSource)
  private

    fClient: TSQLRestClientURI;
    fRecordClass: TSQLRecordClass;
    TmpRec: TSQLRecord;
    FRec: TSQLFile;

  protected

    fRecordIndex: Integer;

   
    function GetValue(ARecordHandle: TcxDataRecordHandle;
      AItemHandle: TcxDataItemHandle): Variant; override;
    procedure SetValue(ARecordHandle: TcxDataRecordHandle;
      AItemHandle: TcxDataItemHandle; const AValue: Variant); override;
  public
    
     constructor Create(aOwner: TcxGridTableView; Client: TSQLRestClientURI;
      ARec: TSQLField); overload;
    Destructor Destroy; override;
  end;
 implementation
..

constructor TFieldDataSource.Create(aOwner: TcxGridTableView;
  Client: TSQLRestClientURI; ARec: TSQLField;
  );
begin

  FRec := ARec; //here I assign the TSQLfield to var ARec that it's a TSQLfile type
  fClient := TSQLRestClientURI(Client);
  fRecordClass := ARec.RecordClass;//here I read the class of origin (TSQLfield)
  TmpRec := fRecordClass.Create;//here I create the object from oringin class(TSQLfield)
end;


//Then when the datasource reads the column values I use the object: TmpRec 

function TFieldDataSource.GetValue(ARecordHandle: TcxDataRecordHandle;
  AItemHandle: TcxDataItemHandle): Variant;
var
  row: Integer;
  AColumnName: string;
  fRecordIndex :Integer;
begin
  result := inherited;

  row := 0;

  AColumnName:= TcxCustomGridTableItem  (DataController.GetItem(integer(AItemHandle))).Name;

  fRecordIndex := integer(ARecordHandle);

  row := fRecordIndex +1

  FRec.FillRow(row, TmpRec); // the TmpRec is corrected

  result :=  TmpRec.GetFieldVariant(AColumnName); //this does not work .. once worked

  //Now this works

  result :=  TSQLField(TmpRec).GetFieldVariant(AColumnName);  

end;

I have to cast the variable but the variable must already be in type TSQLField when I execute this in a constructor function:

fRecordClass := ARec.RecordClass;//here I read the class of origin (TSQLfield)
  TmpRec := fRecordClass.Create;//here I create the object from oringin class(TSQLfield)"


I'm writing because I once worked and now no longer works. I have many classes that use this datasource is the basis for what I wanted to keep it generic.

thanks corchi

ps sorry for my english but I hope that you have understand my problem

#32 mORMot 1 » Error to read a boolean value (RecordClass.Create).GetFieldVariant » 2014-06-30 13:38:56

corchi72
Replies: 9

With the last 2 updates I have verified that there is a conversion error in the values of the boolean fields when I execute "GetFieldVariant".
I read the value for implement a cell (boolean) of  a grid.

the stable version worked until 11/2013

this is my code:

var
  TmpRec: TSQLRecord;
  FRec: TSQLFile;
  col: TcxGridColumn;
  row: Integer;


begin
  
  fRecordClass := TSQLField;
  TmpRec := fRecordClass.Create;
      
     row := FRec.FillTable.RowFromID(FList.Items[fRecordIndex].IDlookup);
     FRec.FillRow(row, TmpRec);
     result := TmpRec.GetFieldVariant(col.Name);
       

sorry, the error is not in the function "GetFieldVariant" I suppose that it's in the general conversion of the recordclass expression, I have tested that the same function and it worked if I write

  //result := TmpRec.GetFieldVariant(AName); not working
  result := TSQLField(TmpRec).IsBoolean;


  result :=  TSQLField(TmpRec).GetFieldVariant('IsBoolean'); //not working


thanks
corchi

#33 mORMot 1 » how to Clear record from table type TSQLRecordMany? » 2014-06-05 10:55:24

corchi72
Replies: 1

I must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, 0, 0, 0, 0, 0, 0, 0, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, ...

thanks corchi

#34 Source Code repository » how to Clear record from table type TSQLRecordMany? » 2014-06-05 09:47:50

corchi72
Replies: 0

I must to delete all record with id =0? How do I do?

 fIds: TIntegerDynArray;

 AQvw.Expressions.DestGet(ClientDB, AQvw.ID, fIds);

this is my array of fIds:

(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, ...

thanks corchi

#35 Re: mORMot 1 » ODBC Connection to mORMot » 2013-09-13 12:08:08

I need read data from a program than can read from ODBC or from Internet file

ok thanks

#36 mORMot 1 » ODBC Connection to mORMot » 2013-09-13 10:51:39

corchi72
Replies: 3

you can create a odbc driver that connects to the server mORMot?

thnaks Corchi72

#37 Re: mORMot 1 » Call methods from browser / GetHttp » 2013-09-11 16:17:15

in which unit and which method should I enter my breakpoint.Io I had already tried to debug but did not succeed.

which is the variable to be read?

thanks corchi72

#38 Re: mORMot 1 » Call methods from browser / GetHttp » 2013-09-11 15:17:21

sorry but in the end, what is the correct string that I must to put in the browser to run a simple query?

Example
http://localhost:8080/root/RemoteSQL.Execute And then what should I write to execute a select * from customer  where id = 1

I use the example "16 - Execute SQL via services" to read data from an external source and interrogate them via http from an Internet browser.


Thanks corchi

#39 Re: mORMot 1 » How to work with the client offline? » 2013-08-29 15:28:39

From our viewpoint it is not feasible to give a read-only copy of the database, the agents will be reading, modifying and adding orders.

As an example:
the agent needs to edit or insert some new customer info, review the price lists and when it is possible to connect again with the server we expect that the local records will merge or update with the server database.

I think the bigger problem I face are the relationship tables because I have new or different IDs from the server in the local database.
We were thinking of exporting the records from the server and saving in local client with the server ID and then to synchronize the records from client to server we could use this local-ID to server-ID relationship to update the server database. If we don't have a server-ID, add a new record with a new ID and save it on the client as server-ID.

Thanks
corchi

#40 mORMot 1 » How to work with the client offline? » 2013-08-29 14:43:08

corchi72
Replies: 3

My problem is that I have agents that are sometimes offline and they would like to work as if they were connected, then when they come back online they would like to synchronize data with the server.

To use a client offline am I forced to create a local database copy with all the tables and respective relationship tables (TSQLRecordMany) from server and then synchronize all data manually, or is there a function to execute this automatically?

thanks
corchi

#41 Re: mORMot 1 » Help me about "AddFilterOrValidate" » 2013-08-07 16:21:11

sorry but no one can write a simple example, I read the documentation but can not find an example that performs TSQLRecord.Filter ('01, 02, ... '= array of ID of the table TSQLRecord), and then I execute While TSQLRecord.fillone do.

Thanks

#42 Re: mORMot 1 » Help me about "AddFilterOrValidate" » 2013-08-06 15:24:15

Could you give me an example: type clients "TSQLCustomer" respective cities  "TSQLcountry",
What I must to  write to filter the cities and display only the customers of the Cities filtered?

#43 Re: mORMot 1 » Help me about "AddFilterOrValidate" » 2013-08-06 11:59:47

So it is not possible to carry out a series of filters in the same time on multiple tables connected to each other, how does QlikView?

#44 mORMot 1 » Help me about "AddFilterOrValidate" » 2013-08-06 09:14:48

corchi72
Replies: 5

I'm Sorry for the question but I do not understand how the function "AddFilterOrValidate"  can filter the records, the filter is similar to the selection of QlikView?

Thanks corchi

#45 Re: mORMot 1 » Server push to client? » 2013-07-05 12:09:19

No I was wrong to writing the process takes about 1 minute, but the error occurs after a few seconds

#46 Re: mORMot 1 » Server push to client? » 2013-07-05 09:33:21

the server side, I recorded the following interface. the interface performs a process that takes 1 minute and everything works, but after a few seconds an error occurs 12001 of face + interface name call ..

Why?


procedure TDMDServer.CreateServerInMemory;
begin

 with TSQLLog.Family do begin
    Level := [sllError,sllInfo,sllDebug];  //LOG_VERBOSE
    EchoToConsole := [sllError,sllInfo,sllDebug];
    AutoFlushTimeOut := 2;
    DestinationPath := GetTempDir;
    OnArchive := EventArchiveSynLZ;
    //OnArchive := EventArchiveZip;
    ArchiveAfterDays := 1; // archive after one day
  end;
  // initialize the ORM data model
  MemoryModel := TSQLModel.Create([],ROOT_NAME);
  try
    // create a fast in-memory ORM server
     MemoryDB := TSQLRestServerFullMemory.Create(MemoryModel,'Memory',false,false);
      // register our TRemoteAction implementation
     MemoryDB.ServiceRegister(TRemoteAction,[TypeInfo(IRemoteAction)],sicShared);
      // launch the HTTP server
     MemoryServer := TSQLHttpServer.Create(inttostr(fNuvRegistry.ScheduleServerHttpPort),[MemoryDB],'+',useHttpApiRegisteringURI);
    

     MemoryServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
  

  except
    
  end;

end;

#47 Re: mORMot 1 » Server push to client? » 2013-07-03 17:02:22

don't work , I must to create  table with "CreateMissingTables"  ([TSQLAuthUser,TSQLAuthUser])

var
  aModel: TSQLModel;
  aDB: TSQLRestServer;
  aServer: TSQLHttpServer;
begin
  // initialize the ORM data model
  aModel := TSQLModel.Create([TSQLAuthUser,TSQLAuthUser],ROOT_NAME);

  try
    // create a fast in-memory ORM server
    aDB := TSQLRestServerFullMemory.Create(aModel,'xxx.json',false,true);
    aDB.CreateMissingTables(ExeVersion.Version.Version32);
      // launch the HTTP server
    aServer := TSQLHttpServer.Create(inttostr(888+1),[aDB],'+',useHttpApiRegisteringURI);

    aServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries

    aDB.ServiceRegister(TRemoteAction,[TypeInfo(IRemoteAction)],sicShared);


  finally
    aModel.Free;
  end;

sorry but what should I write to connect from the client and use the interface

I wrote the following code but an error occurs I can not run the setuser:

var
  Client:TSQLHttpClient;
  aModel: TSQLModel;
  sServer: AnsiString;
  I:IRemoteAction;
begin
 sServer := 'localhost';
  try
    aModel := TSQLModel.Create([],ROOT_NAME);
    try
    Client := TSQLHttpClient.Create(sServer,inttostr(888+1) ,aModel);
    if Client.SetUser('Admin','Synopse') then
       Client.ServiceRegister([TypeInfo(IRemoteAction)],sicShared);


    if not Client.Services['RemoteAction'].Get(I) then
    exit;
    I.Update(ID);


    finally
    Client.Free;
    end;
  finally
    aModel.Free;
  end;
end;

#48 Re: mORMot 1 » Server push to client? » 2013-07-03 13:48:14

ok Thanks

Then I can insert into (specific) client another server (type THttpApiServer)  without authentication, and without tables, that receives impulses from the real server?

  fServer := THttpApiServer.Create(false);
  fServer.AddUrl('root','888',false,'+',true);
  fServer.RegisterCompress(CompressDeflate); // our server will deflate html :)
  fServer.OnRequest := Process;
  fPath := IncludeTrailingPathDelimiter(Path);

and then work with the interfaces?

#49 mORMot 1 » Server push to client? » 2013-07-03 13:15:02

corchi72
Replies: 11

Sorry but I did not understand if you have already implemented the function of pushing the server to the client?

http://blog.synopse.info/post/2012/09/0 … laboration

thanks Corchi72

#50 Re: mORMot 1 » Why I have error 405 from TSQLRecordMany.ManyAdd with old database? » 2013-05-21 14:11:38

You're right, I added the new tables in the list of tables in the model and not the tail should be done as.
Now I understand! Now I better read the documentation.

thanks corchi

Board footer

Powered by FluxBB