Share via


ICommandStream::GetCommandStream

Returns the currently set interface pointer of a stream object containing a command.

Syntax

HRESULT GetCommandStream (
   IID         *piid,
   GUID        *pguidDialect,
   IUnknown   **ppCommandStream);

Parameters

  • piid
    [out]

    A pointer to memory where the provider returns an IID that specifies the type of object referenced by *ppCommandStream.

    If piid is a null pointer on input, the provider does not return the IID.

    If this method returns an error, *piid is set to IID_NULL.

  • pguidDialect
    [in/out]

    A pointer to memory containing a GUID that specifies the syntax and general rules for parsing the command stream ? that is, the dialect that will be used by the provider to interpret the statement. This is usually the dialect specified in ICommandStream::SetCommandStream.

    However, if DBGUID_DEFAULT is specified in SetCommandStream, the provider returns the particular dialect that it will use to interpret the statement. If the provider must choose between multiple dialects at execution time for a command that has been set with DBGUID_DEFAULT or if the provider is returning some provider-specific syntax that might be different from the command set in ICommandStream::SetCommandStream, it returns DBGUID_DEFAULT. Providers can define GUIDs for their own dialects.

    If ICommandStream::GetCommandStream returns an error, *pguidDialect is set to DB_NULLGUID.

    If pguidDialect is a null pointer on input, the provider does not return the dialect.

  • ppCommandStream
    [out]

    A pointer to memory where the command stream interface pointer is returned. If ICommandStream::GetCommandStream returns an error, *ppCommandStream is set to a null pointer.

Return Code

  • S_OK
    The method succeeded.

  • DB_S_DIALECTIGNORED
    The method succeeded, but the input value of pguidDialect was ignored. The text is returned in the dialect specified in ICommandStream::SetCommandStream or in a provider-specific dialect. The value returned in *pguidDialect represents that dialect.

  • E_FAIL
    A provider-specific error occurred.

  • E_INVALIDARG
    ppCommandStream was a null pointer.

  • E_OUTOFMEMORY
    The provider was unable to allocate sufficient memory to return the command stream.

  • DB_E_NOCOMMAND
    No command was currently set on the command object.

  • DB_E_CANTTRANSLATE
    The last command was set using ICommandText::SetCommandText, not ICommandStream::SetCommandStream.

See Also

Reference

ICommand::Execute

ICommandStream::SetCommandStream

ICommandText::GetCommandText