[chronojump] encoder table db 0.99. TODO check encoderSQL calls



commit 1a38bcc2fc693199e24f0c3330b920d0580ec393
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Nov 18 21:45:28 2013 +0100

    encoder table db 0.99. TODO check encoderSQL calls

 src/Makefile.am          |    1 +
 src/encoder.cs           |   87 +++++++++++++++++++++++++++++------
 src/gui/encoder.cs       |   36 ++++++++++----
 src/sqlite/encoder.cs    |   99 +++++++++++++++++++++++++++++----------
 src/sqlite/main.cs       |   44 +++++++++++++++++-
 src/sqlite/oldConvert.cs |  116 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 333 insertions(+), 50 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index f5b2ff9..4ea56fb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -99,6 +99,7 @@ SOURCES = \
        sqlite/sport.cs\
        sqlite/speciallity.cs\
        sqlite/country.cs\
+       sqlite/oldConvert.cs\
        sqlite/server.cs\
        execute/event.cs\
        execute/jump.cs\
diff --git a/src/encoder.cs b/src/encoder.cs
index fc9c9ef..9b4cc70 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -264,18 +264,14 @@ public class EncoderSQL
        public int minHeight;
        public double smooth;   //unused on curves, since 1.3.7 it's in database
        public string description;
-       public string future1;  //active or inactive curves
-       public string future2;  //URL of video of signals
-       public string future3;  //Constants.EncoderSignalMode (only on signals) (add "-0.01" for inertia 
momentum)
-
-//TODO: 
-//convertir signal future3 inverted de "1" a "inverted" FET
-//convertir "0" i "" en "linear"                       FET
-//pq potser sera "linear" or "linearinverted" or "rotaryinertial"      FET
-//fer que al capturar es gravi el future3 amb rotaryinertial o el que sigui (provar-ho amb el darrer 
capturat)
-//en un futur posar con-ecc
-//linear, linear inverted i rotaryinertial com a radiobutton FET
-//que findCurves trobi be totes les curves basant-se en el fixed i no en l'original pq llavors no troba les 
darreres
+       public string status;   //active or inactive curves
+       public string videoURL; //URL of video of signals
+       public string mode;     //Constants.EncoderSignalMode (only on signals??)
+       public int inertiaMomentum;
+       public double diameter;
+       public string future1;
+       public string future2;
+       public string future3;
 
        public string exerciseName;
        
@@ -288,7 +284,9 @@ public class EncoderSQL
        public EncoderSQL (string uniqueID, int personID, int sessionID, int exerciseID, 
                        string eccon, string laterality, string extraWeight, string signalOrCurve, 
                        string filename, string url, int time, int minHeight, double smooth, 
-                       string description, string future1, string future2, string future3, 
+                       string description, string status, string videoURL, string mode,
+                       int inertiaMomentum, double diameter,
+                       string future1, string future2, string future3, 
                        string exerciseName
                        )
        {
@@ -306,6 +304,11 @@ public class EncoderSQL
                this.minHeight = minHeight;
                this.smooth = smooth;
                this.description = description;
+               this.status = status;
+               this.videoURL = videoURL;
+               this.mode = mode;
+               this.inertiaMomentum = inertiaMomentum;
+               this.diameter = diameter;
                this.future1 = future1;
                this.future2 = future2;
                this.future3 = future3;
@@ -364,7 +367,7 @@ public class EncoderSQL
                str[i++] = GetDate(true);
                
                if(video) {
-                       if(future2 != "")
+                       if(videoURL != "")
                                str[i++] = Catalog.GetString("Yes");
                        else
                                str[i++] = Catalog.GetString("No");
@@ -426,6 +429,62 @@ public class EncoderSQL
        }
 }
 
