Fixed CADs to work with the new SQLite libraries.

Also created a MasterCAD with the connection settings, to be the superclass of all CADs.