CeCreateDatabaseWithProps (EDB)
A version of this page is also available for
4/8/2010
This function creates a new database in a mounted volume.
Syntax
CEOID CeCreateDatabaseWithProps(
PCEGUID pGuid,
CEDBASEINFOEX* pInfo,
DWORD cProps,
CEPROPSPEC* prgProps
);
Parameters
- pGuid
[in] CEGUID of the mounted volume in which to create the database. You can mount a volume by calling the CeMountDBVolEx (EDB) function.
- pInfo
[in] Pointer to the CEDBASEINFOEX (EDB) structure that specifies the properites of the database.
- cProps
[in] Number of elements in the prgProps array.
- prgProps
[in] Array of CEPROPSPEC (EDB) structures. This array specifies the properties to create in the new database. In EDB, you must define properties before you can write them.
Return Value
The object indentifier (OID) of the new database indicates success. NULL indicates failure. To get extended error information, call GetLastError. The following table shows possible values.
Return Value | Description |
---|---|
E_FAIL |
The szDbaseName member of the CEDBASEINFOEX (EDB) structure is larger than CEDB_MAXDBASENAMLEN. |
ERROR_ACCESS_DENIED |
An attempt was made to create a database with two primary key sort orders. |
ERROR_ALREADY_EXISTS |
The prgProps parameter contains a property for which the specified ID or name already exists. Also occurs if you try to add more than one AUTO_xxx property to a database. |
ERROR_BAD_LENGTH |
A property name is more than 128 characters. |
ERROR_DISK_FULL |
There is not enough disk space to create the database. |
ERROR_DUP_NAME |
A database already exists with the specified name. |
ERROR_INVALID_PARAMETER |
One or more parameters are not valid. |
ERROR_NOT_FOUND |
The volume specified by pGuid does not exist. |
ERROR_NOT_SUPPORTED |
The specified CEDBASEINFOEX (EDB) structure contains either CEDB_VALIDMODTIME or CEDB_SYSTEMDB. Neither of these values is supported by EDB. |
Remarks
The ERROR_INVALID_PARAMETER is returned in the following situations:
- The pGuid parameter is set to NULL.
- The pInfo parameter is set to NULL.
- The wVersion is not equal to CEDBASEINFO_VERSION.
- The dwFlags does not have the CEDB_VALIDNAME flag. EDB requires that a name be supplied when creating a database.
- The szDbaseName is empty or contains all spaces.
- The dwFlags has the CEDB_VALIDSORTSPEC flag, wNumSortOrder is greater than CE_MAXSORTORDER (16).
- There are sort orders specified, and any of the elements in rgSortSpecs are not valid. The following members of a SORTORDERSPECEX (EDB) structure must be valid:
- The wVersion member must be set to SORTORDERSPECEX_VERSION.
- The wNumProps member cannot be greater than CE_MAXSORTPROP (16).
- The property IDs in the rgPropID member must all have valid CEDB data types from the CEVT_xxx enumeration.
- The property cannot be a CEVT_STREAM data type. You cannot create sort orders on streams.
- The cProps parmameter is not set to zero and prgProps is set to NULL.
- The CeAddDatabaseProps (EDB) function, which is called by this function, returns an error.
Sort Order
If sort orders are specified in pInfo, this function automatically creates those sort orders. Any properties included in those sort orders are automatically added to the property set supported by the database. You can add other properties by using the CeAddDatabaseProps (EDB) function. Because sort orders increase the system resources needed to perform each insert and delete operation, keep the number of sort orders to a minimum. You can use the CeSetDatabaseInfoEx (EDB) function to change the sort order.
CEDB and EDB Function Differences
The are the major differences between this function and the CEDB equivalent function:
- The OID returned by this function is not recognized by the Windows Embedded CE OS as an object-store OID. You can use this OID only in other EDB functions.
- Because a property must exist in an EDB database before it can be written to or must be created during the first write, this function enables you to define the properties when creating a database. The properties can be changed at a later time by using CeAddDatabaseProps and CeRemoveDatabaseProps.
- In EDB, if you do not specify a sort order for the database, no sort order is created by default.
- There is no system volume in EDB.
Requirements
Header | windbase.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 5.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
EDB Functions
CeMountDBVolEx (EDB)
CeAddDatabaseProps (EDB)
CeRemoveDatabaseProps (EDB)
CeSetDatabaseInfoEx (EDB)
CEDBASEINFOEX (EDB)
CEPROPSPEC (EDB)