+//used in DB version 0.98 and before
+public class EncoderSQL098
+{
+       public string uniqueID;
+       public int personID;
+       public int sessionID;
+       public int exerciseID;
+       public string eccon;
+       public string laterality;
+       public string extraWeight;
+       public string signalOrCurve;
+       public string filename;
+       public string url;
+       public int time;
+       public int minHeight;
+       public double smooth;   //unused on curves, since 1.3.7 it's in database
+       public string description;
+       public string future1;  //active or inactive curves
+       public string future2;  //URL of video of signals
+       public string future3;  //Constants.EncoderSignalMode (only on signals) (add "-0.01" for inertia 
momentum)
+
+       public string exerciseName;
+       
+       public EncoderSQL098 ()
+       {
+       }
+       
+       public EncoderSQL098 (string uniqueID, int personID, int sessionID, int exerciseID, 
+                       string eccon, string laterality, string extraWeight, string signalOrCurve, 
+                       string filename, string url, int time, int minHeight, double smooth, 
+                       string description, string future1, string future2, string future3, 
+                       string exerciseName
+                       )
+       {
+               this.uniqueID = uniqueID;
+               this.personID = personID;
+               this.sessionID = sessionID;
+               this.exerciseID = exerciseID;
+               this.eccon = eccon;
+               this.laterality = laterality;
+               this.extraWeight = extraWeight;
+               this.signalOrCurve = signalOrCurve;
+               this.filename = filename;
+               this.url = url;
+               this.time = time;
+               this.minHeight = minHeight;
+               this.smooth = smooth;
+               this.description = description;
+               this.future1 = future1;
+               this.future2 = future2;
+               this.future3 = future3;
+               this.exerciseName = exerciseName;
+       }
+}
+
+
 public class EncoderPersonCurvesInDB
 {
        public int personID;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index a8e5c86..6ee1162 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -255,10 +255,7 @@ public partial class ChronoJumpWindow
                        return;
                }
                
-               string analysisOptions = "";
-               if(encoderPropulsive)
-                       analysisOptions = "p;-;-";
-               //TODO: add ri and inertia momentum if needed 
+               string analysisOptions = getEncoderAnalysisOptions(true);
 
                double heightHigherCondition = -1;
                if(repetitiveConditionsWin.EncoderHeightHigher)         
