I have already send you the Database Update Framework a long time ago - and if you don't have it still - you can download it.

The API functions there works just fine for both the embedded and SQL databases. Why don't you have a look there instead of reinventing the wheel? Just a thought.