You are not logged in.
I think that DateTimeToSQL and DateToSQL functions (SynTable module) can help you to build proper where clause.
I don't know, whether it is the best way. I would be pleased to know an easier way ![]()
Oh, that's fine! TDoubleDynArray works totally good for me, thank you! ![]()
ah, thanks, it is pretty much the same as printed in LResult:
((4,94065645841247e-323, 2,91498731046335e-322, 5,43472210425371e-323, 3,4090529563046e-322, 5,92878775009496e-323, 3,90311860214585e-322))couldn't find ability to post a screen - the value of LObject is copied from local variables watch list
What is the LObject content?
LObject is just:
LObject := TJSONObjectWithArray.Create;The class is:
TJSONObjectWithArray = class(TSynPersistent)
private
FArrayOfFloat: TJSONArrayOfFloat;
published
property ArrayOfFloat: TJSONArrayOfFloat read FArrayOfFloat;
end;Or maybe I misunderstood your question... Can you specify, please, what do you mean?
I've faced some problem with deserialization JSON, which has a dynamic array of floating-point values inside one of the json-objects.
My JSON has a very complicated structure, but I'll provide here a simple example, showing my trouble.
TJSONArrayOfFloat = array of double;
TJSONObjectWithArray = class(TSynPersistent)
private
FArrayOfFloat: TJSONArrayOfFloat;
published
property ArrayOfFloat: TJSONArrayOfFloat read FArrayOfFloat;
end;
...
procedure TForm1.FormShow(Sender: TObject);
var
i: integer;
LJSON: RawUTF8;
LObject: TJSONObjectWithArray;
LDeserResult: boolean;
LResult: string;
begin
LJSON := StringToUTF8
('{"arrayoffloat": [10.387747, 59.377930, 11.388159, 69.377976, 12.388261, 79.377988]}');
LObject := TJSONObjectWithArray.Create;
JSONToObject(LObject, pointer(LJSON), LDeserResult);
if LDeserResult then
begin
LResult := 'Array: ';
for i := 0 to High(LObject.ArrayOfFloat) do
LResult := LResult + ' ' + FloatToStr(LObject.ArrayOfFloat[i]);
end
else
LResult := 'Deserialization error!';
FreeAndNil(LObject);
Memo1.Text := LResult;
end;The result values are nearby 0:
Array: 4,94065645841247E-323 2,91498731046335E-322 5,43472210425371E-323 3,4090529563046E-322 5,92878775009496E-323 3,90311860214585E-322The same result I get with type single (with lower precision).
But if I use integer dynamic array JSONToObject works fine:
TJSONArrayOfFloat = array of integer;Array: 10 59 11 69 12 79Delphi 10.3.1 64. Also checked this code with FPC but no luck.
Yep, that's working good, and constructor using looks even better than NewSQLHttpClient using
Thanks!
Well, maybe you are right - I'm not so experienced in such constructions.
But, anyway, in Delphi VCL the function works fine with the suggested code, and the original function fails with AV in inherited TSQLRest.Create(aModel: TSQLModel) constructor
I'm not insisting on updating your code
I've already created the copy of function and using it in my project - just worried about others, who can face the same problem
But I guess the global NewSQLHttpClient function still has the Access Violation issue.
I think you are right. I guess I found a mistype in NewSQLHttpClient function. There we have:
result := TSQLHttpClientRequest(TSQLHttpsClient).Create(aURI.Server, aURI.Port, aModel,
aURI.Https, AnsiString(aProxyName), AnsiString(aProxyByPass));I suppose, that there is some tiny mess with the brackets ![]()
The correct code should be:
result := TSQLHttpClientRequest(TSQLHttpsClient.Create(aURI.Server, aURI.Port, aModel,
aURI.Https, AnsiString(aProxyName), AnsiString(aProxyByPass)));upd: I've created a pull request for that
This is a very experimental SMS + F7 + mORMot
Compiled with SMS Basic Version (v2.1.0.3592)
Can anybody reshare this source code? the link does not work anymore ![]()
If not, analogous example would be very good, too. Please!
Glad to confirm that with old mORMot 2016/09/01 (https://synopse.info/fossil/info/ddc1dc391a173bfc) SMS examples work fine. Also tried 2016/09/15, but failed.
Now I can begin diging in mobile development. Thanks again, you are the savior of my professional enthusiasm ![]()
> Depending on what kind of mobile app you're looking, Elevate WebBuilder may be a good choose as well, it has a more finished UI controls to start with. For mobile where you want a complete control and you're not affraid of doing more work SMS is best.
I like control and more work was never problem for me, if the result is worth it. So, I hope that SMS is rather good for my start ![]()
Are you having a Delphi server side built in mORMot and client in SMS?
I have FPC server and several FPC desktop apps with ORM access. But I have no any mobile client yet.
That is the thing, I chose mORMot to migrate to, because I supposed (while reading docs) that it would be easiest way to cover mobile needs for my users (unfortunately I have no any valuable experience in that field). Nowadays I've finished redevelopment of my project, i've got much more possibilities and speedup with mORMot, but still can't make my mobile app ![]()
I think you could make it work by using latest mORMot for Delphi and older one for SMS, authentication and interface based request should work OK.
That's a great idea! I'll definitely try it as soon as possible. Thank you!
> SMS 2.2.2.4543 - got same errors in SynCrossPlatformREST.
Which ones, perhaps they're some easy to fix ones?
The same as in https://synopse.info/forum/viewtopic.php?id=4318 . Starting from:
Syntax Error: const parameter cannot have a default value [line: 804, column: 31, file: SynCrossPlatformREST]
on the line:
function Add(Value: TSQLRecord; SendData: boolean; ForceID: boolean=false;
const FieldNames: string=''): TID; virtual;Yes, I'm using fresh mORMot (and I'm affraid that I can't downgrade it so much because of using fresh Zeos). SMS 2.2.2.4543 - got same errors in SynCrossPlatformREST.
Nevertheless, thank you very much for your response!
Current (alpha) version of SMS doesn't work with mORMot but version from year ago is running fine (I use it myself daily).
Great! Can you name the version, please? I tried 2.2 (07.04.2016) - got same errors as in alpha or beta 3.0.
Hello, everybody!
I wonder if the whole chapter https://synopse.info/files/html/Synopse … ml#TITL_90 is worth to be deleted?
I spent a lot of time studing docs and forum and finally coudn't even get the SMS compiler, which can work with samples, delivered from mORMot.
You can use fpcupdeluxe to install only NewPascal FPC.
Then point CT towards this FPC.
Thank you, I'll try it. Can you prompt me how to "point CT towards this FPC" correctly?
I have special version of mORMot which is *almost* ready and compatible both with current FPC trunk and with next NewPascal release:
Thank you very much! Your special mORMot version seems workable for me.
@Vitaly
Why not use NewPascal ? That is trunk !
I use CT. Unfortunately, It uses fpc trunk. Everything was ok before yesterday's CT 6.0 release.
At the moment we need to wait
The problem becomes very actual for me. Is there any hope that it will be solved soon?