@@ -651,7 +648,24 @@ public partial class ChronoJumpWindow
 
 
        private string getEncoderAnalysisOptions(bool captureOrAnalyze) {
-               //capture == true; analyze == false
+               /*
+                * analysisOptions, separated by ';'
+                * 1: "p" or "-". Propulsive or all
+                * 2: "l", "li", "rf" or "ra". Linear, linear inverted, rotatory friction, rotatory axes
+                * 3: "i" or "-". Inertial or not
+                * 4: inertial moment in Kgxcm^2 or "-".
+                * 5: diameter in cm
+                *
+                * eg:
+                * p;ra;i;100;4
+                * p;ra;-;-;4
+                * -;li;-;-;-
+                *
+                * TODO: not. Do this on getEncoderTypeByCombos();
+                * here only do the "p"
+                *
+                */
+
 
                string analysisOptions = "-";
                if(encoderPropulsive)
@@ -685,7 +699,7 @@ public partial class ChronoJumpWindow
 
                string analysisOptions = getEncoderAnalysisOptions(true);
 
-               string future3 = getEncoderTypeByCombos();
+               string mode = getEncoderTypeByCombos();
                
                //see explanation on the top of this file
                lastEncoderSQL = new EncoderSQL(
@@ -701,10 +715,12 @@ public partial class ChronoJumpWindow
                                "",     //path,                 //url
                                (int) encoderCaptureOptionsWin.spin_encoder_capture_time.Value, 
                                (int) encoderCaptureOptionsWin.spin_encoder_capture_min_height.Value, 
-                               -1,     //Since 1.3.7 smooth is not stored in curves
-                               "",     //desc,
-                               "","",
-                               future3,
+                               -1,             //Since 1.3.7 smooth is not stored in curves
+                               "",             //desc,
+                               "","",          //status, videoURL
+                               mode,   
+                               0,0,            //inertiaMomentum, diameter
+                               "","","",       //future1, 2, 3
                                Util.FindOnArray(':', 2, 1, UtilGtk.ComboGetActive(combo_encoder_exercise), 
                                        encoderExercisesTranslationAndBodyPWeight)      //exerciseName 
(english)
                                );
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 6f7f031..cc33f79 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -38,6 +38,7 @@ class SqliteEncoder : Sqlite
        
        protected internal static void createTableEncoder()
        {
+               /* old
                dbcmd.CommandText = 
                        "CREATE TABLE " + Constants.EncoderTable + " ( " +
                        "uniqueID INTEGER PRIMARY KEY, " +
@@ -58,6 +59,32 @@ class SqliteEncoder : Sqlite
                        "future2 TEXT, " +      //URL of video of signals
                        "future3 TEXT )";       //Constants.EncoderSignalMode (only on signals) (add "-0.01" 
for inertia momentum)
                dbcmd.ExecuteNonQuery();
+               */
+               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 FLOAT, " +      //unused. since 1.3.7 is on preferences
+                       "description TEXT, " +
+                       "status TEXT, " +       //"active", "inactive"
+                       "videoURL TEXT, " +     //URL of video of signals
+                       "mode TEXT, " +         //Constants.EncoderSignalMode (only on signals??)
+                       "inertiaMomentum INT, " + 
+                       "diameter FLOAT, " + 
+                       "future1 TEXT, " + 
+                       "future2 TEXT, " + 
+                       "future3 TEXT )";
+               dbcmd.ExecuteNonQuery();
        }
        
        /*
@@ -73,16 +100,20 @@ class SqliteEncoder : Sqlite
                        es.uniqueID = "NULL";
 
                dbcmd.CommandText = "INSERT INTO " + Constants.EncoderTable +  
-                               " (uniqueID, personID, sessionID, exerciseID, eccon, laterality, extraWeight, 
signalOrCurve, filename, url, time, minHeight, smooth, description, 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 + "', 'active', " + 
-                               "'','" +                //future2 url (this is stored later)
-                               es.future3 + "')" ;     //future3 
+                       " (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 + 
+                       "', 'active', '" + es.videoURL + "', '" + es.mode + "', " + 
+                       es.inertiaMomentum + ", " + es.diameter + ", '" +
+                       es.future1 + "', '" + es.future2 + "', '" +
+                       es.future3 + "')";
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -120,7 +151,12 @@ class SqliteEncoder : Sqlite
                                ", minHeight = " + es.minHeight +
                                ", smooth = " + Util.ConvertToPoint(es.smooth) +        //unused. in 1.3.7 is 
on preferences
                                ", description = '" + es.description + 
-                               "', future1 = '" + es.future1 + 
+                               "', status = '" + es.status + 
+                               "', videoURL = '" + es.videoURL + 
+                               "', mode = '" + es.mode + 
+                               "', inertiaMomentum = " + es.inertiaMomentum + 
+                               ", diameter = " + es.diameter + 
+                               ", future1 = '" + es.future1 + 
                                "', future2 = '" + es.future2 + 
                                "', future3 = '" + es.future3 + 
                                "' WHERE uniqueID == " + es.uniqueID ;
@@ -138,6 +174,7 @@ class SqliteEncoder : Sqlite
        //pass uniqueID==-1 and personID, sessionID, signalOrCurve values, and will return some records
        //personID can be -1 to get all on that session
        //sessionID can be -1 to get all sessions
+       //signalOrCurve can be "all"
        public static ArrayList Select (bool dbconOpened, 
                        int uniqueID, int personID, int sessionID, string signalOrCurve, bool onlyActive)
        {
@@ -155,19 +192,26 @@ class SqliteEncoder : Sqlite
                string selectStr = "";
                if(uniqueID != -1)
                        selectStr = Constants.EncoderTable + ".uniqueID = " + uniqueID;
-               else
-                       selectStr = personIDStr + sessionIDStr + 
-                       " signalOrCurve = '" + signalOrCurve + "'";
+               else {
+                       if(signalOrCurve == "all")
+                               selectStr = personIDStr + sessionIDStr;
+                       else
+                               selectStr = personIDStr + sessionIDStr + " signalOrCurve = '" + signalOrCurve 
+ "'";
+               }
+
+               string andString = "";
+               if(selectStr != "")
+                       andString = " AND ";
 
                string onlyActiveString = "";
                if(onlyActive)
-                       onlyActiveString = " AND " + Constants.EncoderTable + ".future1 = 'active' ";
+                       onlyActiveString = " AND " + Constants.EncoderTable + ".status = 'active' ";
 
                dbcmd.CommandText = "SELECT " + 
                        Constants.EncoderTable + ".*, " + Constants.EncoderExerciseTable + ".name FROM " + 
                        Constants.EncoderTable  + ", " + Constants.EncoderExerciseTable  + 
                        " WHERE " + selectStr +
-                       " AND " + Constants.EncoderTable + ".exerciseID = " + 
+                       andString + Constants.EncoderTable + ".exerciseID = " + 
                                Constants.EncoderExerciseTable + ".uniqueID " +
                                onlyActiveString +
                        " ORDER BY substr(filename,-23,19)"; //this contains the date of capture signal
@@ -196,10 +240,15 @@ class SqliteEncoder : Sqlite
                                        Convert.ToInt32(reader[11].ToString()), //minHeight
                                        Convert.ToDouble(Util.ChangeDecimalSeparator(reader[12].ToString())), 
//smooth UNUSED
                                        reader[13].ToString(),                  //description
-                                       reader[14].ToString(),                  //future1
-                                       reader[15].ToString(),                  //future2
-                                       reader[16].ToString(),                  //future3
-                                       reader[17].ToString()                   //EncoderExercise.name
+                                       reader[14].ToString(),                  //status
+                                       reader[15].ToString(),                  //videoURL
+                                       reader[16].ToString(),                  //mode
+                                       Convert.ToInt32(reader[17].ToString()), //inertiaMomentum
+                                       Convert.ToDouble(Util.ChangeDecimalSeparator(reader[18].ToString())), 
//diameter
+                                       reader[19].ToString(),                  //future1
+                                       reader[20].ToString(),                  //future2
+                                       reader[21].ToString(),                  //future3
+                                       reader[22].ToString()                   //EncoderExercise.name
                                        );
                        array.Add (es);
                }
@@ -218,22 +267,22 @@ class SqliteEncoder : Sqlite
 
                /* OLD, returns a row for active and a row for inactive at each session 
                dbcmd.CommandText = 
-                       "SELECT count(*), encoder.sessionID, session.name, session.date, encoder.future1 " +
+                       "SELECT count(*), encoder.sessionID, session.name, session.date, encoder.status " +
                        " FROM encoder, session, person77 " +
                        " WHERE encoder.personID == " + personID + " AND signalOrCurve == 'curve' AND " + 
                        " encoder.personID == person77.uniqueID AND encoder.sessionID == session.uniqueID " + 
-                       " GROUP BY encoder.sessionID, encoder.future1 ORDER BY encoder.sessionID, 
encoder.future1";
+                       " GROUP BY encoder.sessionID, encoder.status ORDER BY encoder.sessionID, 
encoder.status";
                        */
 
                //returns a row for each session where there are active or inactive
                dbcmd.CommandText = 
                        "SELECT encoder.sessionID, session.name, session.date, " +
-                       " SUM(CASE WHEN encoder.future1 = 'active' THEN 1 END) as active, " +
-                       " SUM(CASE WHEN encoder.future1 = 'inactive' THEN 1 END) as inactive " + 
+                       " SUM(CASE WHEN encoder.status = 'active' THEN 1 END) as active, " +
+                       " SUM(CASE WHEN encoder.status = 'inactive' THEN 1 END) as inactive " + 
                        " FROM encoder, session, person77 " +
                        " WHERE encoder.personID == " + personID + " AND signalOrCurve == 'curve' AND " +
                        " encoder.personID == person77.uniqueID AND encoder.sessionID == session.uniqueID " +
-                       " GROUP BY encoder.sessionID ORDER BY encoder.sessionID, encoder.future1";
+                       " GROUP BY encoder.sessionID ORDER BY encoder.sessionID, encoder.status";
        
                Log.WriteLine(dbcmd.CommandText.ToString());
                
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 06bb96c..1730557 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -74,7 +74,7 @@ class Sqlite
         * Important, change this if there's any update to database
         * Important2: if database version get numbers higher than 1, check if the comparisons with 
currentVersion works ok
         */
-       static string lastChronojumpDatabaseVersion = "0.98";
+       static string lastChronojumpDatabaseVersion = "0.99";
 
        public Sqlite() {
        }
@@ -1335,6 +1335,48 @@ class Sqlite
 
                                currentVersion = "0.98";
                        }
