Partager via


Database File (Compact 2013)

3/26/2014

The database (.db) files define databases in the Windows Embedded Compact-based object store.

Syntax

Database : "db_name" : hex_type : num_sort_order : <sort order specifier> 1
Record :
Field : field_hex_propid : value
End
End Database

Parameters

  • db_name
    This parameter specifies the database name.
  • hex_type
    This parameter specifies a hexadecimal-type identifier for the database, which allows you to search for the database.
  • num_sort_order
    This parameter specifies the number of sort orders (indexes) for the database. The maximum number of sort orders is 4.
  • <sort order specifier>
    A sort order specifier can be described in one of two ways:

    • Single - Single property sort order.
      This sample shows a sort order on a single property.
      < db_hex_propid> : <hex flags>
    • Multiple - A sort order with one or more properties.
      This sample shows a sort order on one to three properties. Specifying a <num sort properties> value of 1 is the same as the Single case in the preceding bullet.
      [ <num sort properties> : < db_hex_propid 1> : <hex flags 1> ... ]
  • db_hex_propid
    This parameter specifies the property identifier for a database sort order. The db_hex_propid parameter must be followed by a hex_flags parameter.
  • hex_flags
    This parameter defines the sort flags used to create a database sort order. The following flags are available:

    • 0
      Specifies ascending, case-sensitive, and unknown properties last
    • 1
      Specifies descending order
    • 2
      Specifies case-insensitive
    • 4
      Specifies unknown properties first

    In addition, hexadecimal flags can be any combination of the first three sort order types. For example, 3 specifies descending order and case-insensitive.

    The hex_flags parameters must be preceded by a db_hex_propid parameter.

  • field_hex_propid
    This parameter specifies the property identifier of the field.
  • value
    This parameter defines a string or a hexadecimal DWORD.

Remarks

When you cold boot your target device, Makeimg uses .db files to create default databases.

To include an existing database with an application that you have developed for the device or application, you can modify either Platform.db or Project.db.

To define or modify a database for an application, update the Project.db file with the following syntax.

The db_hex_propid and hex_flags parameters are used as a pair to describe one database sort order. Multiple pairs can be used. The number of sort orders specified must match the count given in num_sort_order.

For details about property identifiers and sorting, see the documentation for the Windows Embedded Compact-based database APIs.

When updating the .db files, you can use IF and ENDIF conditional blocks and, optionally, the NOT (!) operator. The use of these conditionals is identical to their use in .dat files, as described previously. Use the semicolon (;) to start a line of comments.

Example

A database for business contacts is created with a hexadecimal identifier of 1B and has three sort indexes.

Each of these indexes, as defined by the property identifiers 4001001f, 40020002, and 40030002, uses case-insensitive sort order.

The first record for the database contains six fields, each defined with its own property identifier and assigned a value.

Database: "Contacts Database" : 1B : 3 : 4001001f : 2 : 40020002 : 2 : 40030002 : 2 
Record :
Field : 4001001f : "Contact 1"
Field : 40020002 : 0
Field : 40030002 : 1
Field : 40040002 : 0
Field : 40050002 : 0
Field : 40060002 : 0
End
Record :
Field : 4001001f : "Contact 2"
Field : 40020002 : 0
Field : 40030002 : 1
Field : 40040002 : 0
Field : 40050002 : 0
Field : 40060002 : 0
End

This is equivalent to the following examples.

Database: "Contacts Database" : 1B : 3 : [ 1 : 4001001f : 2 ] : 40020002 : 2 : 40030002 : 2 
Record :
Field : 4001001f : "Contact 1"
Field : 40020002 : 0
Field : 40030002 : 1
Field : 40040002 : 0
Field : 40050002 : 0
Field : 40060002 : 0
End
Record :
Field : 4001001f : "Contact 2"
Field : 40020002 : 0
Field : 40030002 : 1
Field : 40040002 : 0
Field : 40050002 : 0
Field : 40060002 : 0
End

Database : "People3" : 3039
  : 4 : [ 3 : 0065001F : 2 : 0066001F : 4 : 00670002 : 0 ]
      : [ 1 : 00670002 : 1 ]
      : [ 1 : 00680002 : 4 ]
      : [ 1 : 006A0013 : 1 ]
Record : 
Field : 0065001F : "Smith"
Field : 0066001F : "Bob"
Field : 00670002 : 22
Field : 006A0013 : 4E20
End Record
Record : 
Field : 0065001F : "Smith"
Field : 0066001F : "Mary"
Field : 00670002 : 16
Field : 006A0013 : EA60
End Record
End Database

Here is an equivalent way of describing the database header.

Database : "People3" : 3039
  : 4 : [ 3 : 0065001F : 2 : 0066001F : 4 : 00670002 : 0 ]
      : 00670002 : 1
      : 00680002 : 4
      : 006A0013 : 1

See Also

Reference

Run-Time Image Configuration Files