You are not logged in.
AB,
I am thinking about a setup which could be more secure against hacking. Normally there is a client which initiates a websocket connection to the server and calls some service/interface published by the server. I would like to change one thing: it would be the server publishing the services initiating the connection.
This is the scenario:
- there is a frontend server with no knowledge at all about how to connect to the backend --> if hacked there is no information stored about the backend server.
- it is the backend server which initiates a websocket connection which the frontend uses to access data via interfaces/services.
- this way we could have a backend server storing the high value data with no open port to mess with.
mORMot seems to be not too far from this kind of usage. Do you think this is something I could do in the near future?
Cheers,
Leslie
"What do you call "infra app"?"
One that makes use of the classes defined inf the dddInfraApps unit.
I am looking for a sample app to test DDDAdmin with. AdministratedDaemonServer is never called from any sample. I guess this means there is no available demo for DDDAdmin to connect to.
AB,
I could not find any sample for an infra app. The best would be a working infra demo as a linux daemon. Maybe someone already has something worth looking at.
Cheers,
Leslie
Hi,
I could not find any info on how to ensure referential integrity with mORMot.
Can someone point me to the right direction?
Thanks,
Leslie
AOG,
Maybe there is a slight misunderstanding here. What I meant was creating the code to interface OpenUI5 with mORMot in pascal using SMS. It could be a better fit for Delphi/FPC programmers who are recluctant to get into the depths of JS. It could make locating problems easier or adding their own work.
It seems the SMS team is getting more envolved : http://smartmobilestudio.com/news/
AOG,
You seem to write a lot of JS code. Would it not be better to use SMS? It would allow Delphi/Lazarus programmers to join.
Anyway, Great work!
Leslie
Any news on the UI front? OpenIU5 , Framework7 ...? I am looking for a production ready UI solution to be used with mORMot.
AB,
Do you consider SMS to be stable enough to be used with mormot? (The none UI part)
The PHP format is not that far from json. The major differences seem to be:
- the name -value pairs are separated by ";" instead of ":"
- there is a metadata prefix included everywhere. Eg
- for both the name and value : <datatype>:<datasize>
eg: JSON : {"aName":"aValue"}
PHP: {s:5:"aName";s:6:"aValue")
- for the collections/arrays : <a>:<element_count>
eg a:5{ ... }
This is the the syntax to be used:
String
s:size:value;
Integer
i:value;
Boolean
b:value; (does not store "true" or "false", does store '1' or '0')
Null
N;
Array
a:size:{key definition;value definition;(repeated per element)}
Object
O:strlen(object name):object name:object size:{s:strlen(property name):property name:property definition;(repeated per property)}
String values are always in double quotes
Array keys are always integers or strings
"null => 'value'" equates to 's:0:"";s:5:"value";',
"true => 'value'" equates to 'i:1;s:5:"value";',
"false => 'value'" equates to 'i:0;s:5:"value";',
"array(whatever the contents) => 'value'" equates to an "illegal offset type" warning because you can't use an
array as a key; however, if you use a variable containing an array as a key, it will equate to 's:5:"Array";s:5:"value";',
and
attempting to use an object as a key will result in the same behavior as using an array will.
I have no control over the php code on the server side. I just need to access the data in the database created by php serialization in my pascal code.
ab,
Is there a deeper level entry point to start from for an alternate serialization? Is it a far strached attempt to create one if time is on short supply right now?
I am looking into mORMot's serialization if there is an easy way to create a custom serialization for this. Some guidelines/examples could be useful. ![]()
Hi,
This is not a strictly mORM-ot related question, but could be seen as possible feautre request. ![]()
Is there any library to work with standard PHP serialized strings? This is how the serialized data looks like :
a:5:{s:8:"pa_meret";a:7:{s:4:"name";s:8:"pa_meret" ....
Leslie
Thanks
Hi,
when a class needs to be mapped to the database does it have to start with TSQL or is it enough to be a TSqlRecord descendant?
Leslie
Thanks
ok. thanks
Thank you!
With Delphi 10 and a few days old trunk the fish facts demo does not load any records and when trying to post a new record it fails with an error.
Quite promising. ![]()
1. Some of the sources have NEXTGEN diectives. Is full NEXTGEN compatibility on the horizon?
2. Is the FPC support fully working/stable?
3. Is this meant for FPC with Android target?
4. Smart Mobile Could be an other possible target. ![]()
Does the websockets implementation work with browsers or Smart Mobile projects?
Hi,
I am trying to share an existing firebird db via mORMot to mobile clients. is there any automated way to create the model from database?
Leslie
Thanks, I will have a look.
Now I can describe the problem more precisely:
ApplyUpdates works with direct connections, but it does not with remote connections.
Thanks. ![]()
Hi,
The last changes in the github trunk are 7 months old. Did this go any further? Has anyone created a real world standalone android application with mORMot?
Cheers,
Leslie
I mean no rushing at all, but I need to make a choice now how to proceed and your opinion about this suggestion would be helpful.
One way is to implement this how I see fit based on my limited knowledge of mORMots inner workings, but it would mean branching the frameworks source. Which is not the preferable choice.
Or if it requires only so little change in the source as it seems you could commit the proposed changes the way you see fit.
I think there is a simple way to extend mORMot with the ability to use common tables, which are much readable for complex queries and would make recursive queries possible as well. Should also work with the NexusDB #temptable format.
Have not tested it yet, but it should only require a little change in the SQLFromSelect function, plus a few more method signature needs the extra parameters added with an empty string default value.
NEW PARAMS:
CommonTablesExpr selects the records to work with instead of the whole table, therefor it must have a table with IDs of the records.
IDTableName is the name of this table.
WITH RECURSIVE
...
IDTable(ID) as (...)
function SQLFromSelect(const TableName, Select, Where, SimpleFields, CommonTablesExpr, IDTableName: RawUTF8): RawUTF8;
begin
if Select='*' then
// don't send BLOB values to query: retrieve all other fields
result := 'SELECT '+SimpleFields else
result := 'SELECT '+Select;
// << CODE CHANGE START >>
if CommonTablesExpr<> '' then
result := CommonTablesExpr+' '+result+' FROM '+TableName+' JOIN '+ IDTableName + ' ON '+TableName+'.ID='+IDTableName+'.ID '+SQLFromWhere(Where)
else
// << CODE CHANGE END >>
result := result+' FROM '+TableName+SQLFromWhere(Where);
end;
If having two ID fields in the query is a problem for some db engines it may need an other name in the IDTable (eg _ID, ID_ ... ), or an other parameter for the ID field name, or use the tablename.fieldname syntax. There is no proper validation for the new params yet.
Hi,
We have quite a few tables with resursive data. Sqlite handles recursive queries, but have not found anything about it on the ORM level in the docs or in the source . Does the framework handle this? (Something like TSQLRecordRecursive ...) If not is there any workaround?
I need to slow down and look more carefully. It is still not working for me ... will have an other look.
Hi,
ApplyUpdates does not work. Looking at the code the IProviderSupport interface for update is not implemented.
function TSynDBSQLDataSet.PSUpdateRecord(UpdateKind: TUpdateKind;
Delta: TDataSet): Boolean;
begin
result := false;
end;
This is what I suspected and I think this is a serious issue.
Maybe there is a more secure and balanced way to go about this: Instead of versioning the records it is better to make it possible to identify the Transactions ( or Unit Of Work ... whatever makes the changes atomic). Every record changed by a transaction receives the same Transaction_ID. It makes incremental replication possible. It could go one by one. Or for better performance: for one replication "transaction" only as many regular transactions are selected that it can be read and written within a reasonable time. The whole replication may take longer, but ensures atomic behavior during replication and responsiveness for both master and slaves. It seems reasonable for me to combine it with audit logging. The same history could be used for both. It is much more efficient to calculate the size and content of the replication transactions in advance as the change log is being created. When the replication occurs every step is readily available.
I am reading the docs about this now.
But the original questions remain:
1. does the replication as currently implemented guarantee that the slaves are in a consistent state at any given moment when its data can be accessed?
2. if yes, are there any potential performance issues to be aware of? Eg like longer write locks?
These are important questions when designing the architecture. ![]()
I think I have made myself misunderstood.
Currently all my test are with Delphi XE8 (Windows XP & Ubuntu +Wine). That is where TClientDataSet.ApplyUpdates did not work. The rest of the comment was addressing the original question. Luckily the solution does not require detailed understanding of mORMot, so most of us could probably implement it. I need to rush with my evaluation of mORMot, so I do ask quite a few questions, while working my way though the documentation, but I would prefer to leave you to the tasks which require your level of understanding of the code, patterns and concepts. Later on I might be able to implement a few missing things myself. ![]()
1. I am wondering if the slave databases are always in a consistent state? Is it possible that a previously committed transaction on the server effecting several tables is only partially replicated yet when a query request comes in for the slave from its client.
2. How does locking work while replicating? Does it require a longer write lock when there is a lot of new data which may starve readers?
I have checked this a few days ago with the mORMotVCLTest sample and ApplyUpdates did not persist the changes. After refreshing the original values remained.
I the SynDBMidasVCL TClientDataSet is declared as TBufDataset for FPC. What needed here is to have a TBufDataset descendent implementing ApplyRecUpdate to apply the changes via the Mormot Client.
We have static data preferred to be stored locally as well. Is there a way to tell mORMot to use a local engine for certain fields?
TSomeRemoteSQLRecord = ...
ThisIsStoredLocally : TSomeSQLRecord;
It does not solve the UI binding. TCollection has a private TList<> field. Copying the Class definition and creating a public property to access it may do the trick. ![]()
TRecordReference is a great addition to mORMot. By now it is stored as 64bit integer, but the implementation remained tied to the index which makes it unusable in many situations.
Adding a Table_ID class field to the TSQLRecord class and using that instead of the index should be a safe implementation. Having a system table in the database storing the name of the tables with the Table_ID could be used to check at model creation if the Table_ID in the class definition is the same as in the database. If not there could be several options to handle the situation like using the Table_ID value from the db ...
Using TCollection might be a good thing after all. I just need to figure out how to bind it to the UI.
I think I am getting the picture now. ![]()
Currently I am exploring UI binding with sharding. The generic TList<> can be bound with live binding. In the example I have found TCollection is used for list properties. Can it be used with TList<>? If not is it a big addition to make it possible to use it?
Hi,
1. I am wondering if the JSON/ Binary JSON datatype of Postgesql is fully compatible with mORMot sharding?
2. If it is: is there something extra need to be done to create a field with the proper datatype and indexes the mORMot way?
AB,
6. NGINX reverse proxy is an interesting idea. There was no noticeable speed difference when the mORMot websocket server under wine was accessed directly and when through the native Linux NGINX.
I hope to be able to migrate completely to FP and Linux one day, but the Windows server + wine combo is the likely way for us to start. There are other technologies which are available only for Windows now. Performance seems good so far. I will know more about stability after stress stressing.
It would be nice to have a feature matrix about what is available/planned for the supported platforms. We need to stick to the technology which can be used with mobiles.
AB,
Thanks for your answers.
1. I have been using Elevate Web Builder for a while. V2.0 has some sort of RTTI. I will check if it is suitable to integrate with mORMot.
2. ASFAIK Zeoslib droped Kylix support after 7.0. Is it possible to connect to external databases like PG?
3. I am looking for some solution for websockets and call back functionality for Android and IOS. I hope to gain some speed benifit from it as well.
a) Phonegap has websocket plugin. Is callback interfaces a big step from there? (I might attempt to implement it.)
b) I will try your bidir socket, but if it does not work out sgcWebsockets client can be an other way to get it done.
c) If Websocket is working for FPC client is callback interfaces a big step from there?
4. It turned out that the virtual machine needed some more memory to finish linking. The crossplatform client works fine with XE8.
5. I am surprised by this story. I have found the CT people quite polite on their forums.
6. Currently I am testing mORMot compiled with XE8 under linux with wine. The only issue so far is that sometime the response time can be up to 5-8 times more with a very simple test case when the same request is sent to the server in every 500-5000ms. IOCP implementation seems incomplete for wine. Even if it was complete stability is a big question.
Hi,
I have been keeping an eye on mORMot for a few years. The latest improvements (crossplatform, websockets, the way the interface based callbacks are implemented, live replication ...) made it the most promising contender for my next project and hopefully more. I am in the phase of exploring, testing and benchmarking.
XE8 : Win32
Android
(IOS)
CodeTyphon 5.30:
Kubuntu 14.04
Win32
Android
(IOS)
mORMot latest from GitHub
A few questions:
1. IOS is also planned target, but cannot test it yet. What are prospects for the client/embedded server being production ready for mobile?
2. mORMot server for Linux?
3. Websocket support is not crossplatform yet. I would count on it for mobile clients as well. What can we expect/hope for?
4. The XE8 linker fails for Android target with an unusal errror:
E2597 terminate called after throwing an instance of 'St9bad_alloc'what(): std::bad_alloc
5. CodeTyphon compilation is broken (v5.30)
6. The closest thing to IOCP on Linux is EPOLL. Is it on the radar?
The more I dig into mORMot the more impressed I am. If the latest improvements become production ready it will have all the features in a single product I was looking for. Which is amazing in the Delphi-Freepascal world. The documentaion is very useable as well.
Thansk for this great product,
Leslie