You are not logged in.
Pages: 1
Interesting, but maybe I'm loosing something here:
TRecordReference stores both the record ID (to identify the row) and the record type (to identify the table), is that right?
The record type is bound to the used model.
Well, in my case I wouldn't use such a solution because my model will expand and change over time, staying with the example above I would say that for example my model, at a certaing time, will include new log types, and maybe will drop some older ones.
But this is not the point.
The record IDs used by mORMot are Integers, am I right? I mean, there's something strange, Delphi Integers are 32 bit signed, while SQLite INTEGER PRIMARY KEY are 64 bit, so I'm not getting how things work.
So, is TRecordReference a 64 bit value of sort, something like 32 bit for table identification and 32 for row?
In any case how does this relate with the 64 bit INTEGER PRIMARY KEY?
There's something else that leaves me with some doubts, and it's about the first approach I described in the post: if I define a type called TSQLMyInterestingType(TSQLRecord), and then several:
TSQLMyInterestingAndBeautifuType(TSQLMyInterestingType)
TSQLMyInterestingAndFunnyType(TSQLMyInterestingType)
TSQLMyInterestingAndNiceType(TSQLMyInterestingType)
etc.
can I define another type, let's call it TSQLVeryImportantType(TSQLRecord), with a TSQLMyInterestingType property allowing me to "point" to any of the objects above? I mean: being children classes it should make sense, because it respect the general inheritance mechanism, but I don't know if it can work correctly inside the framework (well, as I wrote above, in this particular case I would also store the record type on another property, for querying purposes).
Forgive me for the elementary questions!
Hi everyone,
I'm doing some experiments with the framework and I would like to get an opinion about an idea I've came up with.
I'm going to code a project. The DB side is not very demanding, to be honest, but it's a good way to start. Mainly I've got two tables with a 1-to-many relationship between them, let's call them "users" and "logs".
Now, while "users" is a very basic kind of table, "logs" can contain a lot of different kind of things. I mean every single record is still a log, but every single record can store differnt kind of things.
Particularly, the stored things can change in time, so new type of logs will eventually be created over time, and myabe older ones will be dropped, who knows.
I've thought about 2 different approaches.
The first one is perhaps more "mORMottian", i.e.
1) define a class TSQLUser(TSQLRecord)
2) define a class TSQLLog(TSQLRecord)
3) define a TSQLUser property in the TSQLLog class (for the 1-to-many relationship)
4) define some kind of "LogType" property in TSQLLog class (to identify wich kind of log is stored in the TSQLLog property and eventually querying for specific kind of logs)
5) define various TSQLLog derived classes, like TSQLTemperatureLog(TSQLLog), TSQLSpeedLog(TSQLLog) and so on, to store the specific kind of logs (so every kind of log will have its table)
I think that this solution should be correct, but I also thought about a solution more similar to what I would have done some week ago, while facing the same situation, that is:
1) define a class TSQLUser(TSQLRecord)
2) define a class TSQLLog(TSQLRecord)
3) define a TSQLUser property in the TSQLLog class (for the 1-to-many relationship)
4) define a textual LogData property in the TSQLLog class and use it to store a serialized (JSON, YAML, or whatever) representation of the actual log
What's your opinion about that? Well, this is more a general DB oriented question, maybe you will be not very interested in it.
So, here is a more framework oriented question.
I see that JSON serialization is widely used by mORMot, and while thinking about the 2nd solution I though that I would have used the GetJSONValues on a TSQLRecord derived class to get a RawUTF8 representation of my data (I've tryed it out and it worked).
Is there any complemetary function? I mean, something to throw a RawUTF8 JSON representation to an onject and having it deserilized into its properties?
Thanks, every kind of suggestion will be appreciated!
Well, of course I'm not blaming anyone, I hope that my main question doesn't mean that I'm blaming anyone for anything, because I really feel grateful for having the oportunity to test such a powerful tool and posibly using it. Not jocking here, maybe this framework will save me tons of coding, so I really appreciate it.
Of course my point was a more generic one. I mean: I work on code since more or less 15 years, so I went trough a considerable amount of APIs and toolkits. In my experience there's a swet spot in considering a toolkit adoption that stands on "what I'm able to do with it, with no or little knowledge, in a day or so"...
Well, at least this is the time that I usually got to figure out if a framework is a viable route or not.
I know it's not much, but it's the way things goes in most company I've worked for. So, from that point of view, reading up to 1.4.7 of the SAD document means 200 pages, and without the titles it's not that easy figuring out where one should go.
Don't think I'm lazy, of course I will go trough a deep read of the documentation, once that the toolkit is recognized as a viable way.
But, if I can, without sounding bad, I would suggest that: the documentation is quite clear and immediate for the DB part, the shift from tables to objects and so on.
Maybe, having some similar "quick" introduction concerning the UI side of the whole thing, would help in getting started.
Having that said, contratulations for the huge work!
Hi,
it's my first post here and I'm playing a bit with mORMmot since a couple of days, so forgive me, because my questions are the questions of a first-time evaluating user.
I'm quite experienced in Delphi programming, and in the next months I will go trough a big project update wich involves writing some sord of DB server that will be used mostly locally to serve a number of clients applications accessing to the same DB and remote services.
I've not read the whole documentation (it will take a while to do so), but judginf from what I've read I think that mORMot can be the way to go.
Now, facing the real (i.e. far from ideal) world problem.
Like everytime I'm called to build something very quickly. Not the project I was talking about, but a client application (I should describe it as a device control system) that of course has it's DB.
I was able to get a local SQLite DB running quite quickly by using a TSQLRecord derived class and by lloking at the examples. But now I'm thinking about the UI side of the application.
I really can't rely on automated UI generation, because it's a device control system and it has nothing to do with the typical DB application, I must be able to create the controls with a high level of customizability. And here I'm lost!
I mean: I'm used the classic "drop a bounch of DB controls on your form, connect them, customize them, and you're done". So my question is, if I would like, for example, to display a list of records, am I supposed to read them manually by iterating over my TSQLRecord derived classes and to manually fill (always an example, of course) a TStringGrid of some sort?
Is there any quicker way to do it? Or, better question, what's the best practice to do it while staying true to the mORMot way of doing things?
Thanks a lot and best regards.
P.S. I've got a suggestion: the SAD document (what a terrible name! "SADness" is what I felt when I discovered it was 800 pages long! Ahahaha!) lacks a full PDF index, I mean: the navigation is really difficult, a real index (that can be kept opened on the side of the document) would be really useful.
Pages: 1