#2 Re: mORMot 1 » Mormot2 interface based service handle binary data cross platform » 2022-02-25 13:01:02

Alright. Thank you!
I would like to store the data as RawBlob in a database. Are there some functions in the mormot framework to handle base64 to RawBlob and RawBlob to Base64 conversion for storage in a TOrm class?

#3 mORMot 1 » Mormot2 interface based service handle binary data cross platform » 2022-02-25 12:06:33

florian
Replies: 4

Hello,

I define a procedure in a mormot2 interface based service like this:

procedure blobTest(const input: RawBlob; out output: RawBlob); //will accept and return binary format


Is there some way to make this work with a UTF-8 encoded BASE64 format instead, for access from a java (android) client?

#5 Re: mORMot 1 » TSQLDBSQLite3ConnectionProperties.execute variant error only on window » 2021-08-23 10:26:12

Seems to have something to do with the 'localtime' parameter in the sqlite datetime function.

procedure Test();
var connection: TSQLDBSQLite3ConnectionProperties;
    query1, query2: String;
begin
  query1 := 'SELECT datetime(current_timestamp,''localtime'');'; //works only on linux
  query2 := 'SELECT datetime(current_timestamp);'; //works on linux and windows

  connection := TSQLDBSQLite3ConnectionProperties
    .create(ExeVersion.ProgramFilePath+'Test.db','','','');
  try
      with connection.Execute(query1,[]) do begin
       if step then showmessage(TimeToStr(ColumnDateTime(0))); //ColumnDateTime(0) returns 0 on windows, works on linux
       ReleaseRows;
      end;
  finally
   connection.free;
  end;
end;  

Any ideas?

#6 Re: mORMot 1 » TSQLDBSQLite3ConnectionProperties.execute variant error only on window » 2021-08-23 07:38:27

Thanks.

But that's not it. I'm using FPC 3.2.0
If I use "tim" instead of "t" the problem persists.

#7 mORMot 1 » TSQLDBSQLite3ConnectionProperties.execute variant error only on window » 2021-08-22 21:16:19

florian
Replies: 5

I made a little sample procedure to illustrate my problem.
The following code works fine on Linux however on Windows I get an exception:"could not convert variant of type (Null) into type (String)"
I am using Lazarus 2.0.10 and the latest mORMot from github

procedure Test();
var connection: TSQLDBSQLite3ConnectionProperties;
    V: Variant;
    s: String;
begin
  connection := TSQLDBSQLite3ConnectionProperties
    .create(ExeVersion.ProgramFilePath+'Test.db','','','');
  try
      with connection.Execute('SELECT strftime(''%H:%M'',datetime(current_timestamp,''localtime'')) as t;',[],@V) do begin
       while Step do begin
         s := v.t; //could not convert variant of type (Null) into type (String) , only occurs on windows
         showMessage(s);
       end;
        ReleaseRows;
      end;
  finally
   connection.free;
  end;
end; 

   


What am I missing?

Board footer

Powered by FluxBB