-1

我正在尝试评估 ODAC 以使用 Oracle AQ。请求队列包含这样的 JMS 对象(但没有换行符和其他空格):

SYS.AQ$_JMS_BYTES_MESSAGE(
  SYS.AQ$_JMS_HEADER(
    'null','null','null','null','null','null',
    SYS.AQ$_JMS_USERPROPARRAY(
      SYS.AQ$_JMS_USERPROPERTY('Key1',100,'Value1','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key2',100,'Value2','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key3',100,'Value3','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key4',100,'Value4','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key5',100,'Value5','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key6',100,'Value6','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key7',100,'Value7','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key8',100,'Value8','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key9',100,'Value9','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key10',100,'Value10.0','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key11',100,'Value11','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key12',100,'Value12','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key13',100,'Value13','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key14',100,'Value14','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key15',100,'Value15','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key16',100,'Value16','null',27),
      SYS.AQ$_JMS_USERPROPERTY('Key17',100,'Value17','null',27)
    )
  ),
  4168,'null','oracle.sql.BLOB@959acc'
)

我可以接收底层对象(字符串 Payload 作为空字符串返回,但 TOraObject PayLoad 包含数据)。

我正在尝试剖析 TOraObject PayLoad,并且正在寻找一个将 DataType 值转换为正确的 AttrXxxx[Name] 属性调用的表。

    OraType.AttributeCount:4
    OraType.Name:"SYS"."AQ$_JMS_BYTES_MESSAGE"
    OraType.DataType:15
      Attribute[0].Name:HEADER
      Attribute[0].DataType:15
      OraType.AttributeCount:7
      OraType.Name:"SYS"."AQ$_JMS_HEADER"
      OraType.DataType:15
        Attribute[0].Name:REPLYTO
        Attribute[0].DataType:15
        OraType.AttributeCount:3
        OraType.Name:"SYS"."AQ$_AGENT"
        OraType.DataType:15
          Attribute[0].Name:NAME
          Attribute[0].DataType:1
          Attribute[1].Name:ADDRESS
          Attribute[1].DataType:1
          Attribute[2].Name:PROTOCOL
          Attribute[2].DataType:5
        Attribute[1].Name:TYPE
        Attribute[1].DataType:1
        Attribute[2].Name:USERID
        Attribute[2].DataType:1
        Attribute[3].Name:APPID
        Attribute[3].DataType:1
        Attribute[4].Name:GROUPID
        Attribute[4].DataType:1
        Attribute[5].Name:GROUPSEQ
        Attribute[5].DataType:5
        Attribute[6].Name:PROPERTIES
        Attribute[6].DataType:17
        OraType.AttributeCount:1
        OraType.Name:"SYS"."AQ$_JMS_USERPROPARRAY"
        OraType.DataType:17
          Attribute[0].Name:ELEMENT
          Attribute[0].DataType:15
          OraType.AttributeCount:5
          OraType.Name:"SYS"."AQ$_JMS_USERPROPERTY"
          OraType.DataType:15
            Attribute[0].Name:NAME
            Attribute[0].DataType:1
            Attribute[1].Name:TYPE
            Attribute[1].DataType:5
            Attribute[2].Name:STR_VALUE
            Attribute[2].DataType:1
            Attribute[3].Name:NUM_VALUE
            Attribute[3].DataType:5
            Attribute[4].Name:JAVA_TYPE
            Attribute[4].DataType:5
      Attribute[1].Name:BYTES_LEN
      Attribute[1].DataType:5
      Attribute[2].Name:BYTES_RAW
      Attribute[2].DataType:1
      Attribute[3].Name:BYTES_LOB
      Attribute[3].DataType:102

通过反复试验,我到目前为止:

        case DataType of
          102:
            LOB := ObjectPayLoad.AttrAsLob[Name];
          15:
            AttributeOraObject := ObjectPayLoad.AttrAsObject[Name];
          17:
            AttributeOraArray := ObjectPayLoad.AttrAsArray[Name];
          else
          begin
            PayLoadAttributeAsString := ObjectPayLoad. AttrAsString[Name];
            Logger.Log('  "%s"', [PayLoadAttributeAsString]);
          end;
        end;

欢迎提供更完整的列表:-)

在此之后,我需要研究另一种方式:生成正确的 TOraObject,其中包含 JMS 内容。也欢迎提供相关提示。

——杰伦

4

1 回答 1

0

编辑:

ODAC有多个定义常数的单位。
值为 102的常数dtOraBlobOraClasses单位中;定义 DataType 值的常量以前缀 开头,与dt定义它们的单位无关。

原文: 我在单元中找到了其中一些常量MemData

      case DataType of
        102:
          LOB := OraObject.AttrAsLob[Name];
        MemData.dtObject: // 15
        begin
          AttributeOraObject := OraObject.AttrAsObject[Name];
          LogOraObject(AttributeOraObject, Level+1);
        end;
        MemData.dtArray: // 17
        begin
          AttributeOraArray := OraObject.AttrAsArray[Name];
          LogOraArray(AttributeOraArray, Level);
        end;
        MemData.dtFloat: // 5
        begin
          AttributeFloat := OraObject.AttrAsFloat[Name];
          Logger.Log(Prefix+'"%g"', [AttributeFloat]);
        end;
        MemData.dtString: // 1
        begin
           PayLoadAttributeAsString := OraObject.AttrAsString[Name];
           Logger.Log(Prefix+'"%s"', [PayLoadAttributeAsString]);
        end;
      else
        begin
          PayLoadAttributeAsString := OraObject.AttrAsString[Name];
          Logger.Log(Prefix+'"%s"', [PayLoadAttributeAsString]);
        end;
      end;

虽然我找不到 102 常量,但我很确定它是用于 LOB 字段的。

有谁能证实吗?

——杰伦

于 2010-10-30T11:59:46.480 回答