The from-entity specified in the
FROM clause of the currently
executing query, or an empty string if Log Parser is executed in
Help Mode to display the
quick-reference help on the custom input format.
Return Value
None.
Remarks
The OpenInput method is the first method called by Log Parser
after the custom input format COM object has been instantiated. An
implementation of this method would usually perform any necessary
object initialization, prepare the from-entity for input record
retrieval (e.g. opening an input file), and eventually pre-process
the input to gather the input record fields meta-information that
will be returned by the GetFieldCount, GetFieldName, and GetFieldType methods.
Users can execute the Log Parser command-line executable in
Help Mode to display a
quick-reference help on a custom input format. The quick-reference
help displays the input record field names and types, which are
retrieved through calls to the GetFieldCount, GetFieldName, and GetFieldType methods.
If the user-supplied help mode command does not include a
from-entity, the bszFromEntity argument wil be an empty
string. In these cases, a custom input format COM object can behave
in two ways:
If the input record fields do not depend on the from-entity
specified in the query (i.e. if the input record structure is
fixed), then the custom input format COM object should accept the
empty from-entity without returning an error, allowing Log Parser
to subsequently call the GetFieldCount, GetFieldName, and GetFieldType methods to
retrieve the input record structure;
If the input record fields depend on the from-entity specified
in the query (i.e. if the input record structure is extracted from
the input data), then the custom input format COM object should
reject the empty from-entity returning an error, which will in turn
cause the help command to display a warning message to the user in
place of the input record structure.
Examples
C++ example:
HRESULT CProcessesInputContext::OpenInput( IN BSTR bszFromEntity )
{
// Initialize object
...
// This input format does not require a from-entity, so
// we will just ignore the argument
return S_OK;
}
VBScript example:
Function OpenInput(strComputerName)
Dim objWMIService
Dim objQFEs
Dim nLength
' Default computer name is local machine
If IsNull(strComputerName) Or Len(strComputerName) = 0 Then
strComputerName = "."
End If
' Query for all the QFE's on the specified machine
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputerName & "\root\cimv2")
Set objQFEs = objWMIService.ExecQuery ("Select * from Win32_QuickFixEngineering")
' Store in array
m_objQFEArray = Array()
For Each objQFE In objQFEs
ReDim Preserve m_objQFEArray( UBound(m_objQFEArray) + 1 )
Set m_objQFEArray( UBound(m_objQFEArray) ) = objQFE
Next
m_nIndex = LBound(m_objQFEArray)
End Function