[chronojump] Fixed lost encoder on DB after updating to 1.4.0



commit fe1f580d0ec87674fdfb519c54d3c3f002320d02
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Mar 24 20:42:26 2014 +0100

    Fixed lost encoder on DB after updating to 1.4.0

 src/sqlite/main.cs       |   10 ++++++-
 src/sqlite/oldConvert.cs |   55 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 2 deletions(-)
---
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index aaacbcc..737ea66 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -1344,7 +1344,10 @@ class Sqlite
                                conversionRateTotal = array.Count;
                                
                                dropTable(Constants.EncoderTable);
-                               SqliteEncoder.createTableEncoder();
+                               
+                               //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) {
@@ -1435,7 +1438,10 @@ class Sqlite
                                conversionRateTotal = array.Count;
                                
                                dropTable(Constants.EncoderTable);
-                               SqliteEncoder.createTableEncoder();
+                               
+                               //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();
diff --git a/src/sqlite/oldConvert.cs b/src/sqlite/oldConvert.cs
index 64a693b..fbdf16f 100644
--- a/src/sqlite/oldConvert.cs
+++ b/src/sqlite/oldConvert.cs
@@ -120,6 +120,61 @@ class SqliteOldConvert : Sqlite
                return array;
        }
        
+       protected internal static void createTableEncoder104()
+       {
+               dbcmd.CommandText = 
+                       "CREATE TABLE " + Constants.EncoderTable + " ( " +
+                       "uniqueID INTEGER PRIMARY KEY, " +
+                       "personID INT, " +
+                       "sessionID INT, " +
+                       "exerciseID INT, " +
+                       "eccon TEXT, " +        //"c" or "ec"
+                       "laterality TEXT, " +   //"left" "right" "both"
+                       "extraWeight TEXT, " +  //string because can contain "33%" or "50Kg"
+                       "signalOrCurve TEXT, " + //"signal" or "curve"
+                       "filename TEXT, " +
+                       "url TEXT, " +
+                       "time INT, " +
+                       "minHeight INT, " +
+                       "description TEXT, " +
+                       "status TEXT, " +       //"active", "inactive"
+                       "videoURL TEXT, " +     //URL of video of signals
+                       "encoderConfiguration TEXT, " + //text separated by ':'
+                       "future1 TEXT, " + 
+                       "future2 TEXT, " + 
+                       "future3 TEXT )";
+               dbcmd.ExecuteNonQuery();
+       }
+
+       protected internal static void createTableEncoder99()
+       {
+               dbcmd.CommandText = 
+                       "CREATE TABLE " + Constants.EncoderTable + " ( " +
+                       "uniqueID INTEGER PRIMARY KEY, " +
+                       "personID INT, " +
+                       "sessionID INT, " +
+                       "exerciseID INT, " +
+                       "eccon TEXT, " +        //"c" or "ec"
+                       "laterality TEXT, " +   //"left" "right" "both"
+                       "extraWeight TEXT, " +  //string because can contain "33%" or "50Kg"
+                       "signalOrCurve TEXT, " + //"signal" or "curve"
+                       "filename TEXT, " +
+                       "url TEXT, " +
+                       "time INT, " +
+                       "minHeight INT, " +
+                       "smooth INT, " +
+                       "description TEXT, " +
+                       "status TEXT, " +       //"active", "inactive"
+                       "videoURL TEXT, " +     //URL of video of signals
+                       "mode TEXT, " +
+                       "inertiaMomentum INT, " +
+                       "diameter INT, " +
+                       "future1 TEXT, " + 
+                       "future2 TEXT, " + 
+                       "future3 TEXT )";
+               dbcmd.ExecuteNonQuery();
+       }
+       
 
        //pass uniqueID value and then will return one record. do like this:
        //EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, myUniqueID, 0, 0, "")[0];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]