#1 Re: mORMot 2 » I want to ask a question. I tried to use ORM but could not get the dat » 2023-12-01 00:59:00

ab wrote:

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.

#2 mORMot 2 » I want to ask a question. I tried to use ORM but could not get the dat » 2023-11-30 15:50:44

wuhao13
Replies: 2

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?

Board footer

Powered by FluxBB