Consultor Eletrônico



Kbase P113369: 4GL/ABL: Sample code using the IMPORT and EXPORT statements with BLOB fields.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   02/12/2008
Status: Verified

GOAL:

4GL/ABL: Sample code using the IMPORT and EXPORT statements with BLOB fields.

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

FIX:

The following code demonstrates how to IMPORT and EXPORT TEMP-TABLE data including BLOB fields:
/***** ImportExportTempTablesWithBlob.p *****/
/* Define variables */
DEFINE VARIABLE cVar AS CHARACTER NO-UNDO.
DEFINE VARIABLE lcVar AS LONGCHAR NO-UNDO.
DEFINE VARIABLE iFileSize AS INTEGER NO-UNDO.
/* Define the first temp table */
DEFINE TEMP-TABLE ttFirst NO-UNDO
FIELD blbField1 AS BLOB.
/* Create and populate a record in the first temp table */
CREATE ttFirst.
COPY-LOB FROM FILE "ImportExportTempTablesWithBlob.p" TO blbField1.
/* Export the first temp table to an export file */
OUTPUT TO exportfile.
EXPORT ttFirst.
OUTPUT CLOSE.
/* Define the second temp table */
DEFINE TEMP-TABLE ttSecond NO-UNDO
FIELD blbField2 AS BLOB.
/* Create a record in the second temp table and populate */
/* it from the created record from the export file above */
INPUT FROM exportfile.
CREATE ttSecond.
IMPORT ttSecond.
INPUT CLOSE.
/* Confirm data was indeed imported by displaying it */
COPY-LOB blbField2 TO lcVar.
ASSIGN
FILE-INFO:FILE-NAME = "importexportblob.p"
iFileSize = FILE-INFO:FILE-SIZE
cVar = SUBSTRING(lcVar, 1, iFileSize).
MESSAGE cVar
VIEW-AS ALERT-BOX INFO BUTTONS OK.