views:

27

answers:

1

I'm trying to evaluate ODAC for using Oracle AQ. The request queue contains JMS objects like these (but without linebreaks and other whitespace):

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'
)

I can receive the underlying object (a string Payload comes back as an empty string, but a TOraObject PayLoad contains data).

I'm trying to disscect the TOraObject PayLoad, and am looking for a table that converts the DataType values into the correct AttrXxxx[Name] property calls.

    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

By trial and error, I have come so far:

        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;

A more complete list is welcome :-)

After this, I will need to research the other way around: generating the right TOraObject that has a JMS content in it. Tips for that are also welcome.

--jeroen

A: 

I have found a few of these constants in the [b]MemData[/b] unit:

      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;

I can't find the 102 constant though, but I'm pretty sure it is for a LOB field.

Anyone who can confirm that?

--jeroen

Jeroen Pluimers