#351 Re: mORMot 1 » How do I load a file into the body of a http-request » 2020-08-11 17:11:17

tbo

I create the email data with the Indy components TIdMessage and TIdMessageBuilderHTML. This is very simple. I send this data with a slightly modified version of the function SendEmail() from the unit SynCrtSock.

idMessage := TIdMessage.Create(Nil);
try
  idMessage.Subject := 'New Mail';
  idMessage.From.Name := 'Hallo2020';
  idMessage.From.Address := 'mail@hallo2020.com';
  idMessage.Recipients.EMailAddresses := 'your@gmail.com';
  idMessageBuilder := TIdMessageBuilderHTML.Create;
  try
    idMessageBuilder.Html.Text := StringFromFile('EMail.html');
    idMessageBuilder.Attachments.Add('Data.pdf');
    idMessageBuilder.FillMessage(idMessage);
  finally
    idMessageBuilder.Free;
  end;
  
  idMessage.SaveToStream(strStream);
  SendEmail(..., strStream.DataString) 

With best regards
Thomas

#352 Re: mORMot 1 » ORM, SynDBZEOS, Firebird Datetime params [SOLVED] » 2020-07-29 16:50:47

tbo

Maybe Arnaud changes the function DateTimeToSQL() a little bit like this:

function DateTimeToSQL(DT: TDateTime; WithMS: boolean=false; HasTimeChar: Boolean=true): RawUTF8;
const
  TIME_CHAR: array[Boolean] of AnsiChar = (' ', 'T');
...

And replace 'T' with TIME_CHAR[HasTimeChar]

With best regards
Thomas

#353 Re: mORMot 1 » ORM, SynDBZEOS, Firebird Datetime params [SOLVED] » 2020-07-29 09:25:36

tbo

The function DateTimeToSQL() internally uses DateTimeToIso8601(DT,true,'T',WithMS). So the result will always have a "T" between date and time. In your case you have to call DateTimeToIso8601() directly with the correct parameters.

With best regards
Thomas

#354 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-17 12:52:25

tbo
sakura wrote:

It seems to have to do with the SynCommons.MoveX87 method.

I have replaced "MoveFast := @MoveX87" by "MoveFast := @System.Move" and the error still remains.

I have tested version 1.18.5999 and there is already the error. The error depends on the constellation shown in the incoming posting.

Bis bald...
Thomas

#355 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-14 14:37:20

tbo

Hallo!

array81 wrote:

I tried to compile demo 30 both in debug mode and release mode with Delphi 10.4 and it works without error.

Interesting! Did you mean compile, or compile and run? My Delphi 10.4 Professional Patch 1 only installed the Spring4D and DSharp libraries. No other tools or libraries are installed. Maybe you can better isolate the error and provide Arnaud with more information.

Thank you for your support.

PS: Sorry I forgot to mention that I create Win32 programs.

With best regards
Thomas

#356 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-13 11:06:08

tbo

Hallo!

Thanks for the work. Unfortunately, the problem is not solved. The error occurs both in my program and in the example "30 - MVC Server" (only in RELEASE build).

It's no problem for me. I can continue working with older Delphi versions. If other users report bugs related to Delphi 10.4, you should keep the problem in mind. From my past experience I should have known better, never trust Delphi x.0 versions. But I couldn't resist the new LSP feature.

Thanks again for the time you invest in mORMot.

With best regards
Thomas

#357 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-12 13:58:08

tbo
ab wrote:

Isn't any line number in the stack trace?

Unfortunately I get no line numbers displayed. I rarely use the debugger and I don't need more than F7, F8, F9. Let me try it this way.

This is the line (54217) in my version of the "mORMot.pas" unit where the problems start.

