PIBIO_STORAGE_GET_RECORD_COUNT_FN回调函数 (winbio_adapter.h)

由 Windows 生物识别框架或引擎适配器调用以检索管道结果集中的模板记录数。

语法

PIBIO_STORAGE_GET_RECORD_COUNT_FN PibioStorageGetRecordCountFn;

HRESULT PibioStorageGetRecordCountFn(
  [in, out] PWINBIO_PIPELINE Pipeline,
  [out]     PSIZE_T RecordCount
)
{...}

参数

[in, out] Pipeline

指向与执行操作的生物识别单元关联的 WINBIO_PIPELINE 结构的指针。

[out] RecordCount

指向一个变量的指针,该变量接收结果集中的模板记录数。

返回值

如果函数成功,则返回S_OK。 如果函数失败,它必须返回以下 HRESULT 值之一来指示错误。

返回代码 说明
E_POINTER
强制指针参数为 NULL
WINBIO_E_DATABASE_NO_RESULTS
查询成功,但找不到匹配的记录。
WINBIO_E_INVALID_DEVICE_STATE
管道对象的 StorageContext 成员为 NULLFileHandle 成员无效。

注解

结果集中当前记录数取决于对 StorageAdapterQueryByContentStorageAdapterQueryBySubject 函数的最新调用。

示例

以下伪代码演示了此函数的一种可能实现。 该示例不编译。 必须根据自己的目的调整它。

/////////////////////////////////////////////////////////////////////////////////////////
//
// StorageAdapterGetRecordCount
//
// Purpose:
//      Retrieves the number of template records in the pipeline result set.
//
// Parameters:
//      Pipeline    -  Pointer to a WINBIO_PIPELINE structure associated with 
//                     the biometric unit performing the operation.
//      RecordCount -  Pointer to a variable that receives the number of template 
//                     records in the result set.
//
static HRESULT
WINAPI
StorageAdapterGetRecordCount(
    __inout PWINBIO_PIPELINE Pipeline,
    __out PSIZE_T RecordCount
    )
{
    HRESULT hr = S_OK;

    // Verify that pointer arguments are not NULL.
    if (!ARGUMENT_PRESENT(Pipeline) ||
        !ARGUMENT_PRESENT(RecordCount))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline.
    PWINBIO_STORAGE_CONTEXT storageContext = (PWINBIO_STORAGE_CONTEXT)Pipeline->StorageContext;

    // Verify the pipeline state.
    if (storageContext == NULL || storageContext->FileHandle == INVALID_HANDLE_VALUE)
    {
        hr =  WINBIO_E_INVALID_DEVICE_STATE;
        goto cleanup;
    }

    // Call a custom function (_ResultSetGetCount) to retrieve the number of
    // records that the most recent query left in the result set.
    hr = _ResultSetGetCount( &storageContext->ResultSet, RecordCount);

cleanup:

    return hr;
}

要求

   
最低受支持的客户端 Windows 7 [仅限桌面应用]
最低受支持的服务器 Windows Server 2008 R2 [仅限桌面应用]
目标平台 Windows
标头 winbio_adapter.h (包括 Winbio_adapter.h)

另请参阅

插件函数

StorageAdapterQueryByContent

StorageAdapterQueryBySubject