You are not logged in.
@mdbs99
I am referring, that as it will be a new version of the framework, there is not so much problem in changing the name of all classes to prefix with TSyn.
Many have already changed and the refactoring is inevitable.
I understand and agree what you said. Now is a great (maybe only) time to decide on the prefix. And Prefixing all types with TSyn is a good choice.
Your remark is purely rhetorical.
An official Delphi TOrm class won't be in SysUtils and other basic RTL units, so it won't affect our code.
It won't affect the mORMot code itself, but it affects we users of mORMot - because we might use both of those units.
Using a unified, short prefix for all types is a best practice that's been proven, to prevent existing and future conflicts.
As a strong example, If we use TSynTextWriter instead of just TTextWriter, it won't have been conflicted with System.Classes.TTextWriter.
ab wrote:We will write for instance with mORMot 2:
type TOrmBlogArticle = class(TOrm) ....
Would prefer this :
type TBlogArticle = class(TSynORM) ...I think I would prefer one common prefix for everything (TSyn* looks very good), for several reasons but mostly because in pascal, this has been the norm for libraries.
And you don't have to necessarily loose other prefixes, for example :
type TSynRecordRTTI = class(TSynRttiType) ...
I completely agree with you! `TSyn` for all types.
edwinsn,
Some frameworks/libs use the same prefix for all types (e.g. Indy, TMS, JEDI, DevExpress, etc) but, even though it could minimize eventual collision names, it's not perfect as anyone can use the same prefix as other already has used.
It could be very verbose either. Imagine typing TMormotTextWritter or TMormotOrm (!!).
Simple names are better to read, however it could have colision... difficult decison.
However, in my opinion, if the framework/lib uses an abstract prefix (e.g. Id, Jv, dx, etc), it must be in all types. That is consistency.
Yes, we shouldn't use a prefix that's too long.
ab wrote:I have made another pass or types renaming in mORMot 2.
It sounds consistent everywhere now.You may think renaming all TSyn* prefix too.
You remind me of some of the naming conflicts, such as TTextWritter - sometimes I have to use SynCommons.TTextWritter
My initial feeling is that, isn't mORMot follows the Active Record pattern? Then maybe record is easier to be understood?
OK, had to add a 'class helper' for TTextWriter, like the following:
procedure TTextWriterHelper.AddUtf8Line(const aLine: RawUtf8);
begin
self.AddString(aLine);
Self.AddCR;
end;Sorry, but it's still not clear to me if I can pass a RawUTF8 string to the AddLine method? It compiles, and is it really OK? Thanks!
@ab,
I noticed the `TTextWriter.AddLine` method is defined as:
TTextWriter.AddLine(const Text: shortstring)Why `shortstring` which is limited to 255 characters but not `RawUtf8`?
@ab,
A little issue with using the methods on the client side:
- Called ServiceRegister then ServiceDefineSharedAPI, mORMot will complain about 'interface already registered'.
- use ServiceDefineSharedAPI only mORMot will complain about 'interface not registered'.
- Use "TServiceFactoryClient(ServiceRegister(...)).ParamsAsJSONObject := True" will cause access violation
Not sure why. had to use the following code instead:
svcFactory := (Services['ApiForClient'] as TServiceFactoryClient);
svcFactory.ParamsAsJSONObject := True;
svcFactory.ResultAsJSONObjectWithoutResult := True;@ab,
I know, but I'm not discussing the OP's question, but my question is about the general master/slave replication feature of mORMot.
Or you can use ORM master/slave replication and use the server as slave database.
What happens if the master server is down during the process of syncing? Can it persist the pending data and restart the syncing?
PS, I remember I posted a similar reply yesterday but somehow it disappeared...
Use in-memory sqlite db instead - use :memory: as the db file name.
This thread is useful. For the same requirement (backward compatibility), I had to gone further than you #4 option - I resorted to method-based service - everything is JSON and you'll have to process it.
@ab,
slepp(10) + retry loop sounds like the only solution worth trying at the moment...
Thanks!
Are you able to open the file with a file viewer?
I guess the OneDrive file is not a real file, but a pseudo file, only accessible via the Internet Explorer.
Not sure about earlier versions of OneDrive, but recent versions of OneDrive is just like Dropbox, it's not a virtual drive but only a sub-folder of another physical drive such as D:\
I might didn't describe it clearly, but these kinds of issue only happens on occasional db files at occasional times - it not always happen. So yes, I can open those db files with other sqlite db file viewer, because the issues don't happen all the time.
Hello,
Update 1: Note, these kinds of issue happens on occasional db files at occasional times - it not always happen, but only sometimes.
Anybody experienced any kind of **occasional** issues that only happens when the SQLite database files are stored in OneDrive or Dropbox?
If **yes**, do you have any clue about how to fix the issue? Thanks!
The following is one of the problems I encountered:
exception class : ESQLite3Exception
exception message : Error SQLITE_IOERR (10) [DBOpen] using 3.32.3 with aDB=nil;main thread ($d50):
00d8b393 +2c3 Program1.exe SynSQLite3 3911 +30 TSQLDatabase.Create
00d9a1ee +06e Program1.exe mORMotSQLite3 800 +1 TSQLRestServerDB.Create
The db file is something like: C:\Users\X360\OneDrive\file1.db
Have you looked at this: https://www.yunqa.de/delphi/products/converters/index
Great! I think it's ok.
Thanks for the comment, ab, I forgot about that :0
But I guess it's better if mORMot support escaping, for example, '\%' won't be treated as a parameter.
Assume the TSQLRecord-derived class has a property called 'FileName'
This query clause:
FileName LIKE "%.%"As in
db.Retrieve('FileName LIKE "%.%"', [], [True], theRecord)Will fail (not raising errors but just don't return the correct result).
As a workaround I use 'InStr(FileName, ".")>0' insead, but it's an issue that needs to be fixed, I guess.
This thread is a good read, thank you guys! The systemd socket activation is really interesting, the start-on-demand nature is similar to that of the 'serverless' (eg, AWS lambda) hype.
Not sure if Window server has the similar feature?
Amazing work, ab!
You said "VFS is a lot of work" just few days ago, and you still finish it sooo quickly?
![]()
I guess I would perhaps add read-only compression of an existing database.
Do you mean after the db's compressed, it'll become readonly?
Thanks @utelle for the very insightful input! I guess @ab can benefit from it.
So far my impression is that a VFS layer is the way to go. I guess forking and adopting all upstream changes in the future will be a lot of work and more error-prone.
Is there any way to ask the original SQLite author for help?
A win-win, isn't it?
It seems to be a good thing if mORMot get sponsored!
curious why not use this kind of development earlier.
Every project has its own growing path ![]()
@Vitaly,
Alternatively you can use TStrings/TStringList as the published property type, you'll get JSON format in the db, and it doesn't have the 'CreateCopy' issue described here.
@ab,
I'm afraid it's still a bug?
But when being stored in the db, a field of type TRawUTF8DynArray is not in JSON format? Persisting in JSON format is required in my use case.
Hey! I've got one thing to add:
Do you plan to eliminate the use of the 'with' statement of the Object Pascal language?
Thanks.
After some debugging I wonder it might has something to do with TSQLPropInfoRTTIObject.CopySameClassProp?
@ab,
If you run this small test console project you'll get an EAccessViolation error
https://gist.github.com/edwinyzh/ea75bd … 3d59ee095f
The case is that a freeing a TSQLRecord-derived class which has a published property of type TRawUTF8List, created by CreateCopy, will cause the 'Access Violation' error.
Am I doing something wrong, is it by design, or is it a bug?
I'm using the latest mORMot rev:
https://github.com/synopse/mORMot/commi … 8b1605bf92
And the error also happens with previous versions.
I see, thanks.
Hello ab,
It seems that SynProject can generate html document out of .rtf files?
I did a quick look at the source code, trying to extract some re-usable code for converting rtf code to html code, but no luck.
Can you point me to the right direction? Thanks!
@ab,
I'm not using Linux yet, but THANK YOU! for your hard work and attention to detail.
Please be noted that fpcx64mm is **also for Windows** under FPC.
Mr. Bouchez,
You never cease to surprise us with your ability and fast speed!
Great! Just discovered it earlier.
It seems that there is a major change in licensing. I assume one can use the GPL license in a closed-source, commercial program?
@ab,
Thank you! I got it. mORMot is the BEST!
Hello ab,
Lets say I have a TSQLRecord-derived record whose string properties are defined as 'String'.
Now if I changed the source code and all 'String' properties become 'RawUtf8', will error happen when reading back the record data from SQLite db?
Thanks.
Thank you ab! The new `TSynLogFamily.ExceptionIgnorePerThread property` seems to be very helpful in such cases!
Great news!
I just discovered that HeidiSQL - a full-featured, open source database manager **written in Delphi** now supports SQLite since several weeks ago!
Github repository: https://github.com/HeidiSQL/HeidiSQL
Even over 8 years ago when it supports only MySql I know it's already very feature rich!
The best part is that it's written in Delphi so we Delphi developers can enhance it by ourselves.
Maybe add support for mORMot's remote SQLite db?
ok, worked it around using the good old approach - OnBeforeException - which is my little contribution ![]()
I ignores the exceptions by detecting the thread name.
But I still wish there is a global option for disabling TSynLog auto-capturing all the exceptions including those already wrapped by 'try...except', because even in the mORMot threads there are some exceptions I want to ignore...
@ab,
I looked at the code in TSynLog.DisableRemoteLog, but such approach doesn't seem will work in my case, because my 'SMTP remote logging' works like this:
1 - My EchoCustom will not directly send the log entries but just push them to a TSynQueue.
2 - Then another thread will pull from the log queue and send them through SMTP one by one.
The exceptions happens in step 2 is what I want to ignore by TSynLog.
Hello ab,
Few years ago I asked a question about how to make TSynLog on the server-side to ignore exceptions that happened inside a try...except block, and you opinion was that all exceptions should be logged.
Now I'm facing an issue that might change your view.
I have a log interception procedure (achieved via TSynLogFamily.EchoCustom) which emails out log entries through SMTP, and when the network is broken or something like that happen, never-ending logging will happen - TSynLog will log any exceptions happened in my "EchoCustom" procedure, and my "EchoCustom" will again trying to send that exception and another exception will happen due to the network issue.
I hope I described the issue clealry.
And a best solution for such cases would be to have an option to disable TSynLog (such as SQLite3Log) logging exceptions I want to ignore (using try...except without re-raising)
Thank you!
IIRC, some of the NewPascal features have been merged into the FPC trunk?
But the moment where my little linux service was visible with its first requests in RemoteLog under my Windows- workstation was incomparable!
Thanks for sharing your migration experience! What "remote logging" mechanism are you using? I'm recently thinking of logging from mORMot to sentry.io.