Partager via


CeAddDatabaseProps (EDB) (Windows Embedded CE 6.0)

1/6/2010

This function is used to add properties to an existing database.

This function does not work with CEDB databases. For more information about CEDB, see CEDB Reference.

Syntax

BOOL CeAddDatabaseProps(
  PCEGUID pGuid,
  CEOID oidDb,
  DWORD cProps,
  CEPROPSPEC* prgProps
);

Parameters

  • pGuid
    [in] CEGUID of the mounted volume in which the database identified by the oidDbparameter resides. You can mount a volume by using the CeMountDBVolEx (EDB) function.
  • oidDb
    [in] Object identifier (OID) of the database in which to add property IDs. This database must exist in the volume specified by the pGuid parameter. This OID must have been generated by the CeCreateDatabaseWithProps (EDB) function.
  • cProps
    [in] Number of elements in the prgProps array.
  • prgProps
    [in] Array of CEPROPSPEC (EDB) structures. This array specifies the set of properties to create in the new database. In EDB, you must define properties before you can write them by using the CeWriteRecordProps (EDB) function.

Return Value

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table shows possible values:

Return Value Description

ERROR_ACCESS_DENIED

You attempted to create a database with two primary key sort orders.

ERROR_ALREADY_EXISTS

An element of prgProps contains a property for which the ID or name already exists. A name is automatically generated if not specified.

ERROR_INVALID_PARAMETER

One of the following conditions exists:

  • The pGuid parameter is set to NULL.
  • The oidDb parameter is set to NULL.
  • The cProps parameter is set to zero.
  • The prgProps parameter is set to NULL.
  • Any of the elements in prgProps are not valid. The following members of the CEPROPSPEC structure must be valid:
    • wVersion must be set to CEPROPSPEC _VERSION.
    • propid must be a valid CEVT_xxx data type.
    • The dwFlags member for a property can include DB_PROP_COMPRESSED only if the property is a CEVT_STREAM.

ERROR_NOT_ENOUGH_MEMORY

There is not enough memory available to create the volume.

ERROR_NOT_FOUND

The volume specified by pGuid does not exist, or the database specified by oidDbdoes not exist in the specified volume.

ERROR_NOT_SUPPORTED

An attempt was made to add more than the maximum supported number of properties. EDB supports up to 1024 properties.

ERROR_SHARING_VIOLATION

Another thread currently has the database open.

Remarks

This function succeeds only if the database is not open.

You must define the properties of a database before you can write data, using CeWriteRecordProps, unless the database is currently empty.

Properties can also be defined by calling CeCreateDatabaseWithProps. If you create any sort orders when calling CeCreateDatabaseWithProps, EDB internally creates all of the sort properties.

If one of the property IDs specified in the prgProps array already exists in the database, this function succeeds, and GetLastError returns ERROR_ALREADY_EXISTS. All other property IDs that do not exist are still added.

To remove properties from a database and potentially reduce the size of a volume, use the CeRemoveDatabaseProps (EDB) function.

Requirements

Header windbase.h
Library coredll.lib
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

EDB Functions
CeMountDBVolEx (EDB)
CeWriteRecordProps (EDB)
CeCreateDatabaseWithProps (EDB)
CeRemoveDatabaseProps (EDB)
CEPROPSPEC (EDB)

Concepts

EDB Schema Support