Blob stands for `Binary large object` as a large binary data object that is processed by database management systems (DBMS) in a special way. The class 'Blob' cannot be created. A blob object is returned by a blob field and is used to read or write its contents.
In connection with databases and the field type `BLOB`, you will find the argument that alternative approaches also exist for storing images directly in a field of a DB table, for example:
The second approach is favored on the grounds that images and other binaries should be stored in the file system because the file system is the storage for files. In addition, the DBMSs supported by Gambas handle the field type `BLOB` in different ways. The DBMS MySQL, for example, makes no distinction between a blob field and a normal text field. One problem with the processing of BLOBs by databases is that the data in the BLOBs is unstructured from a database perspective and therefore unreadable. The database operations for BLOBs are therefore limited to complete reading, saving and reading.
Although the storage and processing of BLOBs in databases tends to be inefficient, there are also advantages associated with this. All data - including the BLOBs - is integrated and referenced in the database schema. Backups of the database in the form of dumps contain all relevant data. Another advantage is that the access rights to the data in MySQL (MariaDB) and PostgreSQL are regulated by the rights management of the database system.
Chapter 22.13 presents projects in which large binary data objects are stored directly or indirectly in a database table for different DBMS (SQLite3, PostgreSQL and MySQL).
Detailed information on large binary data objects in terms of DB data types can be found in chapter 22.3 DB mapping and under the link: http://gambaswiki.org/wiki/doc/db-type-mapping.
The Blob class only has two properties:
Property | Data type | Description |
---|---|---|
Data | String | Sets the field content or returns the field content. |
Length | Integer | Delivers the length of the blob content as the number of bytes. |
Table 22.4.12.1.1 : Properties of the Blob class