You are not logged in.
Oops! Sorry for provided the non-standard method, that what came from my mind when I read your question ![]()
If your IServiceNote is supposed to be accessible in the clients, you can add a field of type TSQLRESTServerDB to TServicenote, and assign its value in the constructor, then in your AddNote() method you'll be able to access your REST DB SERVER.
Do you mean something like:
myNode := TSQLNote.Create;
myNode.Title := 'no title';
aServer.Add(myNote);?
Hi Ab,
Can the REST client in mORMot to be used (or extended in the future) like this github project, Delphi REST Client API, to consume standard REST serivces, such as Goolge API? Thanks.
Hi Arnaud, I assume even with the above mentioned two-way syncing implemented, we still have to take care of the IDs of the records not to be duplicated across offices, right?
edwinsn wrote:Does it mean once such a two-way syncing feature is implemented, I can have several databases synced with the very same set of data? I can help to test when it's added, what's your plan? Thanks.
Yes, this is the point.
But we won't use it directly this feature here, so testing will be welcome!I suspect we may be able to add this TRecordVersion per-node generation in a very short term.
Great! I'll monitor this thread to get updates. Thanks.
Yes, this is prepared for a future implementation.
The TSQLRestServer.InternalRecordVersionComputeNext function just need to be overriden with a timestamp + node suffix to have a monotonic multi-node version number.
There is just a limit of 58 bits, due to how TSQLRecordTableDelete.ID works.
Sounds like a good idea! Does it mean once such a two-way syncing feature is implemented, I can have several databases synced with the very same set of data? I can help to test when it's added, what's your plan? Thanks.
Congratulations on the new replication feature!
Two questions if you don't mind:
1 - For the "Corporate Servers Master/Slave Replication With Private Local Data" mode, are the two arrows in the graph have wrong directions? Shouldn't it look like this (notice the two red arrows I added):
2 - I think one drawback of the master/slave replication mode is that the slave should be "read-only" to avoid duplicated version numbers. I'm not sure if I understand it correctly, but can we make this feature becoming two-way syncing by using different prefix for the server-wide TRecordVersion properties? For example, for rest server A in office A we use 1 as the version number prefix, while rest server B in office B has prefix of 2, and vice versa.
Hi Arnaud,
The latest revision works without this problem. Thanks!
The executed SQL is something like
TSQLAccount.CreateAndFillPrepare(Self, 'ORDER BY AccountType, UserName'); and I don't think there is anything special......
Hi Arnaud,
I was having this EAccessViolation with an older version, so I updated my copy of mORMot yesterday. While it's Ok on my Win7 64bit on a physical box, but the error still happens at least in two environments according to my tests:
1 - a win8 64bit in a virtual box.
2 - a Win7 32bit in a Virtual Box.
Additionally, another test was on another physical which runs Win 8.1 64bit and the same error happened.
I wish you can help. Thanks.
date/time : 2015-04-01, 15:10:27, 623ms
operating system : Windows 8 x64
processors : 2x Intel(R) Core(TM) i5 CPU 760 @ 2.80GHz
physical memory : 1246/2048 MB (free/total)
compiled with : Delphi XE4
callstack crc : $005eb437, $d7f9a897, $e910b5c5
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 774A753C in module 'ntdll.dll'. Write of address 00000010.
main thread ($598):
774a753c ntdll.dll RtlQueryPerformanceCounter
006c56f7 Program1.exe SynCommons 38120 TPrecisionTimer.Pause
00a4559b Program1.exe mORMotSQLite3 747 TSQLRestServerDB.GetAndPrepareStatementRelease
00a473ec Program1.exe mORMotSQLite3 1238 TSQLRestServerDB.MainEngineList
7749ddb6 ntdll.dll KiUserExceptionDispatcher
008243bb Program1.exe mORMot 33928 TSQLRestServer.EngineList
00813988 Program1.exe mORMot 28691 TSQLRest.ExecuteList
0081154f Program1.exe mORMot 27930 TSQLRest.MultiFieldValues
00809b2a Program1.exe mORMot 25575 TSQLRecord.CreateAndFillPrepare
00ba8d8c Program1.exe DataStoreClient 139 TDataStoreClient.LoadAllAccounts
......
00543c58 Program1.exe System.Classes StdWndProc
768493cc user32.dll DispatchMessageW
006898bf Program1.exe Vcl.Forms TApplication.ProcessMessage
00689902 Program1.exe Vcl.Forms TApplication.HandleMessage
00689c3d Program1.exe Vcl.Forms TApplication.Run
00e17b47 Program1.exe Program1 231 initialization
7701495b KERNEL32.DLL BaseThreadInitThunkBy the first version do you mean URL-encoded parameters? According the document provided by Arnaud above, it seems the URL parameters are only considered if the body content of your POST is empty. If you use the body content of the POST method, the format has always to be JSON. I think this is a adequate design, your "first version" is similar to INI files, and it will not be able to express some complex contents. JSON is THE format for transferring web data nowadays.
@ab, noted. Thanks for your effort!
I'm waiting for all tests to pass
Hi Arnaud, since I always use the latest github repository and I don't run the tests locally, it occurred to me that, do you commit when not all tests pass? If yes, would you add something like 'all tests pass' or 'not all tests pass' for each commit? So that one will know which revision to use. Thanks for your effort!
Good job! We'll see how to use it when an example is provided.
Hi Arnaud,
SQLite's "INSERT OR UPDATE..." statement (https://www.sqlite.org/lang_insert.html) is very handy as we don't need to check the existence of a record, and another benefit is avoiding unnecessary network round trip in a C/S environment.
I did a GREP into the mORMot source tree, I assume there is not a equivalent method yet? If no, can I make a suggestion ![]()
Update: Well, I misunderstood the AddOrUpdate() method in mORMot - it's NOT the equivalent of the "INSERT OR UPDATE" SQL statement in SQLITE. Sorry.
Hi Arnaud,
I'm at the stage of evaluating using the MVVM mechanism provided by mORMot, if I go ahead, I'd rather spend time on more useful things, like making mORMotMVC.pas to have an option of always loading files from disk, so that one can tweak and test the html/css/js in realtime without having to restart the program.
It's an example, using bootstrap or other css framework is not important for the purpose of demonstration.
I want to restrict connection from local web browsers only, after some research, I found one solution - overwrite
THttpServer.Process()and check
self.RemoteIpMy question is, it'l be better to handle that in my TMVCApplication-derived class, something like if the client is not 127.0.0.1 nor localhost, redirect to access-not-allowed.html. Is this possible? Thanks.
Update 1:
One more possible solution: Overwrite
TSQLHttpServer.Request()But I'm not sure is it possible to get the client IP in this method...
IMHO http://semantic-ui.com/ as two advantages over bootstrap:
- It's syntax is sematic!
- It's built-in themes (several of them) are much good-looking .
Re. the questions raised by delphiancoder (ie. not always loading files from disk), I suggest to add a boolean property to TMVCViewsMustache called CacheFiles, eg:
TMVCViewsMustache.CacheFiles: Boolean, to indicate if the files should be cached vs. always loading from the disk.
Hi,
during my tests I noted that changing the blog.css file (to reduce title and text sizes) nothing changed until kill and run the server runtime again. So I suppose the files are readed on startup and anything stay in ram. reading from inside the database will add no speed, I suppose. Arnaud, is this correct ?
I did a quick look, yes, in TMVCViewsMustache.Create() the engine loads all the .html and .partials files into memory. I think it should offer an option to always load the view files from the real source.
I also suggest to add an event so that we can intercept the loading of the view files, something like OnLoadViewFileContent(aViewFileName: string: var aContent: string);
Hi Arnaud,
Just checked out the '30 - MVC Server' example along with the MVC secctions in the document, I really like the convention over configuration concepts, which is time saving in coding the program.
I noticed that the view files (.html, .partial, .css, etc) are retrieved from a disk folder. What should I do if I want those files to be loaded from BLOB fields of a DB? Thanks.
I came across it today, it's open source and written in Qt, most importantly, it very powerful (from my first impression).
Great! Thanks!
Hi Arnaud,
For situation like a POS system I described above, a mORMot server usually serves less than 10 PC clients - Do you think it's sufficent to use SQLite (instead of real DB system like MS SQL Server) as the underlying databse in situation like that?
I remember you mentioned other people is using mORMot/SQLite to serve a lot of data and a lot of client PCs, but I couldn't find that info... Thanks.
Hi Arnaud,
We have ToClientDataSet(), can we have a FromClientDataSet()?
ab, Thanks for your answer!
Hi friends,
Imagine we have 10 POS system running standalone, and at the end of the day all the sales data will be synced to the master server at headquarter for building analysis reports.
That means we have 10 databases of the very same table structure, and ALL the data from those 10 databases will be synced to a SINGLE master database at the end of the day.
Obviously we cannot use the default primary key (ID) generation in mORMot, because we should avoid duplicated Ids in the master database. So what will be the correct way of avoiding duplicated ID?
One option I can think of is manually assigning record Ids, and each record ID has a unique DB server ID. But I suspect there are simpler solutions? Thanks.
Thanks.
Thanks for info, Arnaud, they make sense! I'm especially want the linux support in the future versions of Delphi.
Hi Arnaud,
I might be wrong, but I assume supports also Kylix will cause a lot of IDEF's, is there a reason to still support a project that's dead for ten years?
This seems to be very interesting.
I'm just looking for the best approach for a scenario where maybe I can't have the HttpServer and the database in the same computer (VM) because of clones of VM httpServers are launched on demand automatically.
You might consider PostgreSQL - I haven't used it, but from what I have read on Hacker News in recent years, PostgreSQL is getting better and better, two big things I remember are 1) full text search enhancement, and 2) enhanced support for JSONB (document-based storage, think MongoDB!)
And it'll be interested to see how you implement that load-balance-controlled booting of your web servers. Which cloud provider you are planning to use?
Good news Arnaud, I see the bright future of mORMot for FPC on Linux. The last time an EMBT sales representative asked me what would make me upgrade to the latest Delphi, I said Linux support for the non-GUI stuff might be interesting, now it seems that we almost have full support for FPC ![]()
I haven't a chance to develop for Linux yet, but it'll be great if you then have a blog post for tips and steps on how your setup your development environment for Linux ![]()
@gm, I don't have done any test, but mORMot just feels fast than enough to me in my experiences.
we rely on FPC for our Linux support, which is a must have for our own hosting now - and for a lot of our users.
Hi Ab, are you already using the FPC/LINUX version of mORMot now for production?
Hi ab, this may sound like a dumb question, but is it possible to use WiredTiger in a way like using Sqlite - use it's binary and mORMot interface with it?
My first time hearing about WiredTiger, from the github stars, it doesn't seem to be very popular, but you must choose it over others for some good reasons ![]()
And I thought similarly to the Monkey http server.
And happy new year!
圣诞快乐! To Arnaud and all others!
You are so quick, AB!
Hi Arnaud,
It seems that TSQLRecord.CreateCopy doesn't copy published properties of type TStrings?
Hi Arnaud, so even without transaction support, with this remote SQL execution feature, you just made SQLite a real multi-client database server, at least for Delphi programmers ![]()
I'm quite satisfied with the PDF version with SumatraPDF.
HI Ab, with the recent changes, the ID is of type int64 now, so looks like I can use unified IDs (primary key) for multiple tables now!!??
There have been a lot of new things in the past two months.
But nothing that would not be identified at compile time IMHO.
Thanks! Updated to the latest source, with several minor modifications!
Thanks for the quick fix!
so I'll be upgrading to the latest rev. The mORMot source I'm using is 2 months old, I assume the latest source does not break backward compatibility, right?
Hi Arnaud,
SynDBExplorer returns no result for the EXPLAIN statement? Thanks.
Thanks Arnaud.
The HTML version of the document is great! Now I can utilize the Google search engine ![]()
Hi Arnaud,
Assume my program is already working with some TSQLRecord derived classes, all have string, integer, float and TDateTime fields.
if I change them to inherit from TSQLRecordFTS4, will all old functionalities still work? I mean, if non-string fields still working after changing to FTS4?
What I want is keep the old functions working, but plus some FTS functions provided by FTS4.
Thanks!
Alfred,
>1) what is the system you are compiling on ?
>2) CodeTypon version ?
I'm not using CodeTyphon, but the latest Lazarus:
Lazarus version: 1.2.6
Lazarus svn revision: 46529
Lazarus build date: 2014/10/11
Lazarus was compiled for i386-win32
Lazarus was compiled with fpc 2.6.43) what is your target system ?
Target OS is win32 (I'm using win 7 64bit, but I don't think it's a problem).
Target CPU family is default
Target processor is default.
Changed values in Synopse.inc:
{.$MODE DELPHI} // e.g. for asm syntax - disabled for FPC 2.6 compatibility
{$define NOSQLITE3STATIC}Let me know if you need more info.