2010年10月24日 星期日

Something about EDB and CEDB

Although MSDN mentions that EDB is designed to replace CEDB, but I did not find documents descript about how to detect the database in my device is EDB or CEDB. And more important is, I do not how to use EDB APIs in my develop machine (When using VS2008 with SDK 6.0, it using CEDB APIs by default, and I don’t know how to switch it).

Finally, I got some post that really help me to solve my problem.

Using EDB instead of CEDB

Simply, pre-define EDB. That all.

http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesnative/thread/8d1b3006-8c7a-4c46-b9d0-73aa37e9e880/

It’s really a simple thing, but I don’t know why I cannot find it in MSDN document about EDB. However, I got it from MSDN forums…

There is another interest things mention in that post. Some EDB APIs (for example: CeMountDatabaseEx()) can handle EDB and CEDB database using different parameter. I am not sure how many APIs support this behavior.

EDB advantage does not be mentioned in MSDN

MSDN document has listed some advantages about EDN, like session support. But seems it missed one important reason.

http://blogs.msdn.com/b/ce_base/archive/2006/02/02/cedb-vs-edb.aspx

In Windows CE Base Team Blog, they mentions that CEDB is designed for RAM-base object store only. That means the performance of CEDB on persistent storages like flash is not good. And that’s why they design EDB to instead of CEDB.

I think this reason is very important about mobile development. But again, it missed in MSDN library. And this time, you need to refer their develop team blog…

Database version on my device

Back to my original question, my version of database used in my device?

I still cannot find the official document or post tell me how to do this. But I got a trick to identify that my device is using CEDB (很遜). And that device is using Window Mobile 6.1…

In CeOidGetInfoEx2() API, you need to set CEOIDINFO_VERSION in parameter poidinfo->wVersion, When we look back to CEOIDINFO_VERSION definition, you will see when you pre-define EDB, the version is 2, and it will be 1 for CEDB.

So, my trick is done. Using 2 in that parameter, this API only works with EDB database, and using 1 instead, this API only works with CEDB database.

And unfortunately, all database listed on my device using CEDB. According to the previous section in this port, the performance is bad…

Although I got the answers about my question; But, seems there are only bad news in this post (吐舌頭).

沒有留言:

張貼留言