#1 Re: Free Pascal Compiler » FPC 3.2 rc1 » 2020-04-08 12:13:43

I don't see any NewPascal updates anymore.
Does this means the NewPascal is deprecated?

#2 Re: mORMot 1 » SynCommons Exception Class External:SIGSEGV » 2020-04-08 12:10:05

Just saw this post: https://synopse.info/forum/viewtopic.php?id=5361
So I decided to go with latest fpcupdeluxe and selected FPC fixes3.2 and Lazarus fixes2.0.
TestSQL3 passed with some errors. At least no SIGSEV's this time :-)

#3 Re: mORMot 1 » SynCommons Exception Class External:SIGSEGV » 2020-04-08 08:05:28

I changed  in Synopse.inc

FROM:
  {$ifdef VER3_1} // trunk before 3.2
    {$define ISFPC27}
    {$define ISFPC30}
    {.$define HASDIRECTTYPEINFO}
    // define this for trunk revisions older than June 2016 - see
    // http://wiki.freepascal.org/User_Changes … mat_change
  {$endif}

TO:
  {$ifdef VER3_1} // trunk before 3.2
    {$define ISFPC27}
    {$define ISFPC30}
    {$define HASDIRECTTYPEINFO}
    // define this for trunk revisions older than June 2016 - see
    // http://wiki.freepascal.org/User_Changes … mat_change
  {$endif}

Did a rebuild but still a SIGSEV in SynCommos line 50573: fElemType:=PPointer(fElemType)^;

#4 Re: mORMot 1 » SynCommons Exception Class External:SIGSEGV » 2020-04-01 13:05:34

since I am working with FPC 3.3.1 I assumed it FPC is newer than 3.1.1 and that it was not necessary to add HASDIRECTTYPEINFO.
Is this a wrong assumption / understanding?

#5 Re: mORMot 1 » SynCommons Exception Class External:SIGSEGV » 2020-04-01 11:22:13

Has this been solved? I also get the same exception when running TestSQL3 in Lazarus 2.1.0 rev 62772 / FPC 3.3.1 in Win10.
If so, what is the solution for this issue?

Thanks.

#6 Re: mORMot 1 » Patching the examples sources » 2020-02-06 18:03:04

I got the same error for IntGet and IntSet. I used the Github version.
I downloaded the NightlyBuild from : https://synopse.info/fossil/wiki?name=Get+the+source
Now, the package compiles.

I am using Lazarus 2.1.0 r62611 and FPC 3.3.1 on Windows. My target is i386-win32

#7 Re: mORMot 1 » Where is TSynSQLTableDataSet located? » 2019-03-23 12:28:24

Thank you for the information Ab.
Since the class is located in mORMotVCL does this mean that the class cannot be used in NewPascal?

#8 mORMot 1 » Where is TSynSQLTableDataSet located? » 2019-03-22 17:54:42

wai-kit
Replies: 2

Hi,

I am going through the forum and reading a lot about TSynSQLTableDataSet. But I cannot find a reference to it in the documentation.
In which unit is this located?

Thanks.

#9 Re: mORMot 1 » CreateAndFillPrepareJoined SQL table » 2019-03-22 11:44:05

@Ab, so if I understand this thread right then a possible way to work with datasets and ORM is with CreateAndFillPrepareJoined and TSynSQLTableDataSet?
I mean if I want to avoid working with SQL, this is the way to go?

#10 Re: mORMot 1 » Access to MVC application from another device » 2019-03-19 16:17:51

Since sample project04 was working and the difference was in the Port used, I decided to change the port number from 8092 to 8080 and
now it worked! My client can connect to the server! :-)

#11 Re: mORMot 1 » Access to MVC application from another device » 2019-03-19 15:45:51

I am running more or less to the same connection problem:

- on the same PC, client is able to connect to server
- with firewall on client cannot connect to server although the server has been added to the firewall rules.
   I have already run the server as administrator
- with firewall off client can connect to server

server code:     fHttpServerDefault := TSQLHttpServer.Create('8092', [fRestServerDefault], '+', HTTP_DEFAULT_MODE);

client code:     fRestClient := TSQLHttpClient.Create(fServerName, '8092', fModelDefault);  // fServername='192.168.1.xxx'

FYI, the sample Project04 works flawlessly.

Does someone have an idea what I am missing?

Thanks in advance.

#13 Re: mORMot 1 » Persist a TDocVariant object » 2018-07-04 22:35:45

