You are not logged in.
i want to use sql order by in CreateAndFillPrepareMany,but when i do this:
Role := TSQLRole.CreateAndFillPrepareMany(Client,'ID = ? order by DispOrder',[],[aId]);
an error occurred:
20171201 20163660 ERROR mORMotHttpClient.TSQLHttpClientWinHTTP(01736650) GET root returned 400 (Bad Request) with message { "errorCode":400, "errorText":"Bad Request" } stack trace API 0064002E 006F3D7B 006FE542 006FF111 006EBE58 006EC0FF 006EB0A6 007FDBE5 0073ECDB
20171201 20163660 EXC EModelException {"Message":"TSQLRole.CreateAndFillPrepareMany(): FillPrepareMany() failure"} at 006EB0D0 stack trace API 0063E09F 0063E0C8 0040AE7C 77D56D4B 77D56BD7 006EB0D0 007FDBE5 0073ECDB
20171201 20163660 EXC EModelException {"Message":"TSQLRole.CreateAndFillPrepareMany(): FillPrepareMany() failure"} at 006EB0D0 stack trace API 0063E09F 0063E0C8
20171201 20163660 info mORMotHttpClient.TSQLHttpClientWinHTTP(01736650) TSQLHttpClientWinHTTP.Destroy
20171201 20163660 EXC EModelException {"Message":"TSQLRole.CreateAndFillPrepareMany(): FillPrepareMany() failure"} at 006EB0D0 stack trace API 0063E09F 0063E0C8
20171201 20163660 debug mORMotSQLite3.TSQLRestServerDB(01706750) TSQLRestRoutingREST.Error: { "errorCode":500, "error": {"EModelException":{ "ClassName":"EModelException", "Address":"006EB0D0 ", "Message": "TSQLRole.CreateAndFillPrepareMany(): FillPrepareMany() failure" }} }
20171201 20163660 srvr mORMotSQLite3.TSQLRestServerDB(01706750) GET root/MyApp.GetPermissionTree SOA-Interface -> 500 with outlen=194 in 1595464 us
Offline
your ORDER BY statement seems to be correct. From the error message I guess it might doesn't related to the ORDER BY clause
Try remove "order by DispOrder" and try again to identify the source of the error first.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
remove "order by DispOrder", it will be ok.
Offline
20171201 21322244 EXC ESQLite3Exception {"ErrorCode":1,"SQLite3ErrorCode":"secERROR","Message":"Error SQLITE_ERROR (1) [select A.RowID AID,A.Name A00,A.Memo A01,B.RowID BID,C.RowID CID,C.Name C00,C.Leaf C01,C.View C02,C.IconCls C03,C.Expanded C04,C.RouteId C05,C.ParentId C06,C.DispOrder C07 from Role A,RolePermission B,Permission C where B.Source=A.RowID and B.Dest=C.RowID and (A.ID = ? order by DispOrder)] using 3.20.1 - near \"order\": syntax error, extended_errcode=1"} at 00757916
Offline
This is () hack
Role := TSQLRole.CreateAndFillPrepareMany(Client,'ID = ?) order by (DispOrder',[],[aId]);
Offline
I think that this is a bug
Offline
thank @ttomas! it works.
Offline