SqlitePulse.createTable C# (CSharp) Method

createTable() protected method

protected createTable ( string tableName ) : void
tableName string
return void
    protected override void createTable(string tableName)
    {
        dbcmd.CommandText =
            "CREATE TABLE " + tableName + " ( " +
            "uniqueID INTEGER PRIMARY KEY, " +
            "personID INT, " +
            "sessionID INT, " +
            "type TEXT, " +
            "fixedPulse FLOAT, " +
            "totalPulsesNum INT, " +
            "timeString TEXT, " +
            "description TEXT, " +
            "simulated INT )";
        dbcmd.ExecuteNonQuery();
    }

Usage Example

Beispiel #1
0
    public static bool ConvertToLastChronojumpDBVersion()
    {
        LogB.SQL("SelectChronojumpProfile ()");

        //if(checkIfIsSqlite2())
        //	convertSqlite2To3();

        addChronopicPortNameIfNotExists();

        currentVersion = SqlitePreferences.Select("databaseVersion");

        //LogB.SQL("lastDB: {0}", Convert.ToDouble(lastChronojumpDatabaseVersion));
        //LogB.SQL("currentVersion: {0}", Convert.ToDouble(currentVersion));

        bool returnSoftwareIsNew = true; //-1 if software is too old for database (moved db to other computer)
        if(
                Convert.ToDouble(Util.ChangeDecimalSeparator(lastChronojumpDatabaseVersion)) ==
                Convert.ToDouble(Util.ChangeDecimalSeparator(currentVersion)))
            LogB.SQL("Database is already latest version");
        else if(
                Convert.ToDouble(Util.ChangeDecimalSeparator(lastChronojumpDatabaseVersion)) <
                Convert.ToDouble(Util.ChangeDecimalSeparator(currentVersion))) {
            LogB.SQL("User database newer than program, need to update software");
            returnSoftwareIsNew = false;
        } else {
            LogB.Warning("Old database, need to convert");
            LogB.Warning("db version: " + currentVersion);

            bool needToConvertPersonToSport = false;
            bool jumpFallAsDouble = false;
         		bool runAndRunIntervalInitialSpeedAdded = false;
            bool addedRSA = false;

            SqliteJumpRj sqliteJumpRjObject = new SqliteJumpRj();
            SqliteRunInterval sqliteRunIntervalObject = new SqliteRunInterval();
            SqliteReactionTime sqliteReactionTimeObject = new SqliteReactionTime();
            SqlitePulse sqlitePulseObject = new SqlitePulse();
            SqliteMultiChronopic sqliteMultiChronopicObject = new SqliteMultiChronopic();
            SqlitePersonSessionOld sqlitePersonSessionOldObject = new SqlitePersonSessionOld();

            if(currentVersion == "0.41") {
                Sqlite.Open();

                //SqlitePulse.createTable(Constants.PulseTable);
                sqlitePulseObject.createTable(Constants.PulseTable);
                SqlitePulseType.createTablePulseType();
                SqlitePulseType.initializeTablePulseType();

                SqlitePreferences.Update ("databaseVersion", "0.42", true);
                LogB.SQL("Converted DB to 0.42 (added pulse and pulseType tables)");

                Sqlite.Close();
                currentVersion = "0.42";
            }

            if(currentVersion == "0.42") {
                Sqlite.Open();
                SqlitePulseType.Insert ("Free:-1:-1:free PulseStep mode", true);
                SqlitePreferences.Insert ("language", "es-ES");
                SqlitePreferences.Update ("databaseVersion", "0.43", true);
                LogB.SQL("Converted DB to 0.43 (added 'free' pulseType & language peference)");
                Sqlite.Close();
                currentVersion = "0.43";
            }

            if(currentVersion == "0.43") {
                Sqlite.Open();
                SqlitePreferences.Insert ("showQIndex", "False");
                SqlitePreferences.Insert ("showDjIndex", "False");
                SqlitePreferences.Update ("databaseVersion", "0.44", true);
                LogB.SQL("Converted DB to 0.44 (added showQIndex, showDjIndex)");
                Sqlite.Close();
                currentVersion = "0.44";
            }

            if(currentVersion == "0.44") {
                Sqlite.Open();
                SqlitePreferences.Insert ("allowFinishRjAfterTime", "True");
                SqlitePreferences.Update ("databaseVersion", "0.45", true);
                LogB.SQL("Converted DB to 0.45 (added allowFinishRjAfterTime)");
                Sqlite.Close();
                currentVersion = "0.45";
            }

            if(currentVersion == "0.45") {
                Sqlite.Open();
                SqliteJumpType.JumpTypeInsert ("Free:1:0:Free jump", true);
                SqlitePreferences.Update ("databaseVersion", "0.46", true);
                LogB.SQL("Added Free jump type");
                Sqlite.Close();
                currentVersion = "0.46";
            }

            if(currentVersion == "0.46") {
                Sqlite.Open();

                //SqliteReactionTime.createTable(Constants.ReactionTimeTable);
                sqliteReactionTimeObject.createTable(Constants.ReactionTimeTable);

                SqlitePreferences.Update ("databaseVersion", "0.47", true);
                LogB.SQL("Added reaction time table");
                Sqlite.Close();
                currentVersion = "0.47";
            }

            if(currentVersion == "0.47") {
                Sqlite.Open();

                //SqliteJumpRj.createTable(Constants.TempJumpRjTable);
                sqliteJumpRjObject.createTable(Constants.TempJumpRjTable);
                //SqliteRun.intervalCreateTable(Constants.TempRunIntervalTable);
                sqliteRunIntervalObject.createTable(Constants.TempRunIntervalTable);

                SqlitePreferences.Update ("databaseVersion", "0.48", true);
                LogB.SQL("created tempJumpReactive and tempRunInterval tables");
                Sqlite.Close();
                currentVersion = "0.48";
            }

            if(currentVersion == "0.48") {
                Sqlite.Open();

                SqliteJumpType.JumpTypeInsert ("Rocket:1:0:Rocket jump", true);

                string [] iniRunTypes = {
                    "Agility-20Yard:18.28:20Yard Agility test",
                    "Agility-505:10:505 Agility test",
                    "Agility-Illinois:60:Illinois Agility test",
                    "Agility-Shuttle-Run:40:Shuttle Run Agility test",
                    "Agility-ZigZag:17.6:ZigZag Agility test"
                };
                foreach(string myString in iniRunTypes) {
                    string [] s = myString.Split(new char[] {':'});
                    RunType type = new RunType();
                    type.Name = s[0];
                    type.Distance = Convert.ToDouble(s[1]);
                    type.Description = s[2];
                    SqliteRunType.Insert(type, Constants.RunTypeTable, true);
                }

                SqliteEvent.createGraphLinkTable();
                SqliteRunType.AddGraphLinksRunSimpleAgility();

                SqlitePreferences.Update ("databaseVersion", "0.49", true);
                LogB.SQL("Added graphLinkTable, added Rocket jump and 5 agility tests: (20Yard, 505, Illinois, Shuttle-Run & ZigZag. Added graphs pof the 5 agility tests)");

                Sqlite.Close();
                currentVersion = "0.49";
            }

            if(currentVersion == "0.49") {
                Sqlite.Open();
                SqliteJumpType.Update ("SJ+", "SJl");
                SqliteJumpType.Update ("CMJ+", "CJl");
                SqliteJumpType.Update ("ABK+", "ABKl");
                SqliteJump.ChangeWeightToL();
                SqliteJumpType.AddGraphLinks();
                SqliteJumpType.AddGraphLinksRj();
                SqlitePreferences.Update ("databaseVersion", "0.50", true);
                LogB.SQL("changed SJ+ to SJl, same for CMJ+ and ABK+, added jump and jumpRj graph links");
                Sqlite.Close();
                currentVersion = "0.50";
            }

            if(currentVersion == "0.50") {
                Sqlite.Open();
                SqliteRunType.AddGraphLinksRunSimple();
                SqliteRunIntervalType.AddGraphLinksRunInterval();
                SqlitePreferences.Update ("databaseVersion", "0.51", true);
                LogB.SQL("added graphLinks for run simple and interval");
                Sqlite.Close();
                currentVersion = "0.51";
            }

            if(currentVersion == "0.51") {
                Sqlite.Open();
                SqliteJumpType.Update ("CJl", "CMJl");
                SqliteEvent.GraphLinkInsert (Constants.JumpTable, "CMJl", "jump_cmj_l.png", true);
                SqliteEvent.GraphLinkInsert (Constants.JumpTable, "ABKl", "jump_abk_l.png", true);
                SqlitePreferences.Update ("databaseVersion", "0.52", true);
                LogB.SQL("added graphLinks for cmj_l and abk_l, fixed CMJl name");
                Sqlite.Close();
                currentVersion = "0.52";
            }

            if(currentVersion == "0.52") {
                Sqlite.Open();
                sqlitePersonSessionOldObject.createTable ();
                Sqlite.Close();

                //this needs the dbCon closed
                SqlitePersonSessionOld.moveOldTableToNewTable ();

                Sqlite.Open();
                SqlitePreferences.Update ("databaseVersion", "0.53", true);
                Sqlite.Close();

                LogB.SQL("created weightSession table. Moved person weight data to weightSession table for each session that has performed");
                currentVersion = "0.53";
            }

            if(currentVersion == "0.53") {
                Sqlite.Open();

                SqliteSport.createTable();
                SqliteSport.initialize();
                SqliteSpeciallity.createTable();
                SqliteSpeciallity.initialize();

                //SqlitePersonOld.convertTableToSportRelated ();
                needToConvertPersonToSport = true;

                SqlitePreferences.Update ("databaseVersion", "0.54", true);
                Sqlite.Close();

                LogB.SQL("Created sport tables. Added sport data, speciallity and level of practice to person table");
                currentVersion = "0.54";
            }
            if(currentVersion == "0.54") {
                Sqlite.Open();

                SqliteSpeciallity.InsertUndefined(true);

                SqlitePreferences.Update ("databaseVersion", "0.55", true);
                Sqlite.Close();

                LogB.SQL("Added undefined to speciallity table");
                currentVersion = "0.55";
            }
            if(currentVersion == "0.55") {
                Sqlite.Open();

                SqliteSessionOld.convertTableAddingSportStuff();

                SqlitePreferences.Update ("databaseVersion", "0.56", true);
                Sqlite.Close();

                LogB.SQL("Added session default sport stuff into session table");
                currentVersion = "0.56";
            }
            if(currentVersion == "0.56") {
                Sqlite.Open();

                //jump and jumpRj
                ArrayList arrayAngleAndSimulated = new ArrayList(1);
                arrayAngleAndSimulated.Add("-1"); //angle
                arrayAngleAndSimulated.Add("-1"); //simulated

                //run and runInterval
                ArrayList arraySimulatedAndInitialSpeed = new ArrayList(1);
                arraySimulatedAndInitialSpeed.Add("-1"); //simulated
                arraySimulatedAndInitialSpeed.Add("0"); //initial speed

                //others
                ArrayList arraySimulated = new ArrayList(1);
                arraySimulated.Add("-1"); //simulated

                conversionRateTotal = 9;
                conversionRate = 1;
                convertTables(new SqliteJump(), Constants.JumpTable, 9, arrayAngleAndSimulated, false);
                conversionRate ++;
                convertTables(new SqliteJumpRj(), Constants.JumpRjTable, 16, arrayAngleAndSimulated, false);
                conversionRate ++;
                convertTables(new SqliteRun(), Constants.RunTable, 7, arraySimulated, false);
                conversionRate ++;
                convertTables(new SqliteRunInterval(), Constants.RunIntervalTable, 11, arraySimulated, false);
                runAndRunIntervalInitialSpeedAdded = true;

                conversionRate ++;
                convertTables(new SqliteReactionTime(), Constants.ReactionTimeTable, 6, arraySimulated, false);
                conversionRate ++;
                convertTables(new SqlitePulse(), Constants.PulseTable, 8, arraySimulated, false);

                //reacreate temp tables for have also the simulated column
                conversionRate ++;
                Sqlite.dropTable(Constants.TempJumpRjTable);
                sqliteJumpRjObject.createTable(Constants.TempJumpRjTable);
                Sqlite.dropTable(Constants.TempRunIntervalTable);
                sqliteRunIntervalObject.createTable(Constants.TempRunIntervalTable);

                conversionRate ++;
                SqliteCountry.createTable();
                SqliteCountry.initialize();

                conversionRate ++;
                int columnsBefore = 10;
                bool putDescriptionInMiddle = false;
                ArrayList arrayPersonRaceCountryServerID = new ArrayList(1);
                if(needToConvertPersonToSport) {
                    columnsBefore = 7;
                    arrayPersonRaceCountryServerID.Add(Constants.SportUndefinedID.ToString());
                    arrayPersonRaceCountryServerID.Add(Constants.SpeciallityUndefinedID.ToString());
                    arrayPersonRaceCountryServerID.Add(Constants.LevelUndefinedID.ToString());
                    putDescriptionInMiddle = true;
                }
                arrayPersonRaceCountryServerID.Add(Constants.RaceUndefinedID.ToString());
                arrayPersonRaceCountryServerID.Add(Constants.CountryUndefinedID.ToString());
                arrayPersonRaceCountryServerID.Add(Constants.ServerUndefinedID.ToString());
                convertTables(new SqlitePersonOld(), Constants.PersonOldTable, columnsBefore, arrayPersonRaceCountryServerID, putDescriptionInMiddle);

                SqlitePreferences.Update ("databaseVersion", "0.57", true);
                Sqlite.Close();

                LogB.SQL("Added simulated column to each event table on client. Added to person: race, country, serverUniqueID. Convert to sport related done here if needed. Added also run and runInterval initial speed");
                currentVersion = "0.57";
            }
            if(currentVersion == "0.57") {
                Sqlite.Open();

                //check if "republic" is in country table
                if(SqliteCountry.TableHasOldRepublicStuff()){
                    conversionRateTotal = 4;
                    conversionRate = 1;
                    Sqlite.dropTable(Constants.CountryTable);
                    conversionRate ++;
                    SqliteCountry.createTable();
                    conversionRate ++;
                    SqliteCountry.initialize();
                    conversionRate ++;
                    LogB.SQL("Countries without kingdom or republic (except when needed)");
                }

                SqlitePreferences.Update ("databaseVersion", "0.58", true);
                Sqlite.Close();

                currentVersion = "0.58";
            }

            if(currentVersion == "0.58") {
                Sqlite.Open();
                conversionRateTotal = 2;
                conversionRate = 1;
                SqlitePreferences.Insert ("showAngle", "False");
                alterTableColumn(new SqliteJump(), Constants.JumpTable, 11);

                //jump fall is also converted to double (don't need to do at conversion to 0.76)
                jumpFallAsDouble = true;

                SqlitePreferences.Update ("databaseVersion", "0.59", true);
                LogB.SQL("Converted DB to 0.59 (added 'showAngle' to preferences, changed angle on jump to double)");
                conversionRate = 2;
                Sqlite.Close();
                currentVersion = "0.59";
            }

            if(currentVersion == "0.59") {
                Sqlite.Open();
                conversionRateTotal = 4;

                conversionRate = 1;
                SqlitePreferences.Insert ("volumeOn", "True");
                SqlitePreferences.Insert ("evaluatorServerID", "-1");

                conversionRate = 2;

                int columnsBefore = 8;
                ArrayList arrayServerID = new ArrayList(1);
                arrayServerID.Add(Constants.ServerUndefinedID.ToString());
                convertTables(new SqliteSession(), Constants.SessionTable, columnsBefore, arrayServerID, false);

                conversionRate = 3;
                SqliteEvent.SimulatedConvertToNegative();

                SqlitePreferences.Update ("databaseVersion", "0.60", true);
                LogB.SQL("Converted DB to 0.60 (added volumeOn and evaluatorServerID to preferences. session has now serverUniqueID. Simulated now are -1, because 0 is real and positive is serverUniqueID)");

                conversionRate = 4;
                Sqlite.Close();
                currentVersion = "0.60";
            }

            if(currentVersion == "0.60") {
                Sqlite.Open();
                conversionRateTotal = 3;
                conversionRate = 1;

                ArrayList arrayDS = new ArrayList(1);
                arrayDS.Add("-1"); //distancesString
                convertTables(new SqliteRunIntervalType(), Constants.RunIntervalTypeTable, 7, arrayDS, false);

                conversionRate = 2;

                //SqliteRunType.RunIntervalTypeInsert ("MTGUG:-1:true:3:false:Modified time Getup and Go test:1-7-19", true);
                RunType type = new RunType();
                type.Name = "MTGUG";
                type.Distance = -1;
                type.TracksLimited = true;
                type.FixedValue = 3;
                type.Unlimited = false;
                type.Description = "Modified time Getup and Go test";
                type.DistancesString = "1-7-19";
                SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, true);

                SqlitePreferences.Update ("databaseVersion", "0.61", true);
                LogB.SQL("Converted DB to 0.61 added RunIntervalType distancesString (now we van have interval tests with different distances of tracks). Added MTGUG");

                conversionRate = 3;
                Sqlite.Close();
                currentVersion = "0.61";
            }
            if(currentVersion == "0.61") {
                Sqlite.Open();
                SqliteJumpType.JumpRjTypeInsert ("RJ(hexagon):1:0:1:18:Reactive Jump on a hexagon until three full revolutions are done", true);
                SqlitePreferences.Update ("databaseVersion", "0.62", true);
                LogB.SQL("Converted DB to 0.62 added hexagon");
                Sqlite.Close();
                currentVersion = "0.62";
            }
            if(currentVersion == "0.62") {
                Sqlite.Open();
                SqlitePreferences.Insert ("versionAvailable", "");
                SqlitePreferences.Update ("databaseVersion", "0.63", true);
                LogB.SQL("Converted DB to 0.63 (added 'versionAvailable' to preferences)");
                Sqlite.Close();
                currentVersion = "0.63";
            }
            if(currentVersion == "0.63") {
                Sqlite.Open();

                RunType type = new RunType();
                type.Name = "Margaria";
                type.Distance = 0;
                type.Description = "Margaria-Kalamen test";
                SqliteRunType.Insert(type, Constants.RunTypeTable, true);

                SqliteEvent.GraphLinkInsert (Constants.RunTable, "Margaria", "margaria.png", true);
                SqlitePreferences.Update ("databaseVersion", "0.64", true);

                LogB.SQL("Converted DB to 0.64 (added margaria test)");
                Sqlite.Close();
                currentVersion = "0.64";
            }
            if(currentVersion == "0.64") {
                Sqlite.Open();

                SqliteServer sqliteServerObject = new SqliteServer();
                //user has also an evaluator table with a row (it's row)
                sqliteServerObject.CreateEvaluatorTable();

                SqlitePreferences.Update ("databaseVersion", "0.65", true);

                LogB.SQL("Converted DB to 0.65 (added Sevaluator on client)");
                Sqlite.Close();
                currentVersion = "0.65";
            }
            if(currentVersion == "0.65") {
                Sqlite.Open();
                //now runAnalysis is a multiChronopic event
                //SqliteJumpType.JumpRjTypeInsert ("RunAnalysis:0:0:1:-1:Run between two photocells recording contact and flight times in contact platform/s. Until finish button is clicked.", true);

                SqlitePreferences.Update ("databaseVersion", "0.66", true);

                //LogB.SQL("Converted DB to 0.66 (added RunAnalysis Reactive jump)");
                LogB.SQL("Converted DB to 0.66 (done nothing)");
                Sqlite.Close();
                currentVersion = "0.66";
            }
            if(currentVersion == "0.66") {
                Sqlite.Open();
                SqliteJumpType.JumpTypeInsert ("TakeOff:0:0:Take off", true);
                SqliteJumpType.JumpTypeInsert ("TakeOffWeight:0:0:Take off with weight", true);

                SqlitePreferences.Update ("databaseVersion", "0.67", true);

                LogB.SQL("Converted DB to 0.67 (added TakeOff jumps)");
                Sqlite.Close();
                currentVersion = "0.67";
            }
            if(currentVersion == "0.67") {
                Sqlite.Open();
                sqliteMultiChronopicObject.createTable(Constants.MultiChronopicTable);

                SqlitePreferences.Update ("databaseVersion", "0.68", true);

                LogB.SQL("Converted DB to 0.68 (added multiChronopic tests table)");
                Sqlite.Close();
                currentVersion = "0.68";
            }
            if(currentVersion == "0.68") {
                Sqlite.Open();

                RunType type = new RunType();
                type.Name = "Gesell-DBT";
                type.Distance = 2.5;
                type.Description = "Gesell Dynamic Balance Test";
                SqliteRunType.Insert(type, Constants.RunTypeTable, true);

                SqliteEvent.GraphLinkInsert (Constants.RunTable, "Gesell-DBT", "gesell_dbt.png", true);
                SqlitePreferences.Update ("databaseVersion", "0.69", true);

                LogB.SQL("Converted DB to 0.69 (added Gesell-DBT test)");
                Sqlite.Close();
                currentVersion = "0.69";
            }
            if(currentVersion == "0.69") {
                Sqlite.Open();
                SqlitePreferences.Insert ("showPower", "True");
                SqlitePreferences.Update ("databaseVersion", "0.70", true);
                LogB.SQL("Converted DB to 0.70 (added showPower)");
                Sqlite.Close();
                currentVersion = "0.70";
            }
            if(currentVersion == "0.70") {
                Sqlite.Open();

                SqlitePersonSessionNotUpload.CreateTable();

                SqlitePreferences.Update ("databaseVersion", "0.71", true);

                LogB.SQL("Converted DB to 0.71 (created personNotUploadTable on client)");
                Sqlite.Close();
                currentVersion = "0.71";
            }
            if(currentVersion == "0.71") {
                Sqlite.Open();

                datesToYYYYMMDD();

                SqlitePreferences.Update ("databaseVersion", "0.72", true);

                LogB.SQL("Converted DB to 0.72 (dates to YYYY-MM-DD)");
                Sqlite.Close();
                currentVersion = "0.72";
            }
            if(currentVersion == "0.72") {
                Sqlite.Open();

                deleteOrphanedPersonsOld();

                SqlitePreferences.Update ("databaseVersion", "0.73", true);

                LogB.SQL("Converted DB to 0.73 (deleted orphaned persons (in person table but not in personSessionWeight table)");
                Sqlite.Close();
                currentVersion = "0.73";
            }
            if(currentVersion == "0.73") {
                //dbcon open laters on mid convertDJinDJna()

                convertDJInDJna();

                SqlitePreferences.Update ("databaseVersion", "0.74", true);

                LogB.SQL("Converted DB to 0.74 (All DJ converted to DJna)");
                Sqlite.Close();
                currentVersion = "0.74";
            }
            if(currentVersion == "0.74") {
                conversionRateTotal = 3;
                conversionRate = 1;

                Sqlite.Open();

                convertTables(new SqlitePersonOld(), Constants.PersonOldTable, 13, new ArrayList(), false);
                conversionRate++;

                convertTables(new SqlitePersonSessionOld(), Constants.PersonSessionOldWeightTable, 4, new ArrayList(), false);

                SqlitePreferences.Update ("databaseVersion", "0.75", true);
                conversionRate++;

                LogB.SQL("Converted DB to 0.75 (person, and personSessionWeight have height and weight as double)");
                Sqlite.Close();
                currentVersion = "0.75";
            }
            if(currentVersion == "0.75") {
                conversionRateTotal = 3;
                conversionRate = 1;
                Sqlite.Open();

                if(!jumpFallAsDouble)
                    alterTableColumn(new SqliteJump(), Constants.JumpTable, 11);

                conversionRate++;

                alterTableColumn(new SqliteJumpRj(), Constants.JumpRjTable, 18);

                SqlitePreferences.Update ("databaseVersion", "0.76", true);
                conversionRate++;

                LogB.SQL("Converted DB to 0.76 (jump & jumpRj falls as double)");
                Sqlite.Close();
                currentVersion = "0.76";
            }
            if(currentVersion == "0.76") {
                Sqlite.Open();

                convertPersonAndPersonSessionTo77();
                SqlitePreferences.Update ("databaseVersion", "0.77", true);
                LogB.SQL("Converted DB to 0.77 (person77, personSession77)");

                Sqlite.Close();
                currentVersion = "0.77";
            }
            if(currentVersion == "0.77") {
                Sqlite.Open();

                SqliteJumpType.UpdateOther ("weight", Constants.TakeOffWeightName, "1");

                Random rnd = new Random();
                string machineID = rnd.Next().ToString();
                SqlitePreferences.Insert ("machineID", machineID);

                SqlitePreferences.Update ("databaseVersion", "0.78", true);
                LogB.SQL("Converted DB to 0.78 (Added machineID to preferences, takeOffWeight has no weight in db conversions since 0.66)");

                Sqlite.Close();
                currentVersion = "0.78";
            }
            if(currentVersion == "0.78") {
                Sqlite.Open();

                SqlitePreferences.Insert ("multimediaStorage", Constants.MultimediaStorage.BYSESSION.ToString());

                SqlitePreferences.Update ("databaseVersion", "0.79", true);
                LogB.SQL("Converted DB to 0.79 (Added multimediaStorage structure id)");

                Sqlite.Close();
                currentVersion = "0.79";
            }
            if(currentVersion == "0.79") {
                Sqlite.Open();

         			if(! runAndRunIntervalInitialSpeedAdded) {
                    ArrayList myArray = new ArrayList(1);
                    myArray.Add("0"); //initial speed

                    conversionRateTotal = 3;
                    conversionRate = 1;
                    convertTables(new SqliteRun(), Constants.RunTable, 8, myArray, false);
                    conversionRate ++;
                    convertTables(new SqliteRunInterval(), Constants.RunIntervalTable, 12, myArray, false);
                    conversionRate ++;
                    LogB.SQL("Converted DB to 0.80 Added run and runInterval initial speed (if not done in 0.56 conversion)");
                }

                SqlitePreferences.Update ("databaseVersion", "0.80", true);

                Sqlite.Close();
                currentVersion = "0.80";
            }
            if(currentVersion == "0.80") {
                Sqlite.Open();

                ArrayList myArray = new ArrayList(1);
                myArray.Add("0"); //initial speed

                conversionRateTotal = 2;
                conversionRate = 1;
                Sqlite.dropTable(Constants.TempRunIntervalTable);
                sqliteRunIntervalObject.createTable(Constants.TempRunIntervalTable);
                conversionRate ++;
                LogB.SQL("Converted DB to 0.81 Added tempRunInterval initial speed");

                SqlitePreferences.Update ("databaseVersion", "0.81", true);

                Sqlite.Close();
                currentVersion = "0.81";
            }
            if(currentVersion == "0.81") {
                Sqlite.Open();
                conversionRateTotal = 2;

                conversionRate = 1;
                SqlitePreferences.Insert ("videoOn", "False");
                conversionRate = 2;
                LogB.SQL("Converted DB to 0.82 Added videoOn");

                SqlitePreferences.Update ("databaseVersion", "0.82", true);

                Sqlite.Close();
                currentVersion = "0.82";
            }
            if(currentVersion == "0.82") {
                Sqlite.Open();
                conversionRateTotal = 2;

                conversionRate = 1;
                SqliteEncoder.createTableEncoder();
                SqliteEncoder.createTableEncoderExercise();
                SqliteEncoder.initializeTableEncoderExercise();
                conversionRate = 2;
                LogB.SQL("Created encoder tables.");

                SqlitePreferences.Update ("databaseVersion", "0.83", true);
                Sqlite.Close();
                currentVersion = "0.83";
            }
            if(currentVersion == "0.83") {
                Sqlite.Open();

                RunType type = new RunType();
                type.Name = "RSA 8-4-R3-5";
                type.Distance = -1;
                type.TracksLimited = true;
                type.FixedValue = 4;
                type.Unlimited = false;
                type.Description = "RSA testing";
                type.DistancesString = "8-4-R3-5";
                SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, true);

                LogB.SQL("Added 1st RSA test.");

                SqlitePreferences.Update ("databaseVersion", "0.84", true);
                Sqlite.Close();
                currentVersion = "0.84";
            }
            if(currentVersion == "0.84") {
                Sqlite.Open();
                SqliteJumpType.JumpTypeInsert ("slCMJ:1:0:Single-leg CMJ jump", true);

                SqlitePreferences.Update ("databaseVersion", "0.85", true);

                LogB.SQL("Converted DB to 0.85 (added slCMJ jump)");
                Sqlite.Close();
                currentVersion = "0.85";
            }
            if(currentVersion == "0.85") {
                Sqlite.Open();
                LogB.SQL("Converted DB to 0.86 videoOn: TRUE");

                SqlitePreferences.Update("videoOn", "True", true);
                SqlitePreferences.Update ("databaseVersion", "0.86", true);

                Sqlite.Close();
                currentVersion = "0.86";
            }
            if(currentVersion == "0.86") {
                Sqlite.Open();
                LogB.SQL("Added run speed start preferences on sqlite");

                SqlitePreferences.Insert ("runSpeedStartArrival", "True");
                SqlitePreferences.Insert ("runISpeedStartArrival", "True");
                SqlitePreferences.Update ("databaseVersion", "0.87", true);

                Sqlite.Close();
                currentVersion = "0.87";
            }
            if(currentVersion == "0.87") {
                //delete runInterval type
                SqliteRunIntervalType.Delete("RSA 8-4-R3-5");

                //delete all it's runs
                Sqlite.Open();
                dbcmd.CommandText = "DELETE FROM " + Constants.RunIntervalTable +
                    " WHERE type == \"RSA 8-4-R3-5\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();

                //add know RSAs
                SqliteRunIntervalType.addRSA();
                addedRSA = true;

                LogB.SQL("Deleted fake RSA test and added known RSA tests.");

                SqlitePreferences.Update ("databaseVersion", "0.88", true);
                Sqlite.Close();

                currentVersion = "0.88";
            }
            if(currentVersion == "0.88") {
                Sqlite.Open();

                SqliteEncoder.addEncoderFreeExercise();

                LogB.SQL("Added encoder exercise: Free");

                SqlitePreferences.Update ("databaseVersion", "0.89", true);
                Sqlite.Close();

                currentVersion = "0.89";
            }
            if(currentVersion == "0.89") {
                Sqlite.Open();

                SqlitePreferences.Insert("encoderPropulsive", "True");
                SqlitePreferences.Insert("encoderSmoothEccCon", "0.6");
                SqlitePreferences.Insert("encoderSmoothCon", "0.7");
                LogB.SQL("Preferences added propulsive and encoder smooth");

                SqlitePreferences.Update ("databaseVersion", "0.90", true);
                Sqlite.Close();

                currentVersion = "0.90";
            }
            if(currentVersion == "0.90") {
                Sqlite.Open();

                SqliteEncoder.UpdateExercise(true, "Squat", "Squat", 100, "weight bar", "", "");
                LogB.SQL("Encoder Squat 75% -> 100%");

                SqlitePreferences.Update ("databaseVersion", "0.91", true);
                Sqlite.Close();

                currentVersion = "0.91";
            }
            if(currentVersion == "0.91") {
                Sqlite.Open();

                SqlitePreferences.Insert("videoDevice", "0");
                LogB.SQL("Added videoDevice to preferences");

                SqlitePreferences.Update ("databaseVersion", "0.92", true);
                Sqlite.Close();

                currentVersion = "0.92";
            }
            if(currentVersion == "0.92") {
                Sqlite.Open();

                SqliteEncoder.UpdateExercise(true, "Bench press", "Bench press", 0, "weight bar", "","0.185");
                SqliteEncoder.UpdateExercise(true, "Squat", "Squat", 100, "weight bar", "","0.31");
                LogB.SQL("Added speed1RM on encoder exercise");

                SqlitePreferences.Update ("databaseVersion", "0.93", true);
                Sqlite.Close();

                currentVersion = "0.93";
            }
            if(currentVersion == "0.93") {
                Sqlite.Open();

                SqliteEncoder.createTable1RM();
                LogB.SQL("Added encoder1RM table");

                SqlitePreferences.Update ("databaseVersion", "0.94", true);
                Sqlite.Close();

                currentVersion = "0.94";
            }
            if(currentVersion == "0.94") {
                Sqlite.Open();

                SqlitePreferences.Insert ("encoder1RMMethod",
                        Constants.Encoder1RMMethod.WEIGHTED2.ToString());
                LogB.SQL("Added encoder1RMMethod");

                SqlitePreferences.Update ("databaseVersion", "0.95", true);
                Sqlite.Close();

                currentVersion = "0.95";
            }
            if(currentVersion == "0.95") {
                Sqlite.Open();

                Update(true, Constants.EncoderTable, "future3", "", Constants.EncoderConfigurationNames.LINEAR.ToString(),
                        "signalOrCurve", "signal");
                Update(true, Constants.EncoderTable, "future3", "0", Constants.EncoderConfigurationNames.LINEAR.ToString(),
                        "signalOrCurve", "signal");
                Update(true, Constants.EncoderTable, "future3", "1", Constants.EncoderConfigurationNames.LINEARINVERTED.ToString(),
                        "signalOrCurve", "signal");

                LogB.SQL("Encoder signal future3 three modes");

                SqlitePreferences.Update ("databaseVersion", "0.96", true);
                Sqlite.Close();

                currentVersion = "0.96";
            }
            if(currentVersion == "0.96") {
                Sqlite.Open();

                SqlitePreferences.Insert ("inertialmomentum", "0.01");
                LogB.SQL("Added inertialmomentum in preferences");

                SqlitePreferences.Update ("databaseVersion", "0.97", true);
                Sqlite.Close();

                currentVersion = "0.97";
            }
            if(currentVersion == "0.97") {
                Sqlite.Open();

                Update(true, Constants.EncoderTable, "laterality", "both", "RL", "", "");
                Update(true, Constants.EncoderTable, "laterality", "Both", "RL", "", "");
                Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("Both"), "RL", "", "");
                Update(true, Constants.EncoderTable, "laterality", "right", "R", "", "");
                Update(true, Constants.EncoderTable, "laterality", "Right", "R", "", "");
                Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("Right"), "R", "", "");
                Update(true, Constants.EncoderTable, "laterality", "left", "L", "", "");
                Update(true, Constants.EncoderTable, "laterality", "Left", "L", "", "");
                Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("Left"), "L", "", "");
                LogB.SQL("Fixed encoder laterality");

                SqlitePreferences.Update ("databaseVersion", "0.98", true);
                Sqlite.Close();

                currentVersion = "0.98";
            }
            if(currentVersion == "0.98") {
                Sqlite.Open();

                ArrayList array = SqliteOldConvert.EncoderSelect098(true,-1,-1,-1,"all",false);

                conversionRateTotal = array.Count;

                dropTable(Constants.EncoderTable);

                //CAUTION: do like this and never do createTableEncoder,
                //because method will change in the future and will break updates
                SqliteOldConvert.createTableEncoder99();

                int count = 1;
                foreach( EncoderSQL098 es in array) {
                    conversionRate = count;

                    //do not use SqliteEncoder.Insert because that method maybe changes in the future,
                    //and here we need to do a conversion that works from 0.98 to 0.99
                    dbcmd.CommandText = "INSERT INTO " + Constants.EncoderTable +
                        " (uniqueID, personID, sessionID, exerciseID, eccon, laterality, extraWeight, " +
                        "signalOrCurve, filename, url, time, minHeight, smooth, description, status, " +
                        "videoURL, mode, inertiaMomentum, diameter, future1, future2, future3)" +
                        " VALUES (" + es.uniqueID + ", " +
                        es.personID + ", " + es.sessionID + ", " +
                        es.exerciseID + ", \"" + es.eccon + "\", \"" +
                        es.laterality + "\", \"" + es.extraWeight + "\", \"" +
                        es.signalOrCurve + "\", \"" + es.filename + "\", \"" +
                        es.url + "\", " + es.time + ", " + es.minHeight + ", " +
                        Util.ConvertToPoint(es.smooth) + ", \"" + es.description + "\", \"" +
                        es.future1 + "\", \"" + es.future2 + "\", \"LINEAR\", " + //status, videoURL, mode
                        "0, 0, \"\", \"\", \"\")"; //inertiaMomentum, diameter, future1, 2, 3
                    LogB.SQL(dbcmd.CommandText.ToString());
                    dbcmd.ExecuteNonQuery();
                    count ++;
                }

                conversionRate = count;
                LogB.SQL("Encoder table improved");
                SqlitePreferences.Update ("databaseVersion", "0.99", true);
                Sqlite.Close();

                currentVersion = "0.99";
            }
            if(currentVersion == "0.99") {
                Sqlite.Open();

                SqliteEncoder.putEncoderExerciseAnglesAt90();
                SqliteEncoder.addEncoderJumpExercise();
                SqliteEncoder.addEncoderInclinedExercises();

                LogB.SQL("Added Free and inclinedExercises");
                SqlitePreferences.Update ("databaseVersion", "1.00", true);
                Sqlite.Close();

                currentVersion = "1.00";
            }
            if(currentVersion == "1.00") {
                Sqlite.Open();

                SqlitePreferences.Insert ("CSVExportDecimalSeparator", Util.GetDecimalSeparatorFromLocale());

                LogB.SQL("Added export to CSV configuration on preferences");
                SqlitePreferences.Update ("databaseVersion", "1.01", true);
                Sqlite.Close();

                currentVersion = "1.01";
            }
            if(currentVersion == "1.01") {
                Sqlite.Open();

                RunType type = new RunType("Agility-T-Test");
                SqliteRunType.Insert(type, Constants.RunTypeTable, true);
                type = new RunType("Agility-3L3R");
                SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, true);

                LogB.SQL("Added Agility Tests: Agility-T-Test, Agility-3l3R");
                SqlitePreferences.Update ("databaseVersion", "1.02", true);
                Sqlite.Close();

                currentVersion = "1.02";
            }
            if(currentVersion == "1.02") {
                Sqlite.Open();

                DeleteFromName(true, Constants.EncoderExerciseTable, "Inclinated plane Custom");
                SqliteEncoder.removeEncoderExerciseAngles();

                LogB.SQL("Updated encoder exercise, angle is now on encoder configuration");
                SqlitePreferences.Update ("databaseVersion", "1.03", true);
                Sqlite.Close();

                currentVersion = "1.03";
            }
            if(currentVersion == "1.03") {
                Sqlite.Open();

                ArrayList array = SqliteOldConvert.EncoderSelect103(true,-1,-1,-1,"all",false);

                conversionRateTotal = array.Count;

                dropTable(Constants.EncoderTable);

                //CAUTION: do like this and never do createTableEncoder,
                //because method will change in the future and will break updates
                SqliteOldConvert.createTableEncoder104();

                //in this conversion put this as default for all SQL rows
                EncoderConfiguration econf = new EncoderConfiguration();

                int count = 1;
                foreach(EncoderSQL103 es in array) {
                    conversionRate = count;

                    //do not use SqliteEncoder.Insert because that method maybe changes in the future,
                    //and here we need to do a conversion that works from 1.03 to 1.04
                    dbcmd.CommandText = "INSERT INTO " + Constants.EncoderTable +
                        " (uniqueID, personID, sessionID, exerciseID, eccon, laterality, extraWeight, " +
                        "signalOrCurve, filename, url, time, minHeight, description, status, " +
                        "videoURL, encoderConfiguration, future1, future2, future3)" +
                        " VALUES (" + es.uniqueID + ", " +
                        es.personID + ", " + es.sessionID + ", " +
                        es.exerciseID + ", \"" + es.eccon + "\", \"" +
                        es.laterality + "\", \"" + es.extraWeight + "\", \"" +
                        es.signalOrCurve + "\", \"" + es.filename + "\", \"" +
                        es.url + "\", " + es.time + ", " + es.minHeight + ", \"" + es.description + "\", \"" +
                        es.status + "\", \"" + es.videoURL + "\", \"" +
                        econf.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "\", \"" + //in this conversion put this as default for all SQL rows.
                        es.future1 + "\", \"" + es.future2 + "\", \"" + es.future3 + "\")";
                    LogB.SQL(dbcmd.CommandText.ToString());
                    dbcmd.ExecuteNonQuery();
                    count ++;
                }

                conversionRate = count;
                LogB.SQL("Encoder table improved");
                SqlitePreferences.Update ("databaseVersion", "1.04", true);
                Sqlite.Close();

                currentVersion = "1.04";
            }
            if(currentVersion == "1.04") {
                Sqlite.Open();

                dbcmd.CommandText = "DELETE FROM " + Constants.EncoderTable +
                    " WHERE encoderConfiguration LIKE \"%INERTIAL%\" AND " +
                    " signalOrCurve == \"curve\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();

                LogB.SQL("Removed inertial curves, because sign was not checked on 1.04 when saving curves");
                SqlitePreferences.Update ("databaseVersion", "1.05", true);
                Sqlite.Close();

                currentVersion = "1.05";
            }
            if(currentVersion == "1.05") {
                Sqlite.Open();

                SqliteEncoder.createTableEncoderSignalCurve();

                ArrayList signals = SqliteEncoder.Select(true, -1, -1, -1, Constants.EncoderGI.ALL,
                        -1, "signal", EncoderSQL.Eccons.ALL, false, false);
                ArrayList curves = SqliteEncoder.Select(true, -1, -1, -1, Constants.EncoderGI.ALL,
                        -1, "curve", EncoderSQL.Eccons.ALL, false, false);
                int signalID;
                conversionRateTotal = signals.Count;
                conversionRate = 1;
                //in 1.05 curves can be related to signals only by date
                foreach(EncoderSQL s in signals) {
                    conversionRate ++;
                    conversionSubRateTotal = curves.Count;
                    conversionSubRate = 1;

                    //needed to know if there are duplicates
                    ArrayList curvesStored = new ArrayList();

                    foreach(EncoderSQL c in curves) {
                        conversionSubRate ++;
                        if(s.GetDate(false) == c.GetDate(false) && s.eccon == c.eccon) {
                            int msCentral = SqliteEncoder.FindCurveInSignal(
                                    s.GetFullURL(false), c.GetFullURL(false));

                            signalID = Convert.ToInt32(s.uniqueID);
                            if(msCentral == -1)
                                signalID = -1; //mark as an orphaned curve (without signal)

                            /*
                             * about duplicated curves from 1.05 and before:
                             * There are two kind of duplicates, in both, eccon is the same, and they overlap.
                             *
                             * Overlapings situations:
                             * - they are saved two times (same msCentral), or
                             * - they are saved two times with different smoothing (different msCentral)
                             *
                             * from now on (1.06) there will be no more duplicates
                             * about the old duplicated curves, is the user problem,
                             * except the curves of the first kind, that we know exactly that they are duplicated
                             */

                            //curves come sorted by UniqueID DESC (selected with orderIDascendent = false)
                            //if does not exist: insert in encoderSignalCurve
                            bool exists = false;
                            foreach(int ms in curvesStored)
                                if(ms == msCentral)
                                    exists = true;
                            if(exists) {
                                //delete this (newer will not be deleted)
                                Sqlite.Delete(true,
                                        Constants.EncoderTable, Convert.ToInt32(c.uniqueID));
                            } else {
                                curvesStored.Add(msCentral);
                                SqliteEncoder.SignalCurveInsert(true,
                                        signalID, Convert.ToInt32(c.uniqueID), msCentral);
                            }
                        }
                    }
                }

                conversionSubRate ++;
                conversionRate ++;
                LogB.SQL("Curves are now linked to signals");
                SqlitePreferences.Update ("databaseVersion", "1.06", true);

                Sqlite.Close();
                currentVersion = "1.06";
            }
            if(currentVersion == "1.06") {
                Sqlite.Open();

                Update(true, Constants.GraphLinkTable, "graphFileName", "jump_dj.png", "jump_dj_a.png",
                        "eventName", "DJa");

                LogB.SQL("Added jump_dj_a.png");
                SqlitePreferences.Update ("databaseVersion", "1.07", true);
                Sqlite.Close();

                currentVersion = "1.07";
            }
            if(currentVersion == "1.07") {
                Sqlite.Open();

                LogB.SQL("Added translate statistics graph option to preferences");

                SqlitePreferences.Insert ("RGraphsTranslate", "True");
                SqlitePreferences.Update ("databaseVersion", "1.08", true);
                Sqlite.Close();

                currentVersion = "1.08";
            }
            if(currentVersion == "1.08") {
                Sqlite.Open();

                LogB.SQL("Added option on preferences to useHeightsOnJumpIndexes (default) or not");

                SqlitePreferences.Insert ("useHeightsOnJumpIndexes", "True");
                SqlitePreferences.Update ("databaseVersion", "1.09", true);
                Sqlite.Close();

                currentVersion = "1.09";
            }
            if(currentVersion == "1.09") {
                Sqlite.Open();

                LogB.SQL("Added RSA RAST on runType");

                /*
                 * addRSA() contains RAST since 1.10
                 * database started at 1.10 or more contains RAST
                 * database started before 0.87 adds RAST on the addRSA() method
                 * satabase started after 0.87 adds RAST now
                 */
                if(! addedRSA) {
                    RunType type = new RunType();
                    type.Name = "RSA RAST 35, R10 x 6";
                    type.Distance = -1;
                    type.TracksLimited = true;
                    type.FixedValue = 12;
                    type.Unlimited = false;
                    type.Description = "RSA RAST Test";
                    type.DistancesString = "35-R10";

                    SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, true);
                    addedRSA = true;
                }

                SqlitePreferences.Update ("databaseVersion", "1.10", true);
                Sqlite.Close();

                currentVersion = "1.10";
            }
            if(currentVersion == "1.10") {
                Sqlite.Open();

                LogB.SQL("Added option on autosave curves on capture (all/bestmeanpower/none)");

                SqlitePreferences.Insert ("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.BEST.ToString());
                SqlitePreferences.Update ("databaseVersion", "1.11", true);
                Sqlite.Close();

                currentVersion = "1.11";
            }
            if(currentVersion == "1.11") {
                Sqlite.Open();

                LogB.SQL("URLs from absolute to relative)");

                SqliteOldConvert.ConvertAbsolutePathsToRelative();
                SqlitePreferences.Update ("databaseVersion", "1.12", true);
                Sqlite.Close();

                currentVersion = "1.12";
            }
            if(currentVersion == "1.12") {
                Sqlite.Open();

                LogB.SQL("Added ExecuteAuto table");

                SqliteExecuteAuto.createTableExecuteAuto();
                SqlitePreferences.Update ("databaseVersion", "1.13", true);
                Sqlite.Close();

                currentVersion = "1.13";
            }
            if(currentVersion == "1.13") {
                Sqlite.Open();

                LogB.SQL("slCMJ -> slCMJleft, slCMJright");

                SqliteOldConvert.slCMJDivide();
                SqlitePreferences.Update ("databaseVersion", "1.14", true);
                Sqlite.Close();

                currentVersion = "1.14";
            }
            if(currentVersion == "1.14") {
                Sqlite.Open();

                LogB.SQL("added Chronojump profile and bilateral profile");

                SqliteExecuteAuto.addChronojumpProfileAndBilateral();
                SqlitePreferences.Update ("databaseVersion", "1.15", true);
                Sqlite.Close();

                currentVersion = "1.15";
            }
            if(currentVersion == "1.15") {
                Sqlite.Open();

                LogB.SQL("Cyprus moved to Europe");

                Update(true, Constants.CountryTable, "continent", "Asia", "Europe", "code", "CYP");
                SqlitePreferences.Update ("databaseVersion", "1.16", true);
                Sqlite.Close();

                currentVersion = "1.16";
            }
            if(currentVersion == "1.16") {
                Sqlite.Open();

                LogB.SQL("Deleting Max jump");

                Update(true, Constants.JumpTable, "type", "Max", "Free", "", "");
                DeleteFromName(true, Constants.JumpTypeTable, "Max");
                SqlitePreferences.Update ("databaseVersion", "1.17", true);
                Sqlite.Close();

                currentVersion = "1.17";
            }
            if(currentVersion == "1.17") {
                Sqlite.Open();

                LogB.SQL("Deleted Negative runInterval runs (bug from last version)");

                SqliteOldConvert.deleteNegativeRuns();
                SqlitePreferences.Update ("databaseVersion", "1.18", true);
                Sqlite.Close();

                currentVersion = "1.18";
            }
            if(currentVersion == "1.18") {
                LogB.SQL("Preferences deleted showHeight, added showStiffness");

                Sqlite.Open();
                DeleteFromName(true, Constants.PreferencesTable, "showHeight");
                SqlitePreferences.Insert ("showStiffness", "True");
                SqlitePreferences.Update ("databaseVersion", "1.19", true);
                Sqlite.Close();

                currentVersion = "1.19";
            }
            if(currentVersion == "1.19") {
                LogB.SQL("Preferences: added user email");

                Sqlite.Open();
                SqlitePreferences.Insert ("email", "");
                SqlitePreferences.Update ("databaseVersion", "1.20", true);
                Sqlite.Close();

                currentVersion = "1.20";
            }
            if(currentVersion == "1.20") {
                LogB.SQL("Fixing loosing of encoder videoURL after recalculate");

                Sqlite.Open();

                SqliteOldConvert.ConvertAbsolutePathsToRelative(); //videoURLs got absolute again
                SqliteOldConvert.FixLostVideoURLAfterEncoderRecalculate();

                SqlitePreferences.Update ("databaseVersion", "1.21", true);
                Sqlite.Close();

                currentVersion = "1.21";
            }
            if(currentVersion == "1.21") {
                LogB.SQL("Encoder laterality in english again");

                Sqlite.Open();

                if(Catalog.GetString("RL") != "RL")
                    Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("RL"), "RL", "", "");

                if(Catalog.GetString("R") != "R")
                    Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("R"), "R", "", "");

                if(Catalog.GetString("L") != "L")
                    Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("L"), "L", "", "");

                SqlitePreferences.Update ("databaseVersion", "1.22", true);
                Sqlite.Close();

                currentVersion = "1.22";
            }
            if(currentVersion == "1.22") {
                LogB.SQL("Added encoder configuration");

                Sqlite.Open();
                SqlitePreferences.Insert ("encoderConfiguration", new EncoderConfiguration().ToStringOutput(EncoderConfiguration.Outputs.SQL));
                SqlitePreferences.Update ("databaseVersion", "1.23", true);
                Sqlite.Close();

                currentVersion = "1.23";
            }

            // ----------------------------------------------
            // IMPORTANT HERE IS DEFINED sqliteOpened == true
            // this is useful to not do more than 50 SQL open close
            // that crashes mac (Linux 100)
            // ----------------------------------------------
            LogB.SQL("Leaving Sqlite opened before DB updates");

            Sqlite.Open(); //------------------------------------------------

            if(currentVersion == "1.23") {
                LogB.SQL("Delete runISpeedStartArrival and add 4 double contacts configs");

                DeleteFromName(true, Constants.PreferencesTable, "runISpeedStartArrival");
                SqlitePreferences.Insert ("runDoubleContactsMode", Constants.DoubleContact.LAST.ToString());
                SqlitePreferences.Insert ("runDoubleContactsMS", "1000");
                SqlitePreferences.Insert ("runIDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString());
                SqlitePreferences.Insert ("runIDoubleContactsMS", "1000");

                currentVersion = updateVersion("1.24");
            }
            if(currentVersion == "1.24") {
                LogB.SQL("Language defaults to (empty string), means detected");
                SqlitePreferences.Update("language", "", true);

                currentVersion = updateVersion("1.25");
            }
            if(currentVersion == "1.25") {
                LogB.SQL("Changed Inclinated to Inclined");
                Update(true, Constants.EncoderExerciseTable, "name", "Inclinated plane", "Inclined plane", "", "");
                Update(true, Constants.EncoderExerciseTable, "name", "Inclinated plane BW", "Inclined plane BW", "", "");

                currentVersion = updateVersion("1.26");
            }
            if(currentVersion == "1.26") {
                LogB.SQL("Changing runDoubleContactsMS and runIDoubleContactsMS from 1000ms to 300ms");
                SqlitePreferences.Update("runDoubleContactsMS", "300", true);
                SqlitePreferences.Update("runIDoubleContactsMS", "300", true);

                currentVersion = updateVersion("1.27");
            }
            if(currentVersion == "1.27") {
                LogB.SQL("Changed encoderAutoSaveCurve BESTMEANPOWER to BEST");
                Update(true, Constants.PreferencesTable, "value", "BESTMEANPOWER", "BEST", "name", "encoderAutoSaveCurve");

                currentVersion = updateVersion("1.28");
            }
            if(currentVersion == "1.28") {
                LogB.SQL("Changed reaction time rows have reactionTime as default value");
                Update(true, Constants.ReactionTimeTable, "type", "", "reactionTime", "", "");

                currentVersion = updateVersion("1.29");
            }
            if(currentVersion == "1.29") {
                LogB.SQL("Added SIMULATED session");

                //add SIMULATED session if doesn't exists. Unique session where tests can be simulated.
                SqliteSession.insertSimulatedSession();

                currentVersion = updateVersion("1.30");
            }
            if(currentVersion == "1.30") {
                LogB.SQL("Insert encoderCaptureCheckFullyExtended and ...Value at preferences");

                SqlitePreferences.Insert ("encoderCaptureCheckFullyExtended", "True");
                SqlitePreferences.Insert ("encoderCaptureCheckFullyExtendedValue", "4");

                currentVersion = updateVersion("1.31");
            }
            if(currentVersion == "1.31") {
                LogB.SQL("encoderCaptureOptionsWin -> preferences");

                SqlitePreferences.Insert ("encoderCaptureTime", "60");
                SqlitePreferences.Insert ("encoderCaptureInactivityEndTime", "3");
                SqlitePreferences.Insert ("encoderCaptureMainVariable", Constants.EncoderVariablesCapture.MeanPower.ToString());
                SqlitePreferences.Insert ("encoderCaptureMinHeightGravitatory", "20");
                SqlitePreferences.Insert ("encoderCaptureMinHeightInertial", "5");
                SqlitePreferences.Insert ("encoderShowStartAndDuration", "False");

                currentVersion = updateVersion("1.32");
            }
            if(currentVersion == "1.32") {
                LogB.SQL("Added chronopicRegister table");

                SqliteChronopicRegister.createTableChronopicRegister();

                currentVersion = updateVersion("1.33");
            }
            if(currentVersion == "1.33") {
                LogB.SQL("Added thresholdJumps, thresholdRuns, thresholdOther to preferences");

                SqlitePreferences.Insert ("thresholdJumps", "50");
                SqlitePreferences.Insert ("thresholdRuns", "10");
                SqlitePreferences.Insert ("thresholdOther", "50");

                currentVersion = updateVersion("1.34");
            }

            // --- add more updates here

            // --- end of update, close DB

            LogB.SQL("Closing Sqlite after DB updates");

            Sqlite.Close(); //------------------------------------------------
        }

        //if changes are made here, remember to change also in CreateTables()
        //remember to change also the databaseVersion below

        return returnSoftwareIsNew;
    }
All Usage Examples Of SqlitePulse::createTable