VgwDocFieldReadFreeFnc


Use the VgwDocFieldReadFreeFnc function to release resources, such as memory for data structures, acquired while reading external fields. The Verity engine calls your VgwDocFieldReadFreeFnc function after reading the fields.


Syntax

VdkError VgwDocFieldReadFreeFnc(
VgwDataTable   dataTable)

Arguments

 


dataTable

VgwDataTable   A pointer to the structure that was created in your driver’s VgwDocFieldReadFnc callback function.


Returns

This function must return one of the following error codes:

VdkSuccess for success

 

VdkError_* for a standard Verity Developer Kit API error as described in the Verity Developer’s Kit Programming Reference

 

VdkFail for a non-specific error

 


Discussion

In addition to the Verity engine calling your VgwDocFieldReadFreeFnc function when the fields are no longer needed, you can call VgwDocFieldReadFreeFnc directly; for example, if your VgwDocFieldReadFnc function results in an error, you may need to free resources allocated in VgwDocFieldReadFnc before terminating.

You should free the schema structure referenced by dataTable after first releasing all other resources referenced by it.


Example

static VdkError
VDK_CALLBACK VgwDocFieldReadFree(VgwDataTable pTable)
{
VdkUint4 i;
VdkUint2 j;

if (!pTable)
return VdkSuccess;

/*******************************************
* free the data created in VgwDocFieldRead
*******************************************/

if (pTable->values) {
for( i = 0; i < pTable->numRows; i++ )
for( j = 0; j < pTable->numColumns; j++ )
if(!(pTable->columnArray[j]->flags & VgwColumn_InLine))
free(pTable->values[i*pTable->numColumns+j]);
}

free(pTable);
return VdkSuccess;
}