private DDL SelectDDL(String databaseType)
        {
            DDL DDL;

            if (databaseType == "MySql")
                if (GlobalSettings.ApplicationSettings.DatabaseVersion == "5.6")
                    DDL = new MySql_5_6_DDL();
                else
                    DDL = new MySql_DDL();
            else if (databaseType == "Jet")
                DDL = new Jet_DDL();
            else if (databaseType == "SQLite")
                DDL = new SQLite_DDL();
            else if (databaseType == "SQL Server")
                DDL = new SQLServer_DDL();
            else
                throw new Exception("Unexpected database type: " + databaseType);
            return DDL;
        }
        private bool PopulateEmptyDatabase(GenConnection con, String databaseType)
        {
            DDL DDL;

            if (databaseType == "MySql")
                if (GlobalSettings.ApplicationSettings.DatabaseVersion == "5.6")
                    DDL = new MySql_5_6_DDL();
                else
                    DDL = new MySql_DDL();
            else if (databaseType == "Jet")
                DDL = new Jet_DDL();
            else if (databaseType == "SQLite")
                DDL = new SQLite_DDL();
            else if (databaseType == "SQL Server")
                DDL = new SQLServer_DDL();
            else
                throw new Exception("Unexpected database type: " + databaseType);

            bool success = true;

            if (success && !RelationExists(con, "devicetype"))
                success &= CreateRelation(DDL.CurrentTable_devicetype, con);
            if (success && !RelationExists(con, "device"))
                success &= CreateRelation(DDL.CurrentTable_device, con);
            if (success && !RelationExists(con, "devicefeature"))
                success &= CreateRelation(DDL.CurrentTable_devicefeature, con);
            if (success && !RelationExists(con, "devicereading_energy"))
                success &= CreateRelation(DDL.CurrentTable_devicereading_energy, con);
            if (success && !RelationExists(con, "devicedayoutput_v"))
                success &= CreateRelation(DDL.CurrentView_devicedayoutput_v, con);
            if (success && !RelationExists(con, "pvoutputlog"))
                success &= CreateRelation(DDL.CurrentTable_pvoutputlog, con);

            if (success && !RelationExists(con, "version"))
                success &= CreateRelation(DDL.CurrentTable_version, con);

            if (success)
                UpdateVersion("2", "0", "0", "0", con);

            return success;
        }