Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IMDEmbedded Interface

 

Applies To: SQL Server 2016 Preview

The IMDEmbedded interface is a public interface used to manage an embedded Power Pivot database or a tabular model database. The interface inherits from the IPersistStream interface. The interface allows for the following operations:

  • Get an identifier to the embedded stream in the container document.

  • Set the URL of the containing document.

  • Set a flag to indicate if the embedding application is in a hosted environment.

  • Set the path to temporary files used by the embedding application.

  • Cancel the current embedded operation.

  • Get the estimated size (in bytes) of the stream to save the embedded object. Inherited from IPersistStream.

  • Verify if the embedded database has changed since it was last saved. Inherited from IPersistStream.

  • Load the embedded database to the local or in-process engine. Inherited from IPersistStream.

  • Save the local or in-process database to the embedded stream in the container document. Inherited from IPersistStream.

The following reference documents the IMDEmbedded interface as presented in msmd.h header file.

[
  local,                          
  object,                         
  uuid(6B6691CF-5453-41c2-ADD9-4F320B7FD421),                     
  pointer_default(unique)         
]
interface IMDEmbeddedData : IPersistStream
{
 [id(1), helpstring("Set flag indicating if the application is in a hosted environment")] 
 HRESULT SetHosted(
  [in] BOOL in_fIsHosted);

 [id(2), helpstring("Set the URL for the document containing the embedded stream")] 
 HRESULT SetContainerURL(
  [in] BSTR in_bstrURL);

 [id(3), helpstring("Get identifier used to look up embedded stream in container document")] 
 HRESULT GetStreamIdentifier(
  [out, retval] BSTR* out_pbstrStreamId);

 [id(4), helpstring("Set the path used by the embedding application for temporary files")] 
 HRESULT SetTempDirPath(
  [in]  BSTR in_bstrPath);

 [id(5), helpstring("Cancel the current operation")] 
 HRESULT Cancel();
};

HRESULT GetStreamIdentifier (
    [out, retval] BSTR * out_pbstrStreamId
    )

Gets the identifier used by the host application to the embedded stream in the container document.

out_pbstrStreamId

Specifies the location of the stream identifier.

S_OK

The stream identifier was successfully returned.

S_FALSE

There is no stream identifier.

E_FAIL

An error occurred accessing the stream identifier.

To verify if the current connection contains an embedded database, the user should check the value of the DBPROP_MSMD_EMBEDDED_DATA property from the OLE DB connection properties.

The possible values for DBPROP_MSMD_EMBEDDED_DATA are:

Name

Value

Definition

DBPROPVAL_EMBED_NONE

0x00

No embedded database available

DBPROPVAL_EMBED_EMBEDDED

0x01

The current application contains the embedded database

DBPROPVAL_EMBED_LINKED

0x02

The embedded database is hosted in a remote application (i.e. SharePoint Server)

[id(1), helpstring("Get identifier used to look up embedded stream in container document")] 
 HRESULT GetStreamIdentifier(
  [out, retval] BSTR* out_pbstrStreamId);

HRESULT SetContainerURL (
    [in] BSTR in_bstrURL
    )

Sets the URL for the file containing the embedded stream.

in_bstrURL

Specifies the URL for the containing document.

S_OK

The container URL was successfully set.

E_FAIL

An error occurred while setting the container URL.

[id(2), helpstring("Set the URL for the document containing the embedded stream")] 
 HRESULT SetContainerURL(
  [in] BSTR in_bstrURL);

HRESULT SetHosted (
    [in] BOOL in_fIsHosted
    )

Set a flag to indicate if the embedding application is in a hosted environment.

in_ftHosted

TRUE if caller is in a hosted in a service application (like IIS).

S_OK

The flag was successfully set.

E_FAIL

An error occurred while setting the flag.

[id(5), helpstring("Set flag indicating if the application is in a hosted environment")] 
 HRESULT SetHosted(
  [in]  BOOL in_fIsHosted);

HRESULT SetTempDirPath (
    [in] BSTR in_bstrPath
    )

Set the path to temporary files used by the embedding application.

in_bstrPath

The path used by the host application for temporary files.

S_OK

The temporary file directory was successfully set.

E_FAIL

An error occurred while setting the path.

[id(4), helpstring("Set the path used by the host application for temporary files")] 
 HRESULT SetTempDirPath(
  [in]  BSTR in_bstrPath);

HRESULT Cancel ( void )

Cancels the current embedded database operation

S_OK

The operation was successfully cancelled.

DB_E_CANTCANCEL

No cancellable operation is currently in progress.

E_FAIL

An error occurred while cancelling the embedded operation.

[id(5), helpstring("Cancel the current operation")] 
 HRESULT Cancel();

HRESULT GetSizeMax (
    [out] ULARGE_INTEGER * out_pcbSize
    )

Gets the estimated size (in bytes) of the stream to save the embedded object. Inherited from IPersistStream.

in_bstrPath

The estimated size (in bytes) of the embedded database image.

S_OK

The size was successfully obtained.

E_FAIL

An error occurred while obtaining the size.

HRESULT IsDirty ( void )

Verifies if the embedded database has changed since it was last saved. Inherited from IPersistStream.

S_OK

The database has changed since it was last saved.

S_FALSE

The database has not changed since it was last saved.

E_FAIL

An error occurred while obtaining the database state.

HRESULT Load ( 
    [in] IStream * in_pStm 
    )

Loads the embedded database to the local or in-process engine. Inherited from IPersistStream.

in_pStm

A pointer to a stream interface from where to load the embedded database.

S_OK

The database was successfully loaded.

E_OUTOFMEMORY

Not enough memory to load the database.

E_FAIL

An error occurred while loading the database, different than E_OUTOFMEMORY.

HRESULT Save ( 
    [in] IStream * in_pStm,
    [in] BOOL in_fClearDirty
    )

Saves the local or in-process database to the embedded stream in the container document. Inherited from IPersistStream.

in_pStm

A pointer to a stream interface to where to save the embedded database.

in_fClearDirty

A flag that indicates whether the dirty flag should be cleared after this operation.

S_OK

The database was successfully saved.

STG_E_CANTSAVE

An error occurred while saving the database, different than STG_E_MEDIUMFULL.

STG_E_MEDIUMFULL

The database could not be saved because there is no space left on the storage device.

Community Additions

ADD
Show:
© 2015 Microsoft