Export (0) Print
Expand All

EDB Data Types and Size Limits (Windows CE 5.0)

Windows CE 5.0
Send Feedback

EDB has been designed to support many of the features of both CEDB and Microsoft SQL Server 2005 Mobile Edition (SQL Server CE). Because of this, EDB supports more data types than CDEB, but it also has some size limits not imposed by CEDB.

Supported Data Types

EDB supports 13 data types, including all 9 data types supported by CEDB plus 4 additional data types. The following table shows the data types supported by EDB. The last 4 data types in the table are new to EDB, and are described in more detail in later sections of this topic.

Data TypeDescription
CEVT_BOOLA Boolean value
CEVT_I2A 16-bit signed integer
CEVT_I4A 32-bit signed integer
CEVT_LPWSTRA null-terminated string
CEVT_R8A 64-bit float
CEVT_UI2A 16-bit unsigned integer
CEVT_UI4A 32-bit unsigned integer
CEVT_STREAM(EDB only) A large binary stream of data
CEVT_RECID(EDB only) A 128-bit GUID uniquely identifying a record
CEVT_AUTO_I4(EDB only) A 32-bit signed integer (auto-generated)
CEVT_AUTO_I8(EDB only) A 64-bit signed integer (auto-generated)


A CEVT_STREAM data type is useful for storing larger data items, such as images or e-mail attachments, because stream data is stored on its own set of data pages within the database, not in the row. The CEVT_STREAM data type stores up to 256 bytes within a row; once the first 256 bytes are used, the stream data is automatically stored outside of the row.

Therefore, although EDB limits the maximum record size to 8 kilobytes (KB), the maximum size of a stream is not affected by this limit. It is, however, limited to 32 megabytes (MB), which is one-half the maximum size of a volume.

Using the CEVT_STREAM Data Type

Consider the following when working with the CEVT_STREAM data type:

  • The CEVT_STREAM data type requires more overhead than the other data types. Because most stream data is stored external to the physical row, retrieval of stream data requires extra page accesses.
  • Stream data can be read or written as a single entity or in smaller pieces. For more information on reading and writing stream data, see "Accessing the CEVT_STREAM Data Type" later in this topic.
  • Because stream data is stored outside of the row, it is possible for other operations to modify or delete the row while portions of the stream data are being accessed or modified. You can avoid this in two ways: by using transaction isolation levels, or by writing or reading the stream data as a single entity.
  • Stream data is not compressed by default, but it can be compressed by using the DB_PROP_COMPRESSED flag. The stream's compression cannot be altered using the CeSetDatabaseInfo function. Once the stream is compressed, you must access it in a single block.
  • The CEVT_STREAM data type cannot be used in a sort order.

Accessing the CEVT_STREAM Data Type

As with the CEVT_BLOB data type, you can read data from and write data to the CEVT_STREAM data type by using the CeReadRecordPropsEx and CeWriteRecordProps functions. However, when you read and write a stream using these functions, all of the stream data must be in memory at once (in the CEPROPVAL::val.blob member), which can be very inefficient if the stream is large. For this reason, four exposed stream functions let you efficiently access a large stream of data in smaller pieces: CeOpenStream, CeStreamRead, CeStreamWrite, and CeStreamSeek. Two other stream functions are also available when working with stream data: CeStreamSaveChanges and CeStreamSetSize.

Note   If the stream data is compressed, you cannot use the stream functions; you must use the CeReadRecordPropsEx and CeWriteRecordProps functions.

Reading Stream Data when CEDB_AUTOINCREMENT is Enabled

When you open a database using the CeOpenDatabaseInSession function, you can specify the CEDB_AUTOINCREMENT flag. If you set the CEDB_AUTOINCREMENT flag, then the current seek position is automatically incremented with each call to the CeReadRecordPropsEx function, whether you are reading stream data or non-stream data. However, the seek position is not incremented with each call to the CeStreamRead function. This can lead to unexpected behavior. To avoid this, your application should make any calls to the CeStreamRead function before calls to the CeReadRecordPropsEx function when you are using CEDB_AUTOINCREMENT.

The CEVT_RECID Data Type

The CEVT_RECID (record ID) data type provides an auto-generated, 128-bit CEGUID row identifier. These identifiers can be persisted and indexed. When using the CEVT_RECID data type consider the following rules:

  • You access the value of the CEVT_RECID typed property the same way that you access the value of a CEVT_BLOB typed property.
  • You can write an explicit CEGUID value to the CEVT_RECID property (column), but once the value is written, it cannot be modified.
  • A CEVT_RECID property cannot have null values.
  • The CEVT_RECID data type can be used in a sort order.

The CEVT_AUTO_I4 and CEVT_AUTO_I8 Data Types

The CEVT_AUTO_I4 and CEVT_AUTO_I8 data types provide auto-generated integers. The following numeric ranges apply to these data types:

Data typeRange
CEVT_AUTO_I4 0 to 2^31 (a 32-bit integer)
CEVT_AUTO_I8 0 to 2^63 (a 64-bit integer)

When using the CEVT_AUTO_I4 and CEVT_AUTO I8 data types, consider the following rules:

  • The values for the CEVT_AUTO properties are written automatically and cannot be updated.
  • Only one CEVT_AUTO data type can be used in a database.
  • The CEVT_AUTO data types can be used in a sort order.

Volume and Data Type Size Limits

When comparing the capacities of EDB and CEDB, the most noticeable differences are in the maximum record size and the supported sizes for the CEVT_BLOB and CEVT_LPWSTR data types. By using the new CEVT_STREAM data type, which stores data outside of the row, the size limitations of EDB are easily overcome.

The following table shows the size limits for several data types of EDB, CEDB, and SQL Server Mobile databases:

Data typeEDBCEDBSQL Server 2005 Mobile Edition
CEVT_BLOB8,000 bytes64 KB1.07 GB
CEVT_LPWSTR4,000 characters64 KBMaps to nchar/nvarchar
CEVT_STREAM32 MB (one-half of the maximum volume size)Not supportedMaps to image/ntext

The following table shows the size limits for several features of EDB, CEDB, and SQL Server CE databases:

FeatureEDBCEDBSQL Server 2005 Mobile Edition
Maximum volume size64 MB16 MB2.14 GB
Maximum record size8 KB (excluding stream data)128 KB4 KB
Maximum number of properties per database1,024No limit255
Maximum property name length128 charactersNot supported128 characters
Maximum volume name length(MAX_PATH - 13) charactersMAX_PATH flag128 characters
Maximum number of sort orders164249
Maximum number of properties in a sort order or index16310
Maximum key length in a sort order or index512 bytes512 bytes510 bytes
Default lock escalation value100Not supportedNot supported
Maximum number of concurrent transactions255Not supportedNot supported
Maximum password length40 charactersNot supported40 characters
Maximum number of open database handles256Not supportedNot supported

Note that EDB restricts the size of CEVT_LPWSTR and CEVT_BLOB data types to 4,000 characters and 8,000 bytes, respectively, while CEDB supports data sizes up to 64 KB. However, with the addition of the new CEVT_STREAM data type, you can now store much larger data values. In addition, although EDB has a maximum record size that is much smaller than that of CEDB, stream data is stored external to the row and is therefore not subject to this limit.

See Also

CeOpenStream | CeStreamRead | CeStreamWrite | CeStreamSeek | CeStreamSaveChanges | CeStreamSetSize

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.

© 2015 Microsoft