⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coutputidentification.cls

📁 Data monkey是一个强大的是数据传输和转换应用程序。使用DataMonkey用户可以把复杂的文本文件格式
💻 CLS
📖 第 1 页 / 共 2 页
字号:
    mOTYP.Add "BSTR", tKey + CStr(DEF_NAME)
    mOTYP.Add "A null-terminated character string (Unicode)", tKey + CStr(DEF_DESCRIPTION)
    mOTYP.Add ADODB.adBSTR, tKey + CStr(DEF_TYPE)
    
    Exit Sub
    
End Sub


Public Function GetRSTDescription(ByVal descType As rdtReducedDataTypeSet)
    Dim ret As String
    Select Case descType
        ' All the integer types.
        Case rdtReducedDataTypeSet.rdtInteger
            ret = "Integer"
        Case rdtReducedDataTypeSet.rdtByte
            ret = "Byte"
        Case rdtReducedDataTypeSet.rdtLong
            ret = "Long"
        Case rdtReducedDataTypeSet.rdtSingle
            ret = "Single"
        Case rdtReducedDataTypeSet.rdtDouble
            ret = "Double"
        Case rdtReducedDataTypeSet.rdtBool
            ret = "Boolean"
        Case rdtReducedDataTypeSet.rdtNull
            ret = "NULL"
        Case rdtReducedDataTypeSet.rdtString
            ret = "String"
        Case rdtReducedDataTypeSet.rdtDate
            ret = "Date"
        Case rdtReducedDataTypeSet.rdtCurrency
            ret = "Currency"
        Case rdtReducedDataTypeSet.rdtVariant
            ret = "Variant"
        Case rdtReducedDataTypeSet.rdtDecimal
            ret = "Decimal"
        Case Else
            ret = "Type Unknown"
    End Select
    
    GetRSTDescription = ret

End Function

Public Function ConvertDBTypeToRST(dbType As Integer) As rdtReducedDataTypeSet

    Select Case dbType
        ' All the integer types.
        Case ADODB.adInteger, ADODB.adSmallInt, _
            ADODB.adUnsignedInt, ADODB.adUnsignedSmallInt
            
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtInteger

        Case ADODB.adUnsignedTinyInt, ADODB.adTinyInt
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtByte

        Case ADODB.adBigInt, ADODB.adUnsignedBigInt
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtLong
            
        Case ADODB.adSingle, ADODB.adNumeric, ADODB.adDecimal
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtSingle
        
        Case ADODB.adDouble
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtDouble
        
        Case ADODB.adBoolean
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtBool

        Case ADODB.adEmpty
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtNull

        Case ADODB.adChar, ADODB.adBSTR
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtString

        Case ADODB.adDate, ADODB.adDBTime, ADODB.adDBTimeStamp
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtDate

        Case ADODB.adCurrency
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtCurrency

        Case ADODB.adVariant
            ConvertDBTypeToRST = rdtReducedDataTypeSet.rdtVariant

        Case ADODB.adError, ADODB.adUserDefined, ADODB.adBinary, _
            ADODB.adIDispatch, ADODB.adIUnknown, ADODB.adGUID
            LogError "COutputIdentification", "ConvertDBTypeToRST", _
                "Type not supported"
    End Select
End Function

Public Function GetNumDBTypes() As Integer
    GetNumDBTypes = mOTYP.Count / 3
End Function
Public Function GetDBTypeName(ByVal cmd As Integer, Optional byIndex As Boolean = False) As String
    GetDBTypeName = ""
    'On Error Resume Next
    If byIndex = True Then
        GetDBTypeName = mOTYP.item((cmd - 1) * 3 + DEF_NAME)
    Else
        GetDBTypeName = mOTYP.item(CStr(cmd) + CStr(DEF_NAME))
    End If
End Function
Public Function GetDBTypeID(ByVal cmd As Integer, Optional byIndex As Boolean = False) As Integer
    GetDBTypeID = ADODB.adEmpty
    'On Error Resume Next
    If byIndex = True Then
        GetDBTypeID = mOTYP.item((cmd - 1) * 3 + DEF_TYPE)
    Else
        GetDBTypeID = mOTYP.item(CStr(cmd) + CStr(DEF_TYPE))
    End If
End Function
Public Function GetDBTypeDescription(ByVal cmd As Integer, Optional byIndex As Boolean = False) As String
    GetDBTypeDescription = ""
    'On Error Resume Next
    If byIndex = True Then
        GetDBTypeDescription = mOTYP.item((cmd - 1) * 3 + DEF_DESCRIPTION)
    Else
        GetDBTypeDescription = mOTYP.item(CStr(cmd) + CStr(DEF_DESCRIPTION))
    End If
