Interfaccia IMDEmbedded

L'interfaccia IMDEmbedded è un'interfaccia pubblica utilizzata per gestire un database PowerPivot incorporato o un database modello tabulare. L'interfaccia eredita dall'interfaccia IPersistStream e consente di effettuare le operazioni seguenti:

  • Ottenere un identificatore per il flusso incorporato nel documento contenitore.

  • Impostare l'URL del documento contenitore.

  • Impostare un flag per specificare se l'applicazione in cui viene eseguito l'incorporamento è in ambiente host.

  • Impostare il percorso dei file temporanei utilizzati dall'applicazione in cui viene eseguito l'incorporamento.

  • Annullare l'operazione incorporata corrente.

  • Ottenere le dimensioni stimate (in byte) del flusso per il salvataggio dell'oggetto incorporato. Ereditato da IPersistStream.

  • Verificare se il database incorporato è stato modificato rispetto all'ultimo salvataggio. Ereditato da IPersistStream.

  • Caricare il database incorporato nel motore locale o in-process. Ereditato da IPersistStream.

  • Salvare il database locale o in-process nel flusso incorporato del documento contenitore. Ereditato da IPersistStream.

Riferimento

Il riferimento riportato di seguito documenta l'interfaccia IMDEmbedded come presentata nel file di intestazione msmd.h.

File di origine: PXOEmbeddedData.idl

[
  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();
};

IMDEmbeddedData::GetStreamIdentifier

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

Descrizione

Ottiene l'identificatore utilizzato dall'applicazione host per il flusso incorporato nel documento contenitore.

Parametri

  • out_pbstrStreamId
    Specifica la posizione dell'identificatore di flusso.

Valore restituito

  • S_OK
    L'identificatore di flusso è stato restituito correttamente.

  • S_FALSE
    Non esiste alcun identificatore di flusso.

  • E_FAIL
    Si è verificato un errore durante l'accesso all'identificatore di flusso.

Osservazioni

Per verificare se la connessione corrente contiene un database incorporato, l'utente deve controllare il valore della proprietà DBPROP_MSMD_EMBEDDED_DATA dalle proprietà di connessione di OLE DB.

I valori possibili per DBPROP_MSMD_EMBEDDED_DATA sono:

Nome

Valore

Definizione

DBPROPVAL_EMBED_NONE

0x00

Nessun database incorporato disponibile

DBPROPVAL_EMBED_EMBEDDED

0x01

L'applicazione corrente contiene il database incorporato

DBPROPVAL_EMBED_LINKED

0x02

Il database incorporato è ospitato in un'applicazione remota, ad esempio SharePoint Server)

Origine

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

IMDEmbeddedData::SetContainerURL

HRESULT SetContainerURL (
    [in] BSTR in_bstrURL
    )

Descrizione

Viene impostato l'URL per il file in cui è contenuto il flusso incorporato.

Parametri

  • in_bstrURL
    Specifica l'URL per il documento contenitore.

Valore restituito

  • S_OK
    L'URL del contenitore è stato impostato correttamente.

  • E_FAIL
    Si è verificato un errore durante l'impostazione dell'URL del contenitore.

Origine

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

IMDEmbeddedData::SetHosted

HRESULT SetHosted (
    [in] BOOL in_fIsHosted
    )

Descrizione

Impostare un flag per specificare se l'applicazione in cui viene eseguito l'incorporamento è in ambiente host.

Parametri

  • in_ftHosted
    TRUE se il chiamante è in un ambiente host in un'applicazione di servizio (come IIS).

Valore restituito

  • S_OK
    Il flag è stato impostato correttamente.

  • E_FAIL
    Si è verificato un errore durante l'impostazione del flag.

Origine

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

IMDEmbeddedData::SetTempDirPath

HRESULT SetTempDirPath (
    [in] BSTR in_bstrPath
    )

Descrizione

Impostare il percorso dei file temporanei utilizzati dall'applicazione in cui viene eseguito l'incorporamento.

Parametri

  • in_bstrPath
    Il percorso dei file temporanei utilizzato dall'applicazione host.

Valore restituito

  • S_OK
    La directory dei file temporanei è stata impostata correttamente.

  • E_FAIL
    Si è verificato un errore durante l'impostazione del percorso.

Origine

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

IMDEmbeddedData::Cancel

HRESULT Cancel ( void )

Descrizione

Annulla l'operazione del database incorporato corrente.

Parametri

Nessuno.

Valore restituito

  • S_OK
    L'operazione è stata annullata correttamente.

  • DB_E_CANTCANCEL
    Non è in corso alcuna operazione annullabile.

  • E_FAIL
    Si verificato un errore durante l'annullamento dell'operazione incorporata.

Origine

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

IMDEmbeddedData::GetSizeMax (IPersistStream::GetSizeMax)

HRESULT GetSizeMax (
    [out] ULARGE_INTEGER * out_pcbSize
    )

Descrizione

Ottiene la dimensione stimata (in byte) del flusso per il salvataggio dell'oggetto incorporato. Ereditato da IPersistStream.

Parametri

  • in_bstrPath
    La dimensione stimata (in byte) dell'immagine del database incorporato.

Valore restituito

  • S_OK
    La dimensione è stata ottenuta correttamente.

  • E_FAIL
    Errore durante il calcolo della dimensione.

IMDEmbeddedData::IsDirty (IPersistStream::IsDirty)

HRESULT IsDirty ( void )

Descrizione

Verifica se il database incorporato è stato modificato rispetto all'ultimo salvataggio. Ereditato da IPersistStream.

Parametri

Nessuno

Valori restituiti

  • S_OK
    Il database è stato modificato rispetto all'ultimo salvataggio.

  • S_FALSE
    Il database non è stato modificato rispetto all'ultimo salvataggio.

  • E_FAIL
    Si è verificato un errore durante il recupero dello stato del database.

IMDEmbeddedData::Load (IPersistStream::Load)

HRESULT Load ( 
    [in] IStream * in_pStm 
    )

Descrizione

Carica il database incorporato sul motore locale o in-process. Ereditato da IPersistStream.

Parametri

  • in_pStm
    Un puntatore a un'interfaccia del flusso da cui caricare il database incorporato.

Valori restituiti

  • S_OK
    Il database è stato caricato correttamente.

  • E_OUTOFMEMORY
    Memoria insufficiente per il caricamento del database.

  • E_FAIL
    Si verificato un errore durante il caricamento del database, diverso da E_OUTOFMEMORY.

IMDEmbeddedData::Save (IPersistStream::Save)

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

Descrizione

Salva il database locale o in-process nel flusso incorporato del documento contenitore. Ereditato da IPersistStream.

Parametri

  • in_pStm
    Un puntatore a un'interfaccia del flusso in cui salvare il database incorporato.

  • in_fClearDirty
    Un flag che indica se il flag modificato deve essere eliminato dopo questa operazione.

Valori restituiti

  • S_OK
    Il database è stato salvato correttamente.

  • STG_E_CANTSAVE
    Si verificato un errore durante il salvataggio del database, diverso da STG_E_MEDIUMFULL.

  • STG_E_MEDIUMFULL
    Non è possibile salvare il database perché lo spazio sul dispositivo di memorizzazione è esaurito.