case ValueType of
  smvInteger, smvCardinal, smvInt64:
    if TJSONCustomParserRTTI.TypeNameToSimpleBinary(

And since the error only occurs with the addition of the parameter "pmArticleID: TID", it might even be a useful result.

Then I continue with F7 and F8:

> TSynAnsiConvert.AnsiBufferToRawUTF8()
> TSynTempBuffer.Init()
> TSynAnsiFixedWidth.AnsiBufferToUTF8()
  Source: 'TID'#8'¸e', SourceChars: 3, NoTrailingZero: False
> TSynTempBuffer.Done()
> SynCommons.FastSetString(), line number 21211
  --> MoveFast()

After that I cannot continue working in the IDE. It stands still. I have to abort the process.

Hope this helps. If I can help in any other way, please ask.

With best regards
Thomas

#358 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-11 19:54:55

tbo

Thanks for your help.

When I do a DEBUG build with Delphi 10.4, there is NO error! When I do a RELEASE build, I get the following error message:
000000000000C757  ! EXCOS EAccessViolation (c0000005) [] at 53b770 SynCommons.MoveX87  stack trace API 6f133a mORMot.TInterfaceFactory.Create 6f0504 mORMot.TInterfaceFactory.Get 86cd44 mORMotMVC.TMVCApplication.Start 8867c3 u_VGServerMain.TVGServerMain.Create 886d29 u_VGServerDaemon.TVGServerDaemon.Start
000000000004B051  ! EXCOS EAccessViolation (c0000005) [] at 53b770 SynCommons.MoveX87  stack trace API

Fatal exception EAccessViolation raised with message Zugriffsverletzung bei Adresse 0053B770 in Modul 'VGServer.exe'. Lesen von Adresse 001A4000

The error occurs only when I add the parameter "pmArtikelID: TID" to the function in the example. Otherwise it also works with Delphi 10.4 in RELEASE build.

With Delphi 10.3.3 it works with the DEBUG and the RELEASE build.

If I can do more, please say so.

With best regards
Thomas

#359 mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-11 11:54:59

tbo
Replies: 49

Hallo!

mORMot 1.18.6085, Windows 10

I have a strange problem with mORMotMVC and Delphi 10.4. The problem can also be seen in example "30 - MVC Server". It crashes after takeoff.

Immediately after starting my server I get the following error message: Fatal exception EAccessViolation raised with message Zugriffsverletzung bei Adresse 0053B770 in Modul 'VGServer.exe'. Lesen von Adresse 001A4000.

In my program I can reproduce the following behaviour.

This function declaration works:
procedure ArticleBuy(var pmvIsUserLoggedIn: Boolean; out pmoSelectedArticle: TSQLArtikel);

The error comes when I change the function declaration as follows:
procedure ArticleBuy(pmArtikelID: TID; var pmvIsUserLoggedIn: Boolean; out pmoSelectedArticle: TSQLArtikel);

The behaviour can only be observed under Delphi 10.4. Under Delphi 10.3.3 it still works without problems.

I find following entry in log file:
000000000000DEF3  0 trace u_VGServerMain.TVGSRestServer(02f4ba50) BeginCurrentThread(THttpApiServer) root=Shop ThreadID=3f94 ThreadCount=15
000000000000DF4E  ! EXCOS EAccessViolation (c0000005) [] at 53b770  stack trace API 57d63e 40b56c 77d25224 77d12b26 6f133e 6f0508 86cd54 8867db 886ced 895117 77bd0419 77d066dd 77d066ad
000000000000DFCD  !  +    u_VGServerMain.TVGSHttpServer(027bbb10).Destroy

With best regards
Thomas

#360 Re: mORMot 1 » Does the arrangement of the fields influence the speed of the database » 2020-06-25 07:44:44

tbo

Hallo!

Thanks a lot Arnaud for the answer. Yeah, that was in the 1980s. That's when I started learning programming for private purposes.

With best regards
Thomas

#361 mORMot 1 » Commit 6068/6069 » 2020-06-25 07:34:40

tbo
Replies: 1

Hallo!

I haven't seen any changes in Fossil for Commit 6068/6069.
https://synopse.info/fossil/info/ba90b52b75b072d1
https://synopse.info/fossil/info/20fef34d52f8c084

With best regards
Thomas

#362 mORMot 1 » Does the arrangement of the fields influence the speed of the database » 2020-06-24 14:22:06

tbo
Replies: 3

Hallo!

A long time ago, when the parents of many forum members were children themselves, it was said that the arrangement of the fields (field type) influences the speed of the database. Fixed length fields were inserted before string fields.
Therefore I have arranged fields like this: xID: TID, yID: TID, nameX: RawUTF8, nameY: RawUTF8...
Is this still the case today? And if so, which databases are particularly affected?

With best regards,
Thomas

#363 Re: mORMot 1 » Unit mORMotService does not compile, Delphi XE, mORMot 1.18.5480 » 2019-12-03 09:42:17

tbo

Hallo!

Works fine in Delphi XE. Thanks a lot Arnaud.

With best regards
Thomas

#364 mORMot 1 » Unit mORMotService does not compile, Delphi XE, mORMot 1.18.5480 » 2019-12-01 20:07:59

tbo
Replies: 2

Hallo!

Delphi XE
mORMot 1.18.5480

System.Pos() is defined as:
function Pos(const SubStr, Str: ShortString): Integer;
function Pos(const SubStr, Str: UnicodeString): Integer; overload;
function Pos(const SubStr, Str: WideString): Integer; overload;
function Pos(const SubStr, Str: RawByteString): Integer; overload;

Unit mORMotService: function RunCommand() in  line 1499, 1505 does not compile.

In Delphi XE function PosEx() is defined in Unit StrUtils.

With best regards
Thomas

#365 Re: mORMot 1 » Generics versions of RetrieveListObjArray » 2019-11-27 18:29:45

tbo

Hallo!

Sorry, I'm no help at generics. I started testing with Spring4D.
The following works for me.

type
  TSQLMyObject = class(TSQLCustomRecord)
  ...
  end;
 
  TSQLMyObjectList = class(Spring.Collections.Lists.TObjectList<TSQLMyObject>);

FDataList: Spring.Collections.IList<TSQLMyObject>;
 
procedure LoadMyObjects;
var
  tmpArr: TArray<TSQLMyObject>;
begin
  Client.RetrieveListObjArray(tmpArr, TSQLMyObject, 'ObjectID = ?', [0]);
  FDataList := TSQLMyObjectList.Create(tmpArr);
  ...
end; 

With best regards

#366 mORMot 1 » Generics versions of RetrieveListObjArray » 2019-11-27 11:59:37

tbo
Replies: 3

Hallo!

I'm just taking my first steps with generics (Delphi XE). My question: Can generic versions
of RetrieveListObjArray be included?

function TSQLRest.RetrieveListObjArray<T>(const aCustomFieldsCSV: RawUTF8): TArray<T>;
function TSQLRest.RetrieveListObjArray<T>(const FormatSQLWhere: RawUTF8;
  const BoundsSQLWhere: array of const; const aCustomFieldsCSV: RawUTF8): TArray<T>;

With best regards
Thomas

#367 mORMot 1 » Compiler errors when I undefined WITHLOG » 2019-04-06 11:09:27

tbo
Replies: 1

Hello,

if I undefine {.$define WITHLOG} in the file Synopse.inc, I get a lot of
compiler errors. There are some places in the source code where access
to SynLog was not enclosed by WITHLOG.

Delphi XE, mORMot: 1.18.4299

With best regards

#368 Re: mORMot 1 » Trouble with JSON and Double » 2019-03-29 14:14:48

tbo

Hello,

@mvp, thanks for your answer.
What you are recommending is what I am currently doing as a workaround.
But I think there's a bug after all. Otherwise I can explain the results in
my last example.

@ab, when I look at this test:
- {"TestDouble":"16.2E-2"}  => Wrong: Result 1,62

For me, the input value is parsed to 162 and then converted to a float value.
The decimal separator is simply ignored (is not taken into account). Otherwise
I cannot explain the result. If I test with {"TestDouble":"16,2E-2"} everything
is fine.

I don't know the JSON specification. But I can't imagine that specific country
settings should have an impact on the result. And there should be no difference
if a value is double quoted. Because without double quotes {"TestDouble":16.2E-2},
it works right. Maybe I'm just making a thinking mistake.
I hope I'm not too persistent with my questions.

With best regards

#369 Re: mORMot 1 » Trouble with JSON and Double » 2019-03-29 10:25:07

tbo

Hello,

thank you very much for the quick answer. But she doesn't solve my problem.
If I test it with your suggestion, the result will be wrong (Result = 162).

In my program I use TDocVariantData with the D[] property. When the double
values were empty after reading the JSON file, I searched for the error. I have
read the help again and the test functions in the source code. But whatever
combination I tried, the double quoted Double values from the JSON file
were wrong. After that, I did this little test scenario.

If I test this combination with your suggestion on my computer:
- {"TestDouble":"16.2E-2"}  => Wrong: Result 1,62
- {"TestDouble":"16,2E-2"}  => Ok: Result 0,162

I also tested it with Win 7 German and Delphi 2007. Same problems.
I think it's a problem with the decimal separator. The decimal separator on
my Windows system is '',''. But that's just my guess.

Thank you very much for your help.

With best regards

#370 mORMot 1 » Trouble with JSON and Double » 2019-03-28 18:04:50

tbo
Replies: 6

Hello,

I'm in trouble with JSON and Double.

Win10 German, Delphi XE, mORMot: 1.18.4299

var
  v: Variant;
  vo: TDocVariantOptions;
begin
  vo := [dvoReturnNullForUnknownProperty, dvoAllowDoubleValue];
  v := VariantLoadJSON('{"TestDouble":"16.2"}', @vo, True);
  ShowMessage(FloatToStr(v.TestDouble)); 

For the following inputs:
- {"TestDouble":16.2}  => Everything Ok, the value is Double
- {"TestDouble":"16,2"}  => Everything Ok, the value is Double
- {"TestDouble":"16.2"}  => This is where trouble starts. The result is 162

The problem is the double quoted Double value with DecimalSeparator '.'.
The existing JSON is formatted as described under point 3. I have no influence on it. 

How can I solve this problem?

With best regards

#371 Re: mORMot 1 » Query on connection timeouts and debugging » 2018-06-29 14:37:26

tbo

You can find the current version number in the file "SynopseCommit.inc".

#372 mORMot 1 » Commit https://synopse.info/fossil/info/9f38a5b066d03521 » 2018-03-15 14:15:13

tbo
Replies: 1

Hi,

/// binary access to an unsigned 32-bit value (4 bytes in memory)
TDWordRec = record
  case integer of
  0: (V: DWord);
  1: (L,H: word);
  2: (B: array[0..7] of byte);  <=== shouldn't it array[0..3] of byte?
end;

Is this commit okay?

Thanks.

#373 Re: mORMot 1 » Synopse mORMot Framework SAD 1.18.pdf is corrupted » 2015-04-28 18:05:19

tbo

I have tested some RTF2PDF converter. With my test document this online converter (https://online2pdf.com/fr/) has shown the best results. But I do not know if it meets your needs.

Best regards.

#374 Re: mORMot 1 » Synopse mORMot Framework SAD 1.18.pdf is corrupted » 2015-04-25 16:15:11

tbo

Do you know FreeOffice (http://www.freeoffice.com)?
FreeOffice is free for home and business use. It can create large PDF documents without problems.
SoftMaker has a wonderful Office-Suite. In my experience it is the best alternative to Microsoft Office.

Best regards.

#375 Re: mORMot 1 » Synopse mORMot Framework SAD 1.18.pdf is corrupted » 2015-04-20 14:56:05

tbo
esmondb wrote:

Which link are you using to download it?

I use this link: "http://synopse.info/files/pdf/Synopse mORMot Framework SAD 1.18.pdf"

I've downloaded the file with Firefox and Opera.

Error text: Invalid reference table (xref)

Best regards.

#376 mORMot 1 » Synopse mORMot Framework SAD 1.18.pdf is corrupted » 2015-04-20 09:28:07

tbo
Replies: 17

The PDF Help file "Synopse mORMot Framework SAD 1.18.pdf" is corrupted. You can not open it with Adobe Reader or with PDF-XChangeViewer.

Best regards.

Board footer

Powered by FluxBB