End Function

'****************************************************************
' Describe the different types of output sources that we support.
'****************************************************************
Private Sub FillInOutputSources()
    
    tKey = CStr(otOutputSourceType.otNONE)
    mOSRC.Add "Screen", tKey + CStr(DEF_NAME)
    mOSRC.Add "Display imported data in a window", tKey + CStr(DEF_DESCRIPTION)
    mOSRC.Add otOutputSourceType.otNONE, tKey + CStr(DEF_TYPE)
    
    tKey = CStr(otOutputSourceType.otASCII)
    mOSRC.Add "ASCII File", tKey + CStr(DEF_NAME)
    mOSRC.Add "Output to an ASCII file", tKey + CStr(DEF_DESCRIPTION)
    mOSRC.Add otOutputSourceType.otASCII, tKey + CStr(DEF_TYPE)
    
    tKey = CStr(otOutputSourceType.otDB)
    mOSRC.Add "ODBC Database", tKey + CStr(DEF_NAME)
    mOSRC.Add "Output to a ODBC Database", tKey + CStr(DEF_DESCRIPTION)
    mOSRC.Add otOutputSourceType.otDB, tKey + CStr(DEF_TYPE)

    tKey = CStr(otOutputSourceType.otXML)
    mOSRC.Add "XML File", tKey + CStr(DEF_NAME)
    mOSRC.Add "Output to an XML file", tKey + CStr(DEF_DESCRIPTION)
    mOSRC.Add otOutputSourceType.otXML, tKey + CStr(DEF_TYPE)
    
    'tKey = CStr(otOutputSourceType.otOTHER)
    'mOSRC.Add "Other...", tKey + CStr(DEF_NAME)
    'mOSRC.Add "Output to a custom output source", tKey + CStr(DEF_DESCRIPTION)
    'mOSRC.Add otOutputSourceType.otOTHER, tKey + CStr(DEF_TYPE)
End Sub

Public Function GetNumOutputSources() As Integer
    GetNumOutputSources = mOSRC.Count / 3
End Function

Public Function GetOutputSourceName(ByVal cmd As Integer, _
                    Optional byIndex As Boolean = False) As String
    
    'On Error Resume Next
    GetOutputSourceName = ""
    
    If byIndex Then
        If cmd < 0 Or cmd > mOSRC.Count - 1 Then Exit Function
        GetOutputSourceName = mOSRC.item((cmd - 1) * 3 + DEF_NAME)
    Else
        If cmd < 1 Or cmd > mOSRC.Count Then Exit Function
        GetOutputSourceName = mOSRC.item(CStr(cmd) + CStr(DEF_NAME))
    End If

End Function
Public Function GetOutputSourceID(ByVal cmd As Integer, _
                    Optional byIndex As Boolean = False) As otOutputSourceType

    'On Error Resume Next
    GetOutputSourceID = otNONE
    If byIndex = True Then
        GetOutputSourceID = mOSRC.item((cmd - 1) * 3 + DEF_TYPE)
    Else
        GetOutputSourceID = mOSRC.item(CStr(cmd) + CStr(DEF_TYPE))
    End If

End Function

Public Function GetOutputSourceDescription(ByVal cmd As Integer, _
                    Optional byIndex As Boolean = False) As String
    'On Error Resume Next
    GetOutputSourceDescription = ""
    If byIndex Then
        GetOutputSourceDescription = mOSRC.item((cmd - 1) * 3 + DEF_DESCRIPTION)
    Else
        GetOutputSourceDescription = mOSRC.item(CStr(cmd) + CStr(DEF_DESCRIPTION))
    End If
End Function

' Figure out if this is a numeric type.
Public Function isNumeric(dbType As Integer) As Boolean
    
    Dim CnvType As rdtReducedDataTypeSet
    
    CnvType = GOutputID.ConvertDBTypeToRST(dbType)

    Select Case CnvType 'mConvertToType
        Case rdtReducedDataTypeSet.rdtInteger, _
            rdtReducedDataTypeSet.rdtLong, _
            rdtReducedDataTypeSet.rdtSingle, _
            rdtReducedDataTypeSet.rdtDouble, _
            rdtReducedDataTypeSet.rdtBool, _
            rdtReducedDataTypeSet.rdtDecimal, _
            rdtReducedDataTypeSet.rdtByte
                
            isNumeric = True
        
        Case Else
            isNumeric = False
    End Select

End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -