2010年10月13日 星期三

Windows Mobile (CE) Database Study

Notes about study CEDB and EDB on Windows Mobile (CE).

Terminology

When study MSDN about CEDB and EDB, some wording keep confusing me. Cause CEDE and EDB using different terminology with other common database engine.

EDB and CEDB term SQL Server Compact term
Sort order Index
Data type Data type
Property Column
Record Row
Database Table
Volume Database

Especially the Database mapping to Table one keep confusing me on reading the document…

Database Volume

We can see CEDB and EDB as a file-base database like Sqlite. A volume is a file including multi database (table, you see why I am confusing).

Before using the database, you need to mount (‘open’ in normal terminology) the volume. If the volume is not exists, you need to create (create a new file using CEDB API) first. When you don’t need the database anymore, you need to un-mount (‘close’) the volume.

There is a default database volume in CE (Mobile) system used by object store. It will be mounted when system start up and released when system shutdown (that means the file will be locked in whole running cycle).

And applications can create volume in any location they wanted, including external storage (like SD card).

The EDB and CEDB APIs using CEGUID as identity to access a volume, database or even a record. For the detail usage, need to refer to each method’s document for detail.

Database Backup / Restore

Obviously, we need different procedures to handle the default volume (object store) and others.

For extra created database volume, we just need to stop all process which using these database volume. And then we can just follow the root file system backup & restore procedure. It should be a easy one.

For object store database volume….

If I can find the way to un-mount the object store, it should be easier to handle it like other database volume. But seems it’s not so easy to find the way.

Otherwise, we can enumerate all object store database and dump them into our format. And then push them back when restore. I am not sure if there is some database has write-protect, but I think it should be not….

沒有留言:

張貼留言