Return binary data via RFC - abap

I want to return binary data in ABAP, for example a PNG image file.
Which data type should I use? string, xstring, ...?
I use the PyRFC SDK: https://github.com/SAP/PyRFC

xstring
Sidenotes if you have large data:
max size of an xstring is 2GB (depending also on profile parameter ztta/max_memreq_MB)
If you use an internal table of xstrings (e.g. dictionary type XSTRINGS_TABLE), dynamic memory allocation is easier because it will not be requested in one go, as is the case for a flat xstring

Related

protocol-buffers: string or byte sequence of the exact length

Looking at https://developers.google.com/protocol-buffers/docs/proto3#scalar it appears that string and bytes types don't limit the length? Does it mean that we're expected to specify the length of transmitted string in a separate field, e.g. :
message Person {
string name = 1;
int32 name_len = 2;
int32 user_id = 3;
...
}
The wire type used for string/byte is Length-delimited. This means that the message includes the strings length. How this is made available to you will depend upon the language you are using - for example the table says that in C++ a string type is used so you can call name.length() to retrieve the length.
So there is no need to specify the length in a separate field.
One of the things that I wished GPB did was allow the schema to be used to set constraints on such things as list/array length, or numerical value ranges. The best you can do is to have a comment in the .proto file and hope that programmers pay attention to it!
Other serialisation technologies do do this, like XSD (though often the tools are poor), ASN.1 and JSON schema. It's very useful. If GPB added these (it doesn't change wire formats), GPB would be pretty well "complete".

Setting maxJsonLength property for USQL Newtonsoft JSON extractor

I'm using USQL for Azure data lake project and my input is in JSON format and I'm extracting each line and converting it back to JSON tuple. But the issue is some string lengths are bigger 102400 and Newtonsoft JSON extractor defaults to 102400 maximum length and this is causing failure on these records. Is it possible to change maxJsonLength property to bigger value to handle these large inputs? I found a property MaximumLength in Newtonsoft.Json.XML file inside assemblies, but it is also not working.
Any suggestion is highly appreciated.
Please note that U-SQL currently has a string data type size limit of 128kB (in UTF-8 encoded data). So even if you increase your Newtonsoft properties, you may run into that limit. Can you provide more information on what you are exactly doing and what the exact error message is to provide you more concrete answers?

Vb.NET Insert Image File to Picturebox and store it to database.mdf

I have a table which have image data type in one of the colomn
, I try this code,
first, is this a right code to insert one row of the table?
Me.DatasiswaTableAdapter.Insert(NISTextBox.Text, NamaTextBox.Text, KelasTextBox.Text, JurusanTextBox.Text, Jenis_KelaminComboBox.Text, Tanggal_LahirDateTimePicker.ToString, AlamatRichTextBox.Text, FotoPictureBox.Image)
if yes then I need to know why the image type is change to byte? and
how to insert the image from picturebox if the format of the code is
a byte?
then if no please let me know the right code
Sorry for my bad English :)
Thanks
the net-informations link you posted should be very helpful if you study it.
it means a)the column you want to store the image to in SQL server must be defined as image. If you are using a different DB such as Access, depending on the version you might need to define it as Object or something similar. b) in the example, the image is converted to a stream (using image.save) then the stream to a byte array for storing in the DB.
you may want to store a bit more information about the image. getting it back to an image will just be the reverse (db -> byte array -> stream), but you are not going to know whether it was JPG, PNG, TIFF etc. If you think you will ever want to recreate it as a disk file in its original format, store the MIME type as well.

How to write to a file in Go

I have seen How to read/write from/to file using golang? and http://golang.org/pkg/os/#File.Write but could not get answer.
Is there a way, I can directly write an array of float/int to a file. Or do I have to change it to byte/string to write it. Thanks.
You can use the functions in the encoding/binary package for this purpose.
As far as writing an entire array at once goes, there are no functions for this. You will have to iterate the array and write each element individually. Ideally, you should prefix these elements with a single integer, denoting the length of the array.
If you want a higher level solution, you can try the encoding/gob package:
Package gob manages streams of gobs - binary values exchanged between an Encoder (transmitter) and a Decoder (receiver). A typical use is transporting arguments and results of remote procedure calls (RPCs) such as those provided by package "rpc".

How do I reference a TEXT type in Informix 4gl?

I have the following code in a 4gl module:
DEFINE f_drec RECORD LIKE verhistd.*
DEFINE f_input
RECORD
long_desc LIKE verhistd.long_desc
END RECORD
Let f_input.long_desc = f_drec.long_desc
Where verhistd.long_desc is a TEXT data type. But when I compile the code I get this error message:
|
| The variable "f_input.long_desc" is too complex a type to be used in an
| assignment statement.
| See error number -4323.
The error message for -4323 just talks about arrays and screen records, not TEXT data types.
I've not used TEXT datatypes in any of the 4gl code I have to maintain, however a quick view of the documentation about TEXT fields in the IBM 4GL By Example documentation suggests that 4GL treats Text blobs as a special case and does not load them by default due to the potential memory use.
If you view the example code they have in Example 18 (sorry, they only have pdf versions of the documentation online now) it should give you a fairly straight forward example of how to deal with a TEXT blob.
Because a BLOB column can contain a very large amount of data, a 4GL
program does not allocate space for a BLOB variable as it does other variable
types. Instead of containing the actual value, a BLOB variable contains a
pointer to the location where this data is stored. This location can be in
memory, in a temporary file created by the program, or in a specified file
named by the programmer. The LOCATE statement initializes the BLOB variable with the location of the BLOB value.