Thank you very much for the help!!
That did the trick.

#14 mORMot 1 » Persist a TDocVariant object » 2018-07-04 17:18:45

wai-kit
Replies: 2

Hi all,

Can anybody help me with this?
How do I persist a TDocVariant object to a file?
Let's say I have this code:

aTemplate:variant;

TDocVariant.New(aTemplate);

aTemplate.Subject := 'some Subject';
aTemplate.Description := 'some Description';

// Persist aTemplate to file ...something like SaveToFile(someFileName);

Any help in the right direction much appreciated.

Cheers,
Wai

#16 mORMot 1 » How to find out persistence layer in TInjectableObjectRest? » 2017-12-19 10:37:36

wai-kit
Replies: 2

Hi all,

I understand that it is possible to refer to the persistence layer in the implementation class of an interface when derived from
TInjectableObjectRest, through property Server.DB in case Server is TSQLRestServerDB. In this case the database is a SQLite3 database file?

When used with an external database server (VirtualTableExternalRegister), can I still refer to Server.DB (in TInjectableObjectRest)?
Also when the Rest server is of type TSQLServerRemoteDB, how do I find out the type of the database server?

Any pointers in the right direction much appreciated.
Thanks in advance.
Wai

#18 mORMot 1 » Type mismatch when using generated mORMotClient and TSQLTableToGrid » 2017-12-06 15:44:41

wai-kit
Replies: 2

Hello fellow mORMot users,

I get a type mismatch error when using TSQLTableToGrid.Create with the REST client from the GetClient function
in the generated mORMotClient unit. I guess it is not the way to use the cross-platform units?

I am using the NewPascal distribution.
Any help in pointing me in the right direction is much appreciated.

Cheers,
Wai

#20 mORMot 1 » my mORMot MVC web application journey » 2017-09-13 11:12:25

wai-kit
Replies: 2

Hi,

I am trying to find out how to make a web application with mORMot MVC, by trying out sample 30 and going through the documentation.
The findings of my journey I am putting in this forum so members can comment on. Please do not regard any questions as dumb as I am just trying
to get a clear picture of the workings of the framework.

I hope to create a how-to from this thread so others can also benefit from, in their mORMot journey and is not meant as a replacement of the SAD :-)

What I have understood so far is, in order to make a mORMot MVC webapp one needs to:
- create the Model. The model inherits from TSQLModel and comprises of TSQLRecord classes as described in the documentation 'Framework Software Architecture Design'.

- create the ViewModel/Controller:
  - define an interface inherited from IMVCApplication. The methods of this interface comprises the actions/functionalities of the webapp.
  - when a method passes data to a HTML (template)file the name of this HTML (template)file must be the same as the method. (is this Case Sensitive??)
  - create a class to implement the interface. This class must be derived from TMVCApplication.
    - When not passing any data (through parameters) to the views for page rendering, one can use the methods GotoView/GotoError/GotoDefault to populate
      a TMVCAction record for rendering by an appropriate View. These methods are class methods in TMVCApplication.

- create the View:
  - create HTML (template)files that represents the Views of the webapp. These template files must reside in a folder called Views.
     In these HTML files, Mustache tags are incorporated so the mORMot Mustache implementation can generate the appropriate HTML webpages
     for the user of the webapp.
  - Mustache tags in a template file corresponds to the parameters of the interface method that implements the action/functionality of the webapp.
  - use web design software to create the views.

- create the 'plumbings' of the server:
  - create the Database.
  - create the REST server from TSQLRestServer. This REST server is started by the ViewModel/Controller.
  - create the HTTP server.


Questions:
- In sample 30, ORM TSQLRecord classes are tightly incorporated. I think using the ORM is the most efficient way, but is it possible not to use the
   ORM? When not using ORM to pass data to Mustache, JSON can be used to pass the data? This goes also for data being submitted from the Views?

- To create a mORMot MVC webapp, at least one need to? (feel free to complement this list):
  - know how to read data submitted from the Views.
  - know how to pass data to the Views
  - understand how to glue together the Model, Database, TSQLRestServer and TSQLHttpServer
  - know some HTML

Thank you all for your patience and any constructive feedback is much appreciated.

Cheers,
Wai

#21 mORMot 1 » How do I initialize new object with values from server, the ORM way? » 2016-12-20 16:21:48

wai-kit
Replies: 1

Hi,

I am trying to figure out how to create a new object in the client with values initialized from the server.
Some help much appreciated.