+                       if(currentVersion == "0.98") {
+                               dbcon.Open();
+               
+                               ArrayList array = 
SqliteOldConvert.EncoderSelect098(true,-1,-1,-1,"all",false);
+                               
+                               conversionRateTotal = array.Count;
+                               
+                               dropTable(Constants.EncoderTable);
+                               SqliteEncoder.createTableEncoder();
+                       
+                               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
+                                       Log.WriteLine(dbcmd.CommandText.ToString());
+                                       dbcmd.ExecuteNonQuery();
+                                       count ++;
+                               }       
+
+                               conversionRate = count;
+                               Log.WriteLine("Encoder table improved");
+                               SqlitePreferences.Update ("databaseVersion", "0.99", true); 
+                               dbcon.Close();
+
+                               currentVersion = "0.99";
+                       }
+                               
                }
 
                //if changes are made here, remember to change also in CreateTables()
diff --git a/src/sqlite/oldConvert.cs b/src/sqlite/oldConvert.cs
new file mode 100644
index 0000000..8675319
--- /dev/null
+++ b/src/sqlite/oldConvert.cs
@@ -0,0 +1,116 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * ChronoJump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Copyright (C) 2004-2013   Xavier de Blas <xaviblas gmail com> 
+ */
+
+using System;
+using System.Data;
+using System.IO;
+using System.Collections; //ArrayList
+using Mono.Data.Sqlite;
+
+/* methods for convert from old tables to new tables */
+
+class SqliteOldConvert : Sqlite
+{
+       //pass uniqueID value and then will return one record. do like this:
+       //EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, myUniqueID, 0, 0, "")[0];
+       //or
+       //pass uniqueID==-1 and personID, sessionID, signalOrCurve values, and will return some records
+       //personID can be -1 to get all on that session
+       //sessionID can be -1 to get all sessions
+       //signalOrCurve can be "all"
+       public static ArrayList EncoderSelect098 (bool dbconOpened, 
+                       int uniqueID, int personID, int sessionID, string signalOrCurve, bool onlyActive)
+       {
+               if(! dbconOpened)
+                       dbcon.Open();
+
+               string personIDStr = "";
+               if(personID != -1)
+                       personIDStr = " personID = " + personID + " AND ";
+
+               string sessionIDStr = "";
+               if(sessionID != -1)
+                       sessionIDStr = " sessionID = " + sessionID + " AND ";
+
+               string selectStr = "";
+               if(uniqueID != -1)
+                       selectStr = Constants.EncoderTable + ".uniqueID = " + uniqueID;
+               else {
+                       if(signalOrCurve == "all")
+                               selectStr = personIDStr + sessionIDStr;
+                       else
+                               selectStr = personIDStr + sessionIDStr + " signalOrCurve = '" + signalOrCurve 
+ "'";
+               }
+
+               string andString = "";
+               if(selectStr != "")
+                       andString = " AND ";
+
+               string onlyActiveString = "";
+               if(onlyActive)
+                       onlyActiveString = " AND " + Constants.EncoderTable + ".future1 = 'active' ";
+
+               dbcmd.CommandText = "SELECT " + 
+                       Constants.EncoderTable + ".*, " + Constants.EncoderExerciseTable + ".name FROM " + 
+                       Constants.EncoderTable  + ", " + Constants.EncoderExerciseTable  + 
+                       " WHERE " + selectStr +
+                       andString + Constants.EncoderTable + ".exerciseID = " + 
+                               Constants.EncoderExerciseTable + ".uniqueID " +
+                               onlyActiveString +
+                       " ORDER BY substr(filename,-23,19)"; //this contains the date of capture signal
+
+               Log.WriteLine(dbcmd.CommandText.ToString());
+               
+               SqliteDataReader reader;
+               reader = dbcmd.ExecuteReader();
+
+               ArrayList array = new ArrayList(1);
+
+               EncoderSQL098 es = new EncoderSQL098();
+               while(reader.Read()) {
+                       es = new EncoderSQL098 (
+                                       reader[0].ToString(),                   //uniqueID
+                                       Convert.ToInt32(reader[1].ToString()),  //personID      
+                                       Convert.ToInt32(reader[2].ToString()),  //sessionID
+                                       Convert.ToInt32(reader[3].ToString()),  //exerciseID
+                                       reader[4].ToString(),                   //eccon
+                                       reader[5].ToString(),                   //laterality
+                                       reader[6].ToString(),                   //extraWeight
+                                       reader[7].ToString(),                   //signalOrCurve
+                                       reader[8].ToString(),                   //filename
+                                       reader[9].ToString(),                   //url
+                                       Convert.ToInt32(reader[10].ToString()), //time
+                                       Convert.ToInt32(reader[11].ToString()), //minHeight
+                                       Convert.ToDouble(Util.ChangeDecimalSeparator(reader[12].ToString())), 
//smooth UNUSED
+                                       reader[13].ToString(),                  //description
+                                       reader[14].ToString(),                  //future1
+                                       reader[15].ToString(),                  //future2
+                                       reader[16].ToString(),                  //future3
+                                       reader[17].ToString()                   //EncoderExercise.name
+                                       );
+                       array.Add (es);
+               }
+               reader.Close();
+               if(! dbconOpened)
+                       dbcon.Close();
+
+               return array;
+       }
+}


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