Made plugin start up.

Tested with sqlite database.
Also implemented changes for mysql/sqlite cross platform compat.
Not nice so far, but it will be cleaned up in time.