Merci!

#23 mORMot 1 » EZSQLException ("SQL Error: Too many connections") ... » 2014-02-04 14:47:20

wai-kit
Replies: 1

I was wondering what happens with a database connection (TSQLDBConnectionProperties, in my case a TSQLDBZEOSConnectionProperties) if a server timeout occurs?

I get these exceptions after my server has been up for some time (5 to 6 hours):  EXC       EZSQLException ("SQL Error: Too many connections") at 006870F8  stack trace API ...

In the log I see that timeout has happened (' ... call      TServiceFactoryServer(00D55E50) Deleted SiMServer instance (id=21) after 125000 ms timeout (max 60000 ms') a couple of times.
Can it be that the database connection is not closed properly when a timeout occurs?

Cheers,
Wai

#24 Re: mORMot 1 » TDataset.Filter is not implemented? » 2014-01-20 17:45:56

Cool. Works like a charm!
I am porting an existing Datasnap application to Mormot and for now it suffices.

Merci beaucoup!!

#25 mORMot 1 » TDataset.Filter is not implemented? » 2014-01-20 15:18:33

wai-kit
Replies: 2

Hi,
I want to filter on a TDataset that I got from JSONToDataset, but the dbgrid that is connected to this dataset, is not filtering. Am I doing something wrong,
besides filtering on the client side?

So, I have the following:

DBgrid.datasource.Dataset := JSONToDataset(Self, ...);
DBGrid.datasource.filter := 'Firstname="a*"';
DBGrid.datasource.filtered := true;

It this possible with TSynSQLTableDataSet?

Merci,

Wai

#26 mORMot 1 » How to change Date Format in DateTime field? » 2014-01-07 09:59:58

wai-kit
Replies: 1

Hi everyone,

How do I change the format in a datetime field in results returned from ISQLDBRows.FetchAllAsJSON? The datetime fields
returned to my client have the date format, 'mm/dd/yyyy' and I would like to change that to 'dd/mm/yyyy'.

Cheers,
Wai

#27 Re: mORMot 1 » Client Driven objects not working » 2013-12-30 17:15:42

So, now what I did is to add an extra routine (called Ping) to my interface. 
In my client, when a call to Ping fails, the client instance and the interface is freed so I can create again.

#28 Re: mORMot 1 » Client Driven objects not working » 2013-12-30 15:31:23

Oops!
In my case, I just have a few clients connecting to the server. If it was a couple of hundreds (or more) I'd start worrying.

IMHO, I think auto reconnection to the server is a good choice, assuming that the server has already cleanup the old session. It is then 'transparent' to the user
of the client.

#29 Re: mORMot 1 » Client Driven objects not working » 2013-12-30 12:25:38

I have this situation where a client connects (sicClientDriven) to the server (to consume a interface based webservice) and possibly stays idle for a couple of hours resulting in a timeout at the server.

What is the best thing to do in this case?

I tried to free the client (TSQLHTTPClient) and create a new instance, but then I get an Acces Violation when I try to use the interface.

Just did some RTFM :-) and did the following:
Release the interface by setting it to nil and call client.ServiceRegister() again.

For testing purposes the TImeout is set to 1 sec. In the log I see 'client instance not found or deprecated' and now when the client needs data it starts a new connection to the server.
So far so good ...

#30 Re: mORMot 1 » Change Password » 2013-12-28 15:32:45

Unfortunately, I still get these exceptions when stepping through my server code and it doesn't take more than 10, 15 secs to have the exception raised.
I downloaded a Nightly Build today.

#31 Re: mORMot 1 » project SynDBExplorer not compiling, Syntax error. » 2013-12-26 13:06:45

Hi Delphinium,
I have removed the [] already and its compiling. Just thought that I mention it to Arnaud.

#32 mORMot 1 » project SynDBExplorer not compiling, Syntax error. » 2013-12-26 10:24:15

wai-kit
Replies: 3

I get an error at line 279 in unit SynDBExplorerFrame, Too many actual parameters.
Downloaded the latest NightlyBuild.

#33 Re: mORMot 1 » Zeos 7.2 with Firebird 2.5.2 on external server » 2013-12-25 13:37:32

The same question has been on my mind, concerning access to a remote MySQL server using TSQLDBZeosConnectionProperties.

#34 Re: mORMot 1 » OFF-TOPIC: Merry christmas... » 2013-12-25 09:09:39

Fijne Kerstdagen to all Mormots!!

#35 Re: mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-12-23 11:54:51

Update.

The initialization code in ZdbcMysql was not executed, so I added this unit in the uses clause of SyndbZEOS. Now the code is executed and causing
Getdriver(Url) to return a driver and the exception not being raised.

Question now is, in case of a Mormot using ZEOS to access a MySQL database, does it make sense to create the driver in TSQLDBZEOSConnectionProperties.URI(dMySQL, 'libmysql.dll')?

#36 Re: mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-12-23 10:34:02

changed mysql to mysqld-5. No succes.

Traced the execution into ZDbIntfs.
The callstack looks something like this :
...
SynDB.TSQLDBConnectionProperties.ExecuteInlined
PrepareInlined
...
eventually into

function TZDriverManager.GetConnectionWithParams(const Url: string; Info: TStrings):
  IZConnection;
var
  Driver: IZDriver;
begin
  Driver := GetDriver(Url);
  if Driver = nil then
    raise EZSQLException.Create(SDriverWasNotFound);
  Result := Driver.Connect(Url, Info);
end;

the exception is raised because Driver = nil

I set a breakpoint in the initialization part of ZdbMYSQL.pas, but this breakpoint never gets referenced.
Also this unit is not in the uses clause of SynDBZeos.

#37 Re: mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-12-22 14:21:51

Hi EgonHugeist,

some answers to the questions:
1. using TSQLDBZEOSConnectionProperties from the Mormot framework I have not set the protocol name anywhere.

Then I made a new project using TZConnection component. The following properties of the component were set:
Hostname, database, librarylocation, user, password. I then tried to set connected to true and I got the error: Requested database driver was not found. Then the property
Protocol was set to Mysqld-5 and the connection succeeded.

So, now I need to find out why property protocol is not set or has a wrong value when using TSQLDBZEOSConnectionProperties to connect to the database.

#38 Re: mORMot 1 » install and Testsql3 Errors » 2013-12-19 08:35:33

Did that and all the tests ran successful.
Merci.

#39 Re: mORMot 1 » install and Testsql3 Errors » 2013-12-17 13:15:07

I also get the ESynException, when running TestSQL3 with the latest sources (today downloaded) in Delphi XE. The SQLite3 engine used is 3.7.14.1

#40 Re: mORMot 1 » Client monitoring session timeout or disconnection » 2013-12-17 11:22:16

Arnaud, so when the connection is lost with the server the best recovery is simply to connect again?

#41 Re: mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-12-17 11:18:08

Okay.
I made sure all libmysql.dll are the same. Compile target and dll is the same.
I also made a console version of the Mormot server and I also get the same EZSQLException. I traced it into the following code:

constructor TSQLDBZEOSConnection.Create(aProperties: TSQLDBConnectionProperties);
begin
  inherited Create(aProperties);
  fDatabase := DriverManager.GetConnectionWithParams(
    (fProperties as TSQLDBZEOSConnectionProperties).fURL.URL,nil);
  fDatabase.SetAutoCommit(true);
  fDatabase.SetTransactionIsolation(tiNone);
end;

And the exception occurs at fDatabase := DriverManager.GetConnectionWithParams( ...) . Setting up a watch at fProperties (I assume fProperties is assigned the value of parameter aProperties)revealed that
LibLocation is assigned the right location of the libmysql.dll.

#42 Re: mORMot 1 » How to implement a TSQLRecord descendant w a property of TObjectList ? » 2013-12-10 13:18:36

Hi Arnaud,

This one sounds stupid (hope I am not wrong), but is there an example of an implementation
of data sharding (in terms of CRUD operations)?
I have changed my TObjectList to a dynamic array. TListPlayer = TObjectList<TSQLPlayer>; is now changed to TListPlayer = array of TSQLPlayer;

I assume this is the correct way, but my ORM update fails .i.e. calling fMormot.Update   (where fMormot is a TSQLRestServer).

My code looks like

    TSQLGame = class(TSQLRecord)
     ...
     published
         fPlayers:TListPlayer;
     end;


    aGame := TSQLGame.CreateAndFillPrepare(fMormot, 'GameIdentifier=?', [aGameIdentifier]);
    try
      if not assigned(aGame) then
        aStatus := cstStatusGameNotFound
      else begin
        aPlayer := TSQLPlayer.CreateAndFillPrepare(fMormot, 'ID=?', [aPlayerID]);
        if not assigned(aPlayer) then
          aStatus := cstStatusPlayerNotFound
        else begin
          aStatus := aGame.AddPlayer(aPlayer);       <<<--- adds a TSQLPlayer object to the array fPlayers
          if aStatus <> cstStatusGameIsFull then begin
            if fMormot.Update(aGame) then begin      <<<--- this returns false!

Hope this picture is clear.

#43 Re: mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-12-03 18:09:43

smile, I might as well ask it here. Maybe it will be of use for my fellow Mormots smile.
I have 2 versions, a windows service and a 'normal' executable. The normal executable can find
the libmysql.dll, but the windows service can't.

What I can remember if when the dlls are incompatible I get a different exception.

#45 Re: mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-12-03 09:47:26

the dll is in the same directory as the Windows service executable.
I also tried with the dll in the system path. To no avail. Also tried changing the user of the service.

It looks to me that the problem is not so much the dll, but that the service cannot find the dll.

#46 Re: mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-12-02 14:10:48

I change :   fDatabase := TSQLDBZEOSConnectionProperties.Create(TSQLDBZEOSConnectionProperties.URI(dMySQL, 'libmysql.dll'),
                                                fDatabaseProperties.DatabaseName,
                                                fDatabaseProperties.Username,
                                                fDatabaseProperties.Password );

to

  fDatabase := TSQLDBZEOSConnectionProperties.Create(TSQLDBZEOSConnectionProperties.URI(dMySQL, 'C:\libmysql.dll'),
                                                fDatabaseProperties.DatabaseName,
                                                fDatabaseProperties.Username,
                                                fDatabaseProperties.Password );

and making sure libmysql.dll is in 'C:\' but I still get the Exception.

#47 mORMot 1 » A Mormot, ZEOS, MySQL and a Windows service ... » 2013-11-28 14:51:03

wai-kit
Replies: 19

Hi,

I have a  mormot server with a connection to a MySQL database. The connection looks like this

TSQLDBZEOSConnectionProperties.Create(TSQLDBZEOSConnectionProperties.URI(dMySQL, 'libmysql.dll'),
                                                DatabaseProperties.DatabaseName,
                                                DatabaseProperties.Username,
                                                DatabaseProperties.Password ).

When I run this server, a windows executable, my corresponding windows client can connect to it. Everything
works accordingly, I can fetch data from the server. The client is implemented with TSQLRestClientURI.
I can connect to the server and fetch data from it.
However, when I implemented the server as a Windows Service, I got an EZSQLException with message 'Requested database driver
was not found' when fetching data from it. Connecting seems no problem.

The code for the windows service looks like:

procedure TServiceSiM.ServiceExecute(Sender: TService);
var
  aSimServer:TSiMServer;
begin
  // create the server and initialize
  aSimServer := TSiMServer.Create('888', false);
  try
    aSiMServer.SetDatabase('localhost', aDatabasename, aUsername, aPasswd); // sets database properties for TSQLDBConnectionProperties

    // start the server
    if aSimServer.StartServer then begin
    // create a hold up while service is running
      while not Terminated do begin
        Sleep(1000);
        ServiceThread.ProcessRequests(false);
      end;
    end;
  finally
    FreeAndNil(aSimServer); // stop server by destroying the instance
  end;
end;

TSimServer=class(TMormotServer)
...
end;

TMormotServer is a class in which a TSQLRest, a TSQLModel and a TSQLHttpServer is encapsulated. The procedure SetDatabase sets the database properties to be used
for the TSQLDBConnectionProperties.

Anybody has an idea?

Thanks,
Wai

#48 Re: mORMot 1 » How to define a published field as not null? » 2013-11-28 14:49:47

Okay. Then I have to find the solution it in Delphi.
Thank you for the answer.

#49 mORMot 1 » How to define a published field as not null? » 2013-11-26 17:10:58

wai-kit
Replies: 2

Hi,

I could not find this in the SAD, but how do I define a field as being not null? To define a field as unique, I would specify
'stored false' when defining a published property.
Someone?

Thanks,

Wai

#50 Re: mORMot 1 » How to implement a TSQLRecord descendant w a property of TObjectList ? » 2013-11-13 08:40:16

I think I've read everything about it in the SAD, but probably missed something while searching for TObjectList in the doc. This topic is somewhat
related to http://synopse.info/forum/viewtopic.php?id=1372?


Off topic, but here is something for you :-) http://www.thestupidstation.com/home/im … nd-Marmots.

Board footer

Powered by FluxBB