Hi,
We currently use the following method to turn MSSQL returned data into binary for transmission through RemObjects. Is it possible to get raw data into binary from MSSQL faster than this method?
Would it be possible to build in a saveToBinaryStream/loadFromBinaryStream method directly into TMSQuery?
Also a saveToJSON would be very good as well, using the fastest JSON library available.
var
query: TMSQuery;
VirtualTable: TVirtualTable;
begin
  query := db.CreateMSQuery( ); //returns TMSQuery
  query.SQL.Text := 'select * from [table]';
  query.open;
  result := binary.create;
  VirtualTable := TVirtualTable.Create(nil);
  VirtualTable.Assign(query);
  VirtualTable.saveToStream( result );
  VirtualTable.free;
  query.free;
end;
			
									
									
						TMSQuery to/from Binary & JSON
Re: TMSQuery to/from Binary & JSON
I just noticed Microsoft SQL Server 2016 will support direct output of data to JSON like it does XML. Therefore the to JSON feature might not be required but would be nice to see it built in anyway to support older versions of SQL using a Delphi JSON formatter, and SQL 2016 + using the inbuilt returned JSON data
			
									
									
						Re: TMSQuery to/from Binary & JSON
Try using methods TBlob.SaveToStream and TBlob.LoadFromStream for transmission of field value as raw data. For example:
See more details about the Tblob class in SDAC documentation: https://www.devart.com/sdac/docs/?devart.dac.tblob.htm
			
									
									
						Code: Select all
  MSQuery.Open;
  ...
  MSQuery.GetBlob(FieldName).SaveToStream(AStream);
  ...
  MSQuery.GetBlob(FieldName).LoadFromStream(AStream);Re: TMSQuery to/from Binary & JSON
Hi azyk,
You don't understand my question/code sample.
We want to turn the entire returned result set/dataset into a binary format, not just a single field.
We want to do this in the fastest possible way...
			
									
									
						You don't understand my question/code sample.
We want to turn the entire returned result set/dataset into a binary format, not just a single field.
We want to do this in the fastest possible way...
Re: TMSQuery to/from Binary & JSON
Currently, in the TMSQuery dataset there are no methods for saving query results in JSON or binary formats. You can leave a suggestion at our UserVoice page: https://devart.uservoice.com/forums/104 ... components . If the suggestion collects enough votes, we will consider the possibility to implement it.