VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_DBColumnData"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'Generated by IDL2VB v120. Copyright (c) 1999 Martin.Both
'Source File Name: ../demos/db_query/database.idl
'Target File Name: c_DBColumnData.cls

Option Explicit

'union ::DB::ColumnData
Const sTypeId As String = "IDL:DB/ColumnData:1.0"

Private unionDiscr As Long
Private unionValue As Variant


Public Property Get Discriminator() As Long
    Discriminator = unionDiscr
End Property

Public Property Let Discriminator(unionDiscrNew As Long)
    unionDiscr = unionDiscrNew
End Property

Public Function is_stringValue() As Boolean
    is_stringValue = (unionDiscr = 1)
End Function

Public Function get_stringValue() As String
    get_stringValue = unionValue
End Function

Public Sub set_stringValue(ByVal stringValue As String)
    unionDiscr = 1
    Let unionValue = stringValue
End Sub

Public Function is_shortValue() As Boolean
    is_shortValue = (unionDiscr = 2)
End Function

Public Function get_shortValue() As Integer
    get_shortValue = unionValue
End Function

Public Sub set_shortValue(ByVal shortValue As Integer)
    unionDiscr = 2
    Let unionValue = shortValue
End Sub

Public Function is_integerValue() As Boolean
    is_integerValue = (unionDiscr = 3)
End Function

Public Function get_integerValue() As Long
    get_integerValue = unionValue
End Function

Public Sub set_integerValue(ByVal integerValue As Long)
    unionDiscr = 3
    Let unionValue = integerValue
End Sub

Public Function is_doubleValue() As Boolean
    is_doubleValue = (unionDiscr = 4)
End Function

Public Function get_doubleValue() As Double
    get_doubleValue = unionValue
End Function

Public Sub set_doubleValue(ByVal doubleValue As Double)
    unionDiscr = 4
    Let unionValue = doubleValue
End Sub

Public Function is_textValue() As Boolean
    is_textValue = (unionDiscr = 9)
End Function

Public Function get_textValue() As String
    get_textValue = unionValue
End Function

Public Sub set_textValue(ByVal textValue As String)
    unionDiscr = 9
    Let unionValue = textValue
End Sub

Public Function is_binaryValue() As Boolean
    is_binaryValue = (unionDiscr = 10)
End Function

Public Function get_binaryValue() As c_ByteSeq
    Set get_binaryValue = unionValue
End Function

Public Sub set_binaryValue(ByVal binaryValue As c_ByteSeq)
    unionDiscr = 10
    Set unionValue = binaryValue
End Sub

'Helper
Public Sub initByRead(ByVal oIn As cOrbStream)
    On Error GoTo ErrHandler
    unionDiscr = oIn.readUlong()
    Select Case unionDiscr
    Case 1
        unionValue = oIn.readString()
    Case 2
        unionValue = oIn.readShort()
    Case 3
        unionValue = oIn.readLong()
    Case 4
        unionValue = oIn.readDouble()
    Case 9
        unionValue = oIn.readString()
    Case 10
        Dim v_binaryValue As c_ByteSeq
        Set v_binaryValue = New c_ByteSeq
        Call v_binaryValue.initByRead(oIn, 0)
        Set unionValue = v_binaryValue
    End Select
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "ColumnData.read")
End Sub

'Helper
Public Sub writeMe(ByVal oOut As cOrbStream)
    On Error GoTo ErrHandler
    Call oOut.writeUlong(unionDiscr)
    Select Case unionDiscr
    Case 1
        Dim v_stringValue As String
        v_stringValue = unionValue
        Call oOut.writeString(v_stringValue)
    Case 2
        Dim v_shortValue As Integer
        v_shortValue = unionValue
        Call oOut.writeShort(v_shortValue)
    Case 3
        Dim v_integerValue As Long
        v_integerValue = unionValue
        Call oOut.writeLong(v_integerValue)
    Case 4
        Dim v_doubleValue As Double
        v_doubleValue = unionValue
        Call oOut.writeDouble(v_doubleValue)
    Case 9
        Dim v_textValue As String
        v_textValue = unionValue
        Call oOut.writeString(v_textValue)
    Case 10
        Dim v_binaryValue As c_ByteSeq
        Set v_binaryValue = unionValue
        Call v_binaryValue.writeMe(oOut, 0)
    End Select
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "ColumnData.write")
End Sub

'Helper
Public Sub initByAny(ByVal oAny As cOrbAny)
    On Error GoTo ErrHandler
    '???
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "initByAny")
End Sub

'Helper
Public Sub insertIntoAny(ByVal oAny As cOrbAny)
    On Error GoTo ErrHandler
    '???
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "insertIntoAny")
End Sub
