You are not logged in.
Pages: 1
Thank you for the explanation.
I understand that the ORM requires an integer RowID primary key even for external tables.
However, could you please provide a small example showing how to define a class that uses a varchar ID field together with this RowID integer key?
For example:
How should I declare the class in Delphi?
How to map the RowID to an existing integer field in my external MySQL table?
A short code snippet or schema example would help me understand it better.
I have a module that contains several classes mapped to database tables. When I use CreateMissingTables in mORMot, it creates the missing tables for the classes. However, there is an issue:
CreateMissingTables automatically adds an ID field to the tables it creates.
In my case, some classes already have an ID field defined as varchar, but CreateMissingTables still tries to add its default ID field as integer.
This causes a conflict because the table ends up with the wrong type for the ID field, or sometimes it fails to create the table correctly.
Goal:
I want CreateMissingTables to respect the existing ID fields in my classes and not automatically add an integer ID field, especially when my class already defines a varchar ID.
I have a function in SOA that contains 3 parts, each part performs an Add/Update on an entity (we have 3 entities).
In part 2, there is an entity that has a foreign key to entity 1.
In this function, we need to perform Add/Update on all 3 entities, but if a problem occurs with any of these entities, all the modifications made in this function must be rolled back.
What is the appropriate solution for this problem?
TSynUniqueIdentifierGenerator — in which unit is it located?
Is it possible to give me an example that explains how to use TRestBatch to insert 3 objects, where I need to get the ID of the first object and use it in the second object?
As part of a 3-tier architecture (SOA), I need to implement a business function that operates on three different ORM classes, each corresponding to a different table in the database.
My goal is to ensure data consistency by using a transaction: if an error occurs while saving any of the entities, I want all changes to be rolled back.
However, in mORMot 2, the TransactionBegin(Table, SessionID) method appears to support only one class at a time.
Therefore, I am wondering:
How can I manage a transaction that spans multiple ORM classes (tables) in mORMot?
Does using transactions in mORMot block other users from accessing or modifying the database during the transaction?
yes , i use it , how to fix ID instead of RowID
When I connect to an external database like PostgreSQL, when using the MultiFieldsValues function, it returns RowId instead of ID.
why
want to extract the elements that do not have a key.
is that possible?
I am using the Objects property of IdocList.
For example:
var dL: IdocList;
for var d: IdocDicts in dl.Objects('Name=', '')
I found that it skips the d objects that do not have a 'Name'."
It seems like you're trying to iterate through an IdocList and filter or process objects based on their 'Name' property, but the issue is that objects without a 'Name' are being skipped.
exampel :
var dcTest : TDcoVariantData
dcTest := Doc.InitArray([
Doc.InitObject(['test', 14]),
Doc.InitObject(['test', 41])
]);
who to check if the value of 'test' equals 41 in DocVariantData.
Pages: 1