#1 Re: mORMot 1 » NewTableFromRows columns types » 2020-10-25 06:11:45

Thanks Arnaud.
The problem occurs when I reload the data with firedac TBatchMove in the destination database : it complains about the format difference (text vs DateTime)

I guess my "mix" is not right

#2 mORMot 1 » NewTableFromRows columns types » 2020-10-24 22:33:24

halted
Replies: 3

Hi,

I am trying to export data from SQL Server to SQLite

I am using TOleDBMSSQL2012ConnectionProperties to  connect to the source.
I then use this code

  Query.Execute(psQryText,true,[]);

  SetLength(ColTypes, Query.ColumnCount);
  for idx := 0 to Query.ColumnCount - 1 do
    ColTypes[idx] := Query.ColumnType(idx);

  lpoConnExt.NewTableFromRows(psFileName, Query ,True,ColTypes);
  Query.Free;

The Query statement reads from a view.
The DateTime types are saved as text.

Is there a way to ensure the correct data types in the destination table ?

Best regards,

JM

#3 Re: mORMot 1 » Character encoding » 2019-12-18 22:17:45

Yes the Content-Encoding header was missing in the respose build by the server.

Many thanks for this awesome work !

#4 mORMot 1 » Character encoding » 2019-12-18 17:38:10

halted
Replies: 2

Hi,
I'm trying Mormot in a rest service context. The entry sends the result as stream.

I'm using

<Code>
...
Props := TSQLDBFireDACConnectionProperties.Create('MSSQL?Server=' + lsServerName ,lsDatabaseName,lsUserName,lsPassword);
...
  try

    Conn := Props.NewConnection;

    try
      Conn.Connect;
      Query := Conn.NewStatement;
      try
        lpoS := TMemoryStream.Create;

        Query.Execute(lsSql,true,[]);

        Query.FetchAllToJSON(lpoS,true);

        Result := lpoS;

      finally
        Query.Free;
      end;
    finally
      Conn.Free;
    end;
  finally
    Props.Free;
  end;

</Code>


The result is fine except for french accents :

{"RefValueId":8000000000050100062,"Label":"Négociateur GIE AC"},{"RefValueId":8000000000050100063,"Label":"Négociateur GIE AEC"}

Is there something to do to force character encoding ?

Database server is SQL Server 2012
Columns in database table are NVARCHAR(xx)
IDE is Delphi 10.3.3

Regards,

JM

Board footer

Powered by FluxBB