GetProperty<Type> Methods

This method returns a connector property value as a specific data type. Supported data types include Boolean, Currency, Datetime, Float, Int, Numeric, and Text.

This method allows retrieval of Connect properties as with LCConnection.GetProperty, but does not require a field object. If the property value is of a different type, data conversion will be performed. The value of the password property cannot be obtained with this function, and will result in an INVALID_PROPERTY error.

Defined In

LCConnection

Syntax

flag = lcConnection.GetPropertyBoolean(propertyToken, default)

Set destCurrency = lcConnection.GetPropertyCurrency(propertyToken)

Set destDatetime = lcConnection.GetPropertyDatetime(propertyToken)

destFloat = lcConnection.GetPropertyFloat(propertyToken)

destInt = lcConnection.GetPropertyInt(propertyToken)

Set destNumeric = lcConnection.GetPropertyNumeric(propertyToken)

Set destStream = lcConnection.GetPropertyStream(propertyToken, streamFormat)

Parameters

Parameter

Description

propertyToken

A token identifying the Connection property. See Appendix B for a list of property tokens.

default

(GetPropertyBoolean only) Value to be returned if the property cannot be located. Default value is FALSE.

streamFormat

(GetPropertyStream only) Format that the stream is converted to before being returned. If streamFormat is zero, no conversion occurs and the stream is copied in the same format as the property value. Otherwise, use a stream format flag as described in the section "Stream Format" in Chapter 5.

Return Values

Value

Description

flag

GetPropertyBoolean only. Boolean value, either TRUE or FALSE. If the property does not exist, the default is returned.

dest<Type>

Current® value for the connector property.

Examples

Option Public
Uselsx "*lsxlc" 

Sub Initialize
  Dim connect As New LCConnection ("oracle") 
  Dim conFld As LCField
  Dim propName As String
  Dim propDate As LCDateTime
  Dim propNumeric As LCNumeric
  Dim propStrm As LCStream
  Dim propCurr As LCCurrency
  Dim propFloat As Double
  Dim propInt As Long
  Dim propBool As Variant
  Dim tokenId As Long
  Dim propType As Long
  Dim propFlags As Long

  ' set some connector properties
  connect.Server = "Rainbow"
  connect.Userid = "JDoe"
  connect.Password = "xyzzy"

  ' it is not necessary to connect to list properties
  Call connect.ListProperty (LCLIST_FIRST, _
  tokenId, propType, propFlags, propName)

  Print "NAME" Tab(20); "ID"; Tab(28); "FLAGS"; _
  Tab(36); "TYPE"; Tab(48); "VALUE"
  Print "-----------------" Tab(20); "------"; Tab(28); "------"; _
  Tab(36); "----------"; Tab(48); "----------"
  Do
    Set conFld = connect.GetProperty (tokenId)
    ' match the property to a datatype and fetch it as that datatype
    Select Case propType
    Case LCTYPE_DATETIME:
      Set propDate = connect.GetPropertyDatetime (tokenId)
      Print propName; Tab(20); Hex(tokenId); Tab(28); Hex(propFlags); _
      Tab(36); "LCDatetime"; Tab(48); propDate.text
    Case LCTYPE_NUMERIC:
      Set propNumeric = connect.GetPropertyNumeric (tokenId)
      Print propName; Tab(20); Hex(tokenId); Tab(28); Hex(propFlags); _
      Tab(36); "LCNumeric"; Tab(48); propNumeric.text
    Case LCTYPE_TEXT:
      Set propStrm = connect.GetPropertyStream (tokenId, LCSTREAMFMT_NATIVE)
      Print propName; Tab(20); Hex(tokenId); Tab(28); Hex(propFlags); _
      Tab(36); "LCStream"; Tab(48); propStrm.text
    Case LCTYPE_CURRENCY:
      Set propCurr = connect.GetPropertyCurrency (tokenId)
      Print propName; Tab(20); Hex(tokenId); Tab(28); Hex(propFlags); _
      Tab(36); "LCCurrency"; Tab(48); propCurr.text
    Case LCTYPE_FLOAT:
      propFloat = connect.GetPropertyFloat (tokenId)
      Print propName; Tab(20); Hex(tokenId); Tab(28); Hex(propFlags); _
      Tab(36); "Double"; Tab(48); Cstr(propFloat)
    Case LCTYPE_INT:
      If (propFlags And LCPROPERTYF_BOOLEAN) Then
        propBool = connect.GetPropertyBoolean (tokenId, False)
        Print propName; Tab(20); Hex(tokenId); Tab(28); Hex(propFlags); _
        Tab(36); "Boolean"; Tab(48); Cstr(propBool)
      Else
        propInt = connect.GetPropertyInt (tokenId)
        Print propName; Tab(20); Hex(tokenId); Tab(28); Hex(propFlags); _
        Tab(36); "Long"; Tab(48); Cstr(PropInt)
      End If
    End Select
    Loop _
    While connect.ListProperty (LCLIST_NEXT, _
  tokenId, propType, propFlags, propName)
End Sub

Example Output

NAME               ID      FLAGS   TYPE        VALUE
-----------------  ------  ------  ----------  ----------
Name               30004   4       LCStream    oracle
IsConnected        3000C   6       Boolean     False
Server             10001   1       LCStream    mycyclone
Userid             10003   1       LCStream    scott
Metadata           10005   0       LCStream  
Index              10006   0       LCStream  
MapByName          10007   2       Boolean     False
Writeback          10008   2       Boolean     False
Condition          1000B   0       LCStream  
StampField         1000C   0       LCStream  
BaseStamp          1000D   0       LCDatetime
MaxStamp           1000E   0       LCDatetime
TextFormat         1000F   4       Long        65535
CharacterSet       30008   4       LCStream    NATIVE
Procedure          10010   0       LCStream  
Owner              10011   0       LCStream  
AlternateMetadata  10013   2       Boolean     False
CommitFrequency    1       0       Long        0
RollbackOnError    2       2       Boolean     False
CreateLongColumn   3       0       LCStream  
CreateLongByUser   4       0       Long        0
TraceSQL           5       2       Boolean     False