You are not logged in.
I don't see any NewPascal updates anymore.
Does this means the NewPascal is deprecated?
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 :-)
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)^;
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?
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.
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
Thank you for the information Ab.
Since the class is located in mORMotVCL does this mean that the class cannot be used in NewPascal?
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.
@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?
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! :-)
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.
Happy New Year, all.
Thank you very much for the help!!
That did the trick.
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
Nobody? Anybody?
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
okay. merci.
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
Merci, Arnaud.
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
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!
I think the most recent SAD is on this page : http://synopse.info/fossil/wiki?name=Downloads
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
Cool. Works like a charm!
I am porting an existing Datasnap application to Mormot and for now it suffices.
Merci beaucoup!!
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
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
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.
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.
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 ...
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.
Hi Delphinium,
I have removed the [] already and its compiling. Just thought that I mention it to Arnaud.
I get an error at line 279 in unit SynDBExplorerFrame, Too many actual parameters.
Downloaded the latest NightlyBuild.
The same question has been on my mind, concerning access to a remote MySQL server using TSQLDBZeosConnectionProperties.
Fijne Kerstdagen to all Mormots!!
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')?
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.
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.
Did that and all the tests ran successful.
Merci.
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
Arnaud, so when the connection is lost with the server the best recovery is simply to connect again?
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.
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.
, I might as well ask it here. Maybe it will be of use for my fellow Mormots .
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.
Yes, I did.
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.
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.
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
Okay. Then I have to find the solution it in Delphi.
Thank you for the answer.
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
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.