You are not logged in.
I encountered a problem. The code is as follows. I have not found the source of the problem. Can you guide me? thank you.
server := TRestServerFullMemory.CreateWithOwnModel([TOrmprovince]);
try
fProp := TSqlDBUniDACConnectionProperties.Create('MySQL?Server=127.0.0.1;Port=3306', 'ceshi', 'root', '123456');
fProp.UseCache := True;
if OrmMapExternal(server.Model,[TOrmprovince],fProp) then
Writeln('OrmMapExternal Success');
server.CreateMissingTables;
if server.Cache.SetCache(TOrmprovince) then
cou := server.Cache.FillFromQuery(TOrmprovince, '',['']); //cou=0 ???
Writeln(cou.ToString);
rec := TOrmprovince.Create(server.Orm,'name=?',['aaa']);
//rec is empty?Why is this happening?
Last edited by wuhao13 (2023-11-30 15:51:28)
Offline
Offline
There could be plenty of potential issues.
Try to debug a little more and see the SQL queries generated by the ORM, and why it returns no answer.
Mormot2 is really complicated. I tracked it and according to the code comments, if I want mysql to use ORM, do I have to inherit and rewrite some methods of TRestOrmServer? I can't find a demo of mysql for reference. Please give me some advice. Thank you.
Offline