ICommandPersist::SaveCommand

OLE DB Programmer's Reference

Persists the current command definition.

HRESULT SaveCommand(    DBID    *pCommandID,    DWORD    dwFlags);

Parameters

pCommandID
[in]
The DBID to assign to the persisted command. If this is a null pointer and the command already has a DBID, the provider saves the current version with the same DBID. If this is a null pointer and the command does not already have a DBID, the provider assigns an ID to the command. The ID must be unique.
dwFlags
[in]
Options for persisting command definition. Providers return E_INVALIDARG if a flag the provider does not know is specified. You can use DBCOMMANDPERSISTFLAG_NOSAVE to associate or obtain a new DBID for the command without actually persisting the definition.

DBCOMMANDPERSISTFLAG_PERSISTVIEW
The command is to be persisted as a view. Views are row-returning objects that do not contain parameters or return values and can generally be used anywhere a base table is used. Views can be enumerated through the DBSCHEMA_VIEWS schema rowset.

DBCOMMANDPERSISTFLAG_PERSISTPROCEDURE
The command is to be persisted as a procedure. Procedures may or may not return rows and may or may not contain parameters or return values. Procedures can be enumerated through the DBSCHEMA_PROCEDURES schema rowset.

DBCOMMANDPERSISTFLAG_PERSISTVIEW and DBCOMMANDPERSISTFLAG_PERSISTPROCEDURE are mutually exclusive. If neither is specified, the provider persists the command as a default type.

Return Code

S_OK
The command was successfully saved.
DB_E_BADCOMMANDID
The DBID specified in *pCommandID was invalid.
DB_E_BADCOMMANDFLAGS
dwFlags was invalid.

In dwFlags, both DBCOMMANDPERSISTFLAG_PERSISTVIEW and DBCOMMANDPERSISTFLAG_PERSISTPROCEDURE were specified.

DBCOMMANDPERSISTFLAG_PERSISTVIEW was specified, and the command could not be persisted as a view.

DBCOMMANDPERSISTFLAG_PERSISTPROCEDURE was specified, and the command could not be persisted as a procedure.

DB_E_DUPLICATEID
The specified DBID already exists. If the provider supports the use of persisted commands as a source in a new command definition, DBIDs must be unique across persisted commands, procedures, tables, and views.
E_FAIL
A provider-specific error occurred.
E_INVALIDARG
pCommandID was a null pointer, or dwFlags was not valid.

Comments

ICommandPersist::SaveCommand saves the current command definition. It does not persist any open rowsets, current property values, or specified parameter information.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net