COMPANY
COMMUNITY
BLOG
HELP
MY ACCOUNT
EN PT ES

Imagen6305E

Learning from GeneXus 8.0 RC: new BLOB data

GeneXus 8.0 Release Candidate includes a new data type, BLOB, used for storing any kind of information (text, images, video, etc.) straight into the database.

LanguageScope: .NET, C/SQL, Visual Basic, Visual Fox Pro, Java.
DBMSs: SqlServer, Oracle, DB2 iseries, DB2 UDB, Informix.
 
Description: The Blob data type is used for storing binary information in the database. The Blob type attributes have a file name. When inserting or updating the registry, the content of a given file is transferred to the database.


Conversely, when reference is made to Blob type attributes, the information that they store in the database is saved in files. These files are saved in a disk and labeled automatically, whereas the whole access route is returned to the Blob attribute.


For instance, in order to add a registry through a procedure, the following programming must be done:
 
New
AttCode = 1
AttBlob = 'C:\images\Photo.jpg'
Endnew
 
This causes the Photo.jpg image that is located under c:\images to be stored in registry 1.
 
Then, when making reference to the Blob attribute for instance, in a For Each command the information of this particular attribute is saved in a file whose name is automatically generated.

 

For example:
 
For each
where AttCode = 1
&Path = AttBlob
Endfor
 
The &Path variable (of the Char type) will have the complete path to the file automatically generated with the content that has been stored in the database.


This file will be saved in the current directory. For the Win environment, this directory is the same as the applications directory. For the Web environment, this directory may vary depending on the generator and the configuration (e.g. when using the C/SQL generator, it will be saved in the physical directory that is associated to the virtual one; when using Java, this will take place in the current directory of the servlets server that is being used, etc.).

 
The generated file will be saved without an extension. However, it is possible to specify an extension for it, by using the property of the 'Associated File Extension' attribute:


 More information about GeneXus 8.0 RC

Related
GeneXus 8.0 Release Candidate Released
Learning about GeneXus 8.0 RC: Unique Indexes
From GeneXus 8.0 RC: Structured Data Types (SDT)