3.2.4.3.3 ExecuteAccountingQuery (Opnum 9)

The ExecuteAccountingQuery method executes an accounting query.

 [id(3), helpstring("method ExecuteAccountingQuery")] HRESULT ExecuteAccountingQuery(
   [in] BSTR bstrAccountingQuery,
   [in] BSTR bstrStartingDate,
   [in] BSTR bstrEndingDate,
   [out] BSTR* pbstrResult,
   [out] BOOL* pbIsThereMoreData
 );

bstrAccountingQuery: A string that specifies an AccountingQueryCondition element (section 2.2.5.5) in XML. For an example, see section 4.2.5.

bstrStartingDate: A string that specifies the starting date for the query, in date-and-time format (section 2.2.1.3). If this value is not in the correct format, the date range is ignored and the complete set of accounting data is returned.

bstrEndingDate: A string that specifies the ending date for the query, in date-and-time format. If this value is not in the correct format, the date range is ignored and the complete set of accounting data is returned.

pbstrResult: A pointer to a string that returns the requested data.

This string is formatted as a set of rows representing accounting process entries. Rows are delimited by carriage return escape characters (\r). Each row is a set of columns delimited by newline escape characters (\n). The columns correspond in number and order to the columns specified in the AccountingQueryCondition element in the bstrAccountingQuery parameter.

pbIsThereMoreData: A pointer to a Boolean value that specifies whether more data is available.

Return Values: This method returns 0x00000000 for success or a negative HRESULT value (in the following table or in [MS-ERREF] section 2.1.1) if an error occurs.

Return value/code

Description

0x00000000

S_OK

Operation successful.

0x80070057

E_INVALIDARG

One or more arguments are invalid.

0xC1FF01FA

WRM_ERR_WYUKON_NOT_CONNECTABLE

Cannot establish a connection to the accounting database.<41>

0xC1FF01FE

WRM_ERR_JET_INVALID_COLUMN_NAME

The query has been canceled. One or more of the column names specified in the accounting query are invalid.

0xC1FF0200

WRM_ERR_JET_PIVOTABLE_COLUMN_NOT_GROUPED_BY

One or more SQL SELECT columns cannot be selected because of the current SQL GROUP BY settings. These columns MUST be grouped to be selected.

0xC1FF0201

WRM_ERR_JET_INVALID_GROUP_BY_COL

One or more columns specified for SQL GROUP BY is either invalid or cannot be grouped on.

0xC1FF0203

WRM_ERR_JET_SERVER_TOO_BUSY

The server can service only one accounting request at a time.<42>

0xC1FF0207

WRM_ERR_JET_SERVICE_BEING_SHUT_DOWN

The query has been aborted since the management service is being shut down.

The error WRM_ERR_JET_PIVOTABLE_COLUMN_NOT_GROUPED_BY is returned in cases where a column with the IsVisible attribute set to FALSE is included in the SQL SELECT column while there are some columns in the group column collection. The following sample AccountingQueryCondition XML (section 2.2.5.5) SHOULD return this error:

  
 <AccountingQueryCondition>
     <SelectFieldCollection>
         <Column>ProcessName</Column>
         <Column>ProcessId</Column>
     </SelectFieldCollection>
     <GroupColumnCollection>
         <Column>ProcessName</Column>
     </GroupColumnCollection>
     <OrderColumnCollection />
     <HavingClause />
 </AccountingQueryCondition>

Additional IWRMAccounting interface methods are specified in section 3.2.4.3.