Context.ExecuteForPrepare Property

Gets a value that indicates whether the stored procedure is being called for preparation purposes.

네임스페이스: Microsoft.AnalysisServices.AdomdServer
어셈블리: msmgdsrv (in msmgdsrv.dll)

구문

‘선언
Public Shared ReadOnly Property ExecuteForPrepare As Boolean
public static bool ExecuteForPrepare { get; }
public:
static property bool ExecuteForPrepare {
    bool get ();
}
/** @property */
public static boolean get_ExecuteForPrepare ()
public static function get ExecuteForPrepare () : boolean

속성 값

true if the stored procedure is being called for preparation purposes; otherwise, false.

주의

Stored procedures and user-defined functions (UDFs) are called in "prepare mode" to determine the metadata necessary for creating the final, combined cellset or rowset. When running in "prepare mode," the stored procedure or UDF should not return data, but rather return immediately after constructing the data type that would normally be returned.

Stored procedures and UDFs can only be called in "prepare mode" if they have been attributed with the SafeToPrepareAttribute. If a stored procedure is called in "prepare mode" but the stored procedure has not been attributed, an exception will be raised.

UDFs that return DataTables are automatically prepared before the query is run.

In the following example, the stored procedure returns immediately after creating the data table when in "prepare mode":

[SafeToPrepare(true)]
public System.Data.DataTable GetPreparedTable()
{
    System.Data.DataTable results = new System.Data.DataTable();
    results.Columns.Add("A", typeof(int));
    results.Columns.Add("B", typeof(string));

    if (Context.ExecuteForPrepare)
    {
        // If preparing, return just the schema with no data
        return results;
    }

    //Otherwise return data
    object[] row = new object[2];
    row[0] = 1;
    row[1] = "A";
    results.Rows.Add(row);

    row[0] = 2;
    row[1] = "B";
    results.Rows.Add(row);

    return results;
}

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

Context Class
Context Members
Microsoft.AnalysisServices.AdomdServer Namespace