Port to windows MinGW

port to Windows MinGW, only sqlite is supported now.