Export (0) Print
Expand All

Member Functions (Properties and Methods)

SQL Server 2000

All SQL-DMO properties and methods are exposed as object member functions for the C/C++ application developer.

SQL-DMO properties are implemented using either one or two member functions depending on the modifiability of the property value. Read-only and write-only properties are implemented in a single function, a get or set. Read/write properties are exposed through both a get and a set function.

SQL-DMO property-exposing functions are consistently named. When a property supports value retrieval, the name of the member function exposing the property is formed from the word, Get, and the property name. When a property supports value modification, the name of the member function is formed from the word, Set, and the property name. For example, the functions implementing the read/write property LoginTimeout on the SQLServer object are GetLoginTimeout and SetLoginTimeout.

As with any COM function, SQL-DMO object member functions that expose properties return an HRESULT. A property value is retrieved through an indirect pointer. For example:

LPSQLDMOSERVER  pServer;
long            lLoginTimeout;

HRESULT         hr;

hr = pServer->GetLoginTimeout(&lLoginTimeout);
if (FAILED(hr))
    {
    // Handle get property error.
    }

SQL-DMO methods are exposed in the same fashion. For example, the EnumJobs method of the JobServer object lists those SQL Server Agent jobs matching the criteria specified in the filter object as shown here:

LPSQLDMOJOBSERVER       pJobServer = NULL;
LPSQLDMOQUERYRESULTS    PQR = NULL;
LPSQLDMOJOBFILTER       pJobFilter = NULL;
HRESULT                 hr;

// Create and connect object instance pSQLServer not shown.
hr = pSQLServer->GetJobServer(&pJobServer);

if (SUCCEEDED(hr))
    hr = pJobServer->GetJobFilter(&pJobFilter);

// Filter for Microsoft Search, full-text indexing jobs.
if (SUCCEEDED(hr))
    hr = pJobFilter->SetCategory(L"Full-Text");

// Get the job list...
if (SUCCEEDED(hr))
    hr = pJobServer->EnumJobs(&pQR, pJobFilter);

if (SUCCEEDED(hr))
    // ...display the results of job enumeration.

if (pQR != NULL)
    pQR->Release();

if (pJobFilter != NULL)
    pJobFilter->Release();

if (pJobServer != NULL)
    pJobServer->Release();

Many SQL-DMO method-implementing member functions define logical default values for the C++ using application developer. For more information about a specific property or method member function, see Properties or Methods.

Show:
© 2015 Microsoft