Attribute VB_Name = "m_DBErrMsgsEx"
'Generated by IDL2VB v120. Copyright (c) 2000 Martin.Both
'Source File Name: ../demos/db_query/database.idl

Option Explicit

'exception ::DB::ErrMsgsEx
Public Const TypeId As String = "IDL:DB/ErrMsgsEx:1.0"

'Helper
Public Function TypeCode() As cOrbTypeCode
    On Error GoTo ErrHandler
    Dim oOrb As cOrbImpl
    Set oOrb = VBOrb.defaultOrb()
    'Get previously created recursive or concrete TypeCode
    Dim oRecTC As cOrbTypeCode
    Set oRecTC = oOrb.getRecursiveTC(TypeId, 22) 'mCB.tk_except
    If oRecTC Is Nothing Then
        'Create place holder for TypeCode to avoid endless recursion
        Set oRecTC = oOrb.createRecursiveTc(TypeId)
        On Error GoTo ErrRollback
        'Describe exception members
        Dim oMemSeq As cCBStructMemberSeq
        Set oMemSeq = New cCBStructMemberSeq
        oMemSeq.Length = 1
        Set oMemSeq.Item(0) = New cCBStructMember
        oMemSeq.Item(0).name = "errs"
        Set oMemSeq.Item(0).p_type = m_DBMessage.TypeCode()
        Set oMemSeq.Item(0).p_type = oOrb.createAliasTc("IDL:DB/Error:1.0", "Error", oMemSeq.Item(0).p_type)
        Set oMemSeq.Item(0).p_type = oOrb.createSequenceTc(0, oMemSeq.Item(0).p_type)
        Set oMemSeq.Item(0).p_type = oOrb.createAliasTc("IDL:DB/Errors:1.0", "Errors", oMemSeq.Item(0).p_type)
        'Overwrite place holder
        Call oRecTC.setRecTc2ExceptionTc("ErrMsgsEx", oMemSeq)
    End If
    Set TypeCode = oRecTC
    Exit Function
ErrRollback:
    Call oRecTC.destroy
ErrHandler:
    Call VBOrb.ErrReraise(Err, "TypeCode")
End Function

'Helper, oAny.writeValue() -> exception.initByRead()
Public Function extractFromAny(ByVal oAny As cOrbAny) As c_DBErrMsgsEx
    Dim oException As c_DBErrMsgsEx
    Set oException = New c_DBErrMsgsEx
    Call oException.initByAny(oAny)
    Set extractFromAny = oException
End Function

'Helper, exception.writeMe() -> oAny.initByReadValue()
Public Function cloneAsAny(ByVal oException As c_DBErrMsgsEx) As cOrbAny
    On Error GoTo ErrHandler
    Dim oAny As cOrbAny
    Set oAny = New cOrbAny
    Call oAny.initByDefaultValue(TypeCode())
    Call oException.insertIntoAny(oAny)
    Set cloneAsAny = oAny
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "cloneAsAny")
End Function
