Add hooks for database open and pragma handling.

Change-Id: I70834f1a088eb69416e1bd32f6cc5b477c4ba203