BYTE

 

Any digital data can be stored in a BYTE data type. The BYTE data type stores information unstructured, these can be program modules, pictures, sounds and any other information that can be stored in digital form.

 

You can use the LIKE keyword within the DEFINE statement to define a variable like a database column of the BYTE data type.

 

The value of BYTE type is limited to 2 gigabytes, but it can also be limited by the storage capacity of your system.

A variable of this data type can be used:

 

After a variable of BYTE data type has been declared, it is necessary to use LOCATE statement to tell the program, where the information for this variable is located. A column defined as BYTE type can be assigned to a BYTE variable completely or partially. If you want to assign only a part of the contents of the column to a BYTE variable you’ll need to specify the beginning and the end of the part you want to assign in bytes using square brackets as delimiters – variable [m, n]. E.g.:

 

SELECT image1 [1,100] INTO my_pic FROM catalogue

 

Here m and n are the coordinates of the first byte of a picture from which the part you want to assign begins and the last byte of the piece. The above code will select first 100 bytes of the specified picture image1 into my_pic variable.

 

You can use these methods to manipulate variables of BYTE data type:

§      readFile() - reads data from the specified file and passes it to the memory or to the variable of a large data type indicated by the LOCATE statement,

§      writeFile() - writes data from the variable (source file or memory) to the specified file.

 

Restrictions applied to BYTE

 

There are a number of restrictions that should be kept in mind while using BYTE data type: