Consultor Eletrônico



Kbase P123023: How to store a ProDataSet in a CLOB field.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   23/03/2007
Status: Unverified

GOAL:

How to store a ProDataSet in a CLOB field.

GOAL:

How to extract a ProDataSets XML and save it to a CLOB field in the database

FACT(s) (Environment):

OpenEdge 10.x

FIX:

Use the DataSet Handle's WRITE-XML method to extract the XML to a LONGCHAR. Next, use COPY-LOB to transfer the LONGCHAR data to the CLOB DB field. The following is an example:
DEFINE VARIABLE cTargetType AS CHARACTER NO-UNDO.
DEFINE VARIABLE lcXml AS LONGCHAR NO-UNDO.
DEFINE VARIABLE lFormatted AS LOGICAL NO-UNDO.
DEFINE VARIABLE cEncoding AS CHARACTER NO-UNDO.
DEFINE VARIABLE cSchemaLocation AS CHARACTER NO-UNDO.
DEFINE VARIABLE lWriteSchema AS LOGICAL NO-UNDO.
DEFINE VARIABLE lMinSchema AS LOGICAL NO-UNDO.
DEFINE VARIABLE retOK AS LOGICAL NO-UNDO.
ASSIGN
cTargetType = "LONGCHAR"
lFormatted = YES
cEncoding = ?
cSchemaLocation = ?
lWriteSchema = NO
lMinSchema = NO.
/*wirte XML to Longchar*/
retOK = hds2:WRITE-XML(cTargetType,
lcXml,
lFormatted,
cEncoding,
cSchemaLocation,
lWriteSchema,
lMinSchema).
CREATE test.
/*copy xml to field*/
COPY-LOB lcXml TO clbfld.