Run Time Interaction

Custom input format COM objects are used by Log Parser in two different scenarios: when executing a query, and when displaying a quick-reference help on the custom input format when the Log Parser command-line executable is used in Help Mode.

Query Execution Scenario

In this scenario, a custom input format COM object is used to retrieve input records from the specified from-entity.

To make an example of the sequence of the method calls invoked by Log Parser on the custom input format COM object in this scenario, we will assume that the custom input format generates input records containing the following four fields:

In addition, we will assume that the query being executed references only three fields out of the four fields exported by the custom input format, as in the following example:
SELECT FourthField, ThirdField
FROM   InputFile.txt
WHERE  FirstField LIKE '%test%'

The following table shows the sequence of method calls under these assumptions:
Method call Returned value Returned value description
Object is instantiated    
OpenInput("InputFile.txt") None  
GetFieldCount() 4  
GetFieldName(0) "FirstField"  
GetFieldType(0) 3 FieldType.String
GetFieldName(1) "SecondField"  
GetFieldType(1) 1 FieldType.Integer
GetFieldName(2) "ThirdField"  
GetFieldType(2) 4 FieldType.Timestamp
GetFieldName(3) "FourthField"  
GetFieldType(3) 3 FieldType.String
ReadRecord() TRUE an input record is available
GetValue(0) VT_BSTR VARIANT first field value
GetValue(2) VT_DATE VARIANT third field value
GetValue(3) VT_BSTR VARIANT fourth field value
ReadRecord() TRUE an input record is available
GetValue(0) VT_BSTR VARIANT first field value
GetValue(2) VT_DATE VARIANT third field value
GetValue(3) VT_BSTR VARIANT fourth field value
... ... ...
ReadRecord() TRUE an input record is available
GetValue(0) VT_BSTR VARIANT first field value
GetValue(2) VT_DATE VARIANT third field value
GetValue(3) VT_BSTR VARIANT fourth field value
ReadRecord() FALSE no more input records available
CloseInput(FALSE) None  
Object is released    

Help Mode Scenario

When the Log Parser command-line executable is used in Help Mode to display a quick-reference help on the custom input format, the custom input format COM object is only used to retrieve the field information that is displayed to the user.

The user-supplied help mode command may or may be not include a from-entity, as shown in the following examples:

C:\>LogParser -h -i:COM -iProgID:MySample.CustomInputFormat file.txt
C:\>LogParser -h -i:COM -iProgID:MySample.CustomInputFormat
If the user-supplied help mode command does not include a from-entity, then the bszFromEntity argument of the OpenInput method will be an empty string. See the Remarks section of the OpenInput Method Reference for more information on how custom input format COM objects should behave in this case.

To make an example of the sequence of the method calls invoked by Log Parser on the custom input format COM object in this scenario, we will assume that the custom input format generates input records containing the following four fields:

In addition, we will assume that the help command does not include a from-entity.

The following table shows the sequence of method calls under these assumptions:
Method call Returned value Returned value description
Object is instantiated    
OpenInput("") None  
GetFieldCount() 4  
GetFieldName(0) "FirstField"  
GetFieldType(0) 3 FieldType.String
GetFieldName(1) "SecondField"  
GetFieldType(1) 1 FieldType.Integer
GetFieldName(2) "ThirdField"  
GetFieldType(2) 4 FieldType.Timestamp
GetFieldName(3) "FourthField"  
GetFieldType(3) 3 FieldType.String
CloseInput(FALSE) None  
Object is released    

See also:

ILogParserInputContext Interface
Custom Plugins

© 2004 Microsoft Corporation. All rights reserved.