IContentListSchema::GetSchema

Commerce Server 2000
Ee797747.c++_off(en-US,CS.10).gif Ee797747.vb_on(en-US,CS.10).gif

Use this method to read the entire schema from a ContentListSchema object.

This is one of the two ContentListSchema methods that, in the interest of high performance, do not support a scriptable interface. The other method is SetSchema. They are only intended for use in C++.

Definition

HRESULT IContentListSchema::GetSchema(
long* pnCols,
CLCOL_DESCRIPTOR** prgColDesc
);

Parameters

pnCols

[out] A pointer to a long used to return the number of columns in the schema being returned. This value will be important in processing the array of column descriptors returned in the prgColDesc parameter.

prgColDesc

[out,size_is(,*pnCols)] The address of a pointer used to return the address of an array of CLCOL_DESCRIPTOR structures. These structures represent the entire schema, where each element in the array contains information regarding the column in that same position in the schema. For more information about the column descriptor structure, see ContentListSchema Object.

Return Values

This method returns an HRESULT indicating whether or not it completed successfully. See the Error Values section for more details.

Error Values

This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

Remarks

Care must be taken in how the memory returned by calls to the GetSchema method gets released. The following code sample illustrates the proper technique:

    // Declare variables for the GetSchema call.
long              cCols
CLCOL_DESCRIPTOR *pColDesc;

// Get the schema.
pContentListSchema->GetSchema(&cCols, &pColDesc);

// Use the returned schema as needed.

// When finished with the schema array,
// start by freeing the column name string memory.
for ( int i=0 ; I < cCols ; i++ ) {
    if ( NULL != pColDesc[i].pwszName ) {
        ::CoTaskMemFree(pColDesc[i].pwszName);
    }
}

// Then free the structure array memory.
::CoTaskMemFree(pColDesc);

  

See Also

ContentListSchema Object


All rights reserved.
Show: