[chronojump] Safer SQL using Sqlite ON with try catch, and safer create multiple persons



commit 5c360758beb984de9908d3676a82eedbec7bdc3a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Nov 1 13:57:09 2014 +0100

    Safer SQL using Sqlite ON with try catch, and safer create multiple persons

 src/gui/person.cs                    |   20 +-
 src/person.cs                        |    4 +-
 src/personSession.cs                 |    4 +-
 src/sqlite/country.cs                |   14 +-
 src/sqlite/encoder.cs                |   54 +++---
 src/sqlite/event.cs                  |   14 +-
 src/sqlite/executeAuto.cs            |    8 +-
 src/sqlite/jump.cs                   |   26 ++--
 src/sqlite/jumpRj.cs                 |   22 +-
 src/sqlite/jumpType.cs               |   44 ++--
 src/sqlite/main.cs                   |  386 +++++++++++++++++----------------
 src/sqlite/multiChronopic.cs         |   22 +-
 src/sqlite/oldConvert.cs             |   10 +-
 src/sqlite/person.cs                 |   39 ++--
 src/sqlite/personSession.cs          |   46 ++--
 src/sqlite/personSessionNotUpload.cs |   14 +-
 src/sqlite/preferences.cs            |   16 +-
 src/sqlite/pulse.cs                  |   18 +-
 src/sqlite/pulseType.cs              |   14 +-
 src/sqlite/reactionTime.cs           |   18 +-
 src/sqlite/run.cs                    |   18 +-
 src/sqlite/runInterval.cs            |   18 +-
 src/sqlite/runType.cs                |   38 ++--
 src/sqlite/server.cs                 |   34 ++--
 src/sqlite/session.cs                |   46 ++--
 src/sqlite/speciallity.cs            |   18 +-
 src/sqlite/sport.cs                  |   18 +-
 src/sqlite/stat.cs                   |   60 +++---
 28 files changed, 530 insertions(+), 513 deletions(-)
---
diff --git a/src/gui/person.cs b/src/gui/person.cs
index c783407..943f8a7 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -1644,7 +1644,7 @@ public class PersonAddModifyWindow
                                        Constants.RaceUndefinedID,
                                        Convert.ToInt32(Util.FindOnArray(':', 2, 0, 
UtilGtk.ComboGetActive(combo_countries), countries)),
                                        textview_description.Buffer.Text,
-                                       Constants.ServerUndefinedID);
+                                       Constants.ServerUndefinedID, false); //dbconOpened
                                        
                        currentPersonSession = new PersonSession (
                                        currentPerson.UniqueID, currentSession.UniqueID, 
@@ -1652,7 +1652,7 @@ public class PersonAddModifyWindow
                                        sport.UniqueID, 
                                        Convert.ToInt32(Util.FindOnArray(':', 2, 0, 
UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
                                        Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
-                                       textview_ps_comments.Buffer.Text);
+                                       textview_ps_comments.Buffer.Text, false); //dbconOpened
                } else {
                        //here we update rows in the database
                        currentPerson = new Person (currentPerson.UniqueID, entry1.Text, sex, dateTime, 
@@ -1674,7 +1674,7 @@ public class PersonAddModifyWindow
                                                sport.UniqueID, 
                                                Convert.ToInt32(Util.FindOnArray(':', 2, 0, 
UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
                                                Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
-                                               textview_ps_comments.Buffer.Text);
+                                               textview_ps_comments.Buffer.Text, false); //dbconOpened
                        else {
                                //don't come from recuperate
                                //we only need to update personSession
@@ -2180,8 +2180,10 @@ public class PersonAddMultipleWindow {
                errorRepeatedEntryString = "";
                personsCreatedCount = 0;
 
+               Sqlite.Open();
                for (int i = 0; i < rows; i ++) 
                        checkEntries(i, ((Gtk.Entry)entries[i]).Text.ToString(), (int) 
((Gtk.SpinButton)spins[i]).Value);
+               Sqlite.Close();
        
                checkAllEntriesAreDifferent();
 
@@ -2198,9 +2200,9 @@ public class PersonAddMultipleWindow {
                }
        }
                
-       void checkEntries(int count, string name, double weight) {
+       private void checkEntries(int count, string name, double weight) {
                if(name.Length > 0) {
-                       bool personExists = Sqlite.Exists (false, Constants.PersonTable, 
Util.RemoveTilde(name));
+                       bool personExists = Sqlite.Exists (true, Constants.PersonTable, 
Util.RemoveTilde(name));
                        if(personExists) {
                                errorExistsString += "[" + (count+1) + "] " + name + "\n";
                        }
@@ -2250,6 +2252,7 @@ public class PersonAddMultipleWindow {
        //all this names doesn't match with other in the database, and the weights are > 0 ( checked in 
checkEntries() )
        void prepareAllNonBlankRows() 
        {
+               Sqlite.Open();
                //the last is the first for having the first value inserted as currentPerson
                for (int i = rows -1; i >= 0; i --) 
                        if(((Gtk.Entry)entries[i]).Text.ToString().Length > 0)
@@ -2257,9 +2260,10 @@ public class PersonAddMultipleWindow {
                                                ((Gtk.Entry)entries[i]).Text.ToString(), 
                                                ((Gtk.RadioButton)radiosM[i]).Active, 
                                                (double) ((Gtk.SpinButton)spins[i]).Value);
+               Sqlite.Close();
        }
 
-       void insertPerson (string name, bool male, double weight) 
+       private void insertPerson (string name, bool male, double weight) 
        {
                string sex = Constants.F;
                if(male) { sex = Constants.M; }
@@ -2271,7 +2275,7 @@ public class PersonAddMultipleWindow {
                                Constants.RaceUndefinedID,
                                Constants.CountryUndefinedID,
                                "",                     //description
-                               Constants.ServerUndefinedID);
+                               Constants.ServerUndefinedID, true); //dbconOpened
                                
 
                new PersonSession (
@@ -2280,7 +2284,7 @@ public class PersonAddMultipleWindow {
                                currentSession.PersonsSportID,
                                currentSession.PersonsSpeciallityID,
                                currentSession.PersonsPractice,
-                               "");                    //comments
+                               "", true);                      //comments, dbconOpened
 
                personsCreatedCount ++;
        }
diff --git a/src/person.cs b/src/person.cs
index eb16111..de0bf4e 100644
--- a/src/person.cs
+++ b/src/person.cs
@@ -66,7 +66,7 @@ public partial class Person {
        //used when we create new person 
        //we don't know uniqueID
        public Person(string name, string sex, DateTime dateBorn, int race, int countryID, string description,
-                       int serverUniqueID) 
+                       int serverUniqueID, bool dbconOpened) 
        {
                name = Util.RemoveTildeAndColon(name);
                description = Util.RemoveTildeAndColon(description);
@@ -82,7 +82,7 @@ public partial class Person {
                //insert in the person table
                //when insert as person we don't know uniqueID
                uniqueID = -1;
-               int insertedID = this.InsertAtDB(false, Constants.PersonTable);
+               int insertedID = this.InsertAtDB(dbconOpened, Constants.PersonTable);
 
                //we need uniqueID for personSession
                uniqueID = insertedID;
diff --git a/src/personSession.cs b/src/personSession.cs
index 529f706..6d8b7ca 100644
--- a/src/personSession.cs
+++ b/src/personSession.cs
@@ -63,7 +63,7 @@ public partial class PersonSession {
        //this adds to database
        public PersonSession(int personID, int sessionID,
                        double height, double weight, int sportID, 
-                       int speciallityID, int practice, string comments)
+                       int speciallityID, int practice, string comments, bool dbconOpened)
        {
                comments = Util.RemoveTildeAndColon(comments);
 
@@ -79,7 +79,7 @@ public partial class PersonSession {
                //insert in the personSession table
                //when insert as personSession we don't know uniqueID
                uniqueID = -1;
-               int insertedID = this.InsertAtDB(false, Constants.PersonSessionTable);
+               int insertedID = this.InsertAtDB(dbconOpened, Constants.PersonSessionTable);
                uniqueID = insertedID;
 
                Log.WriteLine(this.ToString());
diff --git a/src/sqlite/country.cs b/src/sqlite/country.cs
index 4dbaa4f..f26d408 100644
--- a/src/sqlite/country.cs
+++ b/src/sqlite/country.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 
@@ -63,7 +63,7 @@ class SqliteCountry : Sqlite
        public static int Insert(bool dbconOpened, string code, string nameEnglish, string continent)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string myString = "INSERT INTO " + Constants.CountryTable + 
                        //" (uniqueID, code, name, continent) VALUES (NULL, '" + code + "', '" + 
@@ -82,14 +82,14 @@ class SqliteCountry : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
 
        public static string [] SelectCountriesOfAContinent(string continent, bool insertUndefined)
        {
-               dbcon.Open();
+               Sqlite.Open();
                
                dbcmd.CommandText = "SELECT uniqueID, name FROM " + Constants.CountryTable + " WHERE 
continent == '" + continent + "'";
                
@@ -104,7 +104,7 @@ class SqliteCountry : Sqlite
                                        reader[1].ToString() + ":" + 
                                        Catalog.GetString(reader[1].ToString()));
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                int count = 0;
                string [] myReturn;
@@ -124,7 +124,7 @@ class SqliteCountry : Sqlite
        
        public static string [] Select(int uniqueID)
        {
-               dbcon.Open();
+               Sqlite.Open();
                
                dbcmd.CommandText = "SELECT * FROM " + Constants.CountryTable + " WHERE uniqueID == " + 
uniqueID;
                
@@ -142,7 +142,7 @@ class SqliteCountry : Sqlite
                myReturn[3] = reader[3].ToString(); //continent
                
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myReturn;
        }
 
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 5911ee4..15407ee 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -15,7 +15,7 @@
  *  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-2012   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -70,7 +70,7 @@ class SqliteEncoder : Sqlite
        public static int Insert(bool dbconOpened, EncoderSQL es)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(es.uniqueID == "-1")
                        es.uniqueID = "NULL";
@@ -100,7 +100,7 @@ class SqliteEncoder : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -108,7 +108,7 @@ class SqliteEncoder : Sqlite
        public static void Update(bool dbconOpened, EncoderSQL es)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(es.uniqueID == "-1")
                        es.uniqueID = "NULL";
@@ -138,7 +138,7 @@ class SqliteEncoder : Sqlite
                dbcmd.ExecuteNonQuery();
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
        
        //pass uniqueID value and then will return one record. do like this:
@@ -160,7 +160,7 @@ class SqliteEncoder : Sqlite
                        bool onlyActive, bool orderIDascendent)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string personIDStr = "";
                if(personID != -1)
@@ -258,7 +258,7 @@ class SqliteEncoder : Sqlite
                }
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
@@ -267,7 +267,7 @@ class SqliteEncoder : Sqlite
        public static ArrayList SelectCompareIntersession (bool dbconOpened, int personID)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                /* OLD, returns a row for active and a row for inactive at each session 
                dbcmd.CommandText = 
@@ -319,7 +319,7 @@ class SqliteEncoder : Sqlite
                }
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
@@ -343,7 +343,7 @@ class SqliteEncoder : Sqlite
        public static void SignalCurveInsert(bool dbconOpened, int signalID, int curveID, int msCentral)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "INSERT INTO " + Constants.EncoderSignalCurveTable +  
                        " (uniqueID, signalID, curveID, msCentral, future1) " + 
@@ -352,7 +352,7 @@ class SqliteEncoder : Sqlite
                dbcmd.ExecuteNonQuery();
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
        
 
@@ -362,7 +362,7 @@ class SqliteEncoder : Sqlite
        public static ArrayList SelectSignalCurve (bool dbconOpened, int signalID, int curveID, double 
msStart, double msEnd)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string whereStr = "";
                if(signalID != -1 || curveID != -1 || msStart != -1)
@@ -408,7 +408,7 @@ class SqliteEncoder : Sqlite
                }
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
@@ -416,7 +416,7 @@ class SqliteEncoder : Sqlite
        public static void DeleteSignalCurveWithCurveID(bool dbconOpened, int curveID)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "Delete FROM " + Constants.EncoderSignalCurveTable +
                        " WHERE curveID == " + curveID.ToString();
@@ -424,7 +424,7 @@ class SqliteEncoder : Sqlite
                dbcmd.ExecuteNonQuery();
                
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
        
        //when select from database, ensure path separators are ok for this platform
@@ -479,7 +479,7 @@ class SqliteEncoder : Sqlite
                        string ressistance, string description, string speed1RM)         //speed1RM decimal 
point = '.'
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "INSERT INTO " + Constants.EncoderExerciseTable +  
                                " (uniqueID, name, percentBodyWeight, ressistance, description, future1, 
future2, future3)" +
@@ -489,7 +489,7 @@ class SqliteEncoder : Sqlite
                dbcmd.ExecuteNonQuery();
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        //Note: if this names change, or there are new, change them on both:
@@ -543,7 +543,7 @@ class SqliteEncoder : Sqlite
                        string ressistance, string description, string speed1RM)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "UPDATE " + Constants.EncoderExerciseTable + " SET " +
                                " name = '" + name +
@@ -557,7 +557,7 @@ class SqliteEncoder : Sqlite
                dbcmd.ExecuteNonQuery();
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
        
        //if uniqueID != -1, returns an especific EncoderExercise that can be read like this    
@@ -565,7 +565,7 @@ class SqliteEncoder : Sqlite
        public static ArrayList SelectEncoderExercises(bool dbconOpened, int uniqueID, bool onlyNames) 
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string uniqueIDStr = "";
                if(uniqueID != -1)
@@ -610,7 +610,7 @@ class SqliteEncoder : Sqlite
 
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
@@ -619,7 +619,7 @@ class SqliteEncoder : Sqlite
        public static ArrayList SelectEncoderRowsOfAnExercise(bool dbconOpened, int exerciseID) 
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "select count(*), " + 
                        Constants.PersonTable + ".name, " +
@@ -651,7 +651,7 @@ class SqliteEncoder : Sqlite
 
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
@@ -696,7 +696,7 @@ class SqliteEncoder : Sqlite
        public static void Insert1RM(bool dbconOpened, int personID, int sessionID, int exerciseID, double 
load1RM)     
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "INSERT INTO " + Constants.Encoder1RMTable +  
                                " (uniqueID, personID, sessionID, exerciseID, load1RM, future1, future2, 
future3)" +
@@ -706,13 +706,13 @@ class SqliteEncoder : Sqlite
                dbcmd.ExecuteNonQuery();
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
        
        public static ArrayList Select1RM (bool dbconOpened, int personID, int sessionID, int exerciseID, 
bool returnPersonNameAndExerciseName)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string whereStr = "";
                if(personID != -1 || sessionID != -1 || exerciseID != -1) {
@@ -782,7 +782,7 @@ class SqliteEncoder : Sqlite
                }
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
diff --git a/src/sqlite/event.cs b/src/sqlite/event.cs
index a14c9fd..9e94287 100644
--- a/src/sqlite/event.cs
+++ b/src/sqlite/event.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -50,7 +50,7 @@ class SqliteEvent : Sqlite
        public static int GraphLinkInsert(string tableName, string eventName, string graphFileName, bool 
dbconOpened)
        {
                if(! dbconOpened) {
-                       dbcon.Open();
+                       Sqlite.Open();
                }
                dbcmd.CommandText = "INSERT INTO graphLinkTable" + 
                                "(uniqueID, tableName, eventName, graphFileName, other1, other2)" +
@@ -63,7 +63,7 @@ class SqliteEvent : Sqlite
                dbcmd.CommandText = myString;
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
                if(! dbconOpened) {
-                       dbcon.Close();
+                       Sqlite.Close();
                }
 
                return myLast;
@@ -72,7 +72,7 @@ class SqliteEvent : Sqlite
        //do not use this because some graph like the takeoff.png are not in this SQL table     
        public static string GraphLinkSelectFileName(string tableName, string eventName)
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                dbcmd.CommandText = "SELECT graphFileName FROM graphLinkTable WHERE tableName == '" + 
tableName + "' AND eventName =='" + eventName + "'";
                
@@ -88,7 +88,7 @@ class SqliteEvent : Sqlite
                }
        
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return returnString;
        }
                
@@ -97,7 +97,7 @@ class SqliteEvent : Sqlite
        public static void UpdateSimulated(bool dbconOpened, string tableName, int uniqueID, int simulated)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "UPDATE " + tableName + " SET simulated = " + simulated + 
                        " WHERE uniqueID == " + uniqueID ;
@@ -105,7 +105,7 @@ class SqliteEvent : Sqlite
                dbcmd.ExecuteNonQuery();
 
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        //convertSimulate and simulateConvertToNegative as a part of db conversion to 0.60
diff --git a/src/sqlite/executeAuto.cs b/src/sqlite/executeAuto.cs
index 199ba61..a181aaa 100644
--- a/src/sqlite/executeAuto.cs
+++ b/src/sqlite/executeAuto.cs
@@ -60,7 +60,7 @@ class SqliteExecuteAuto : Sqlite
        public static void Insert(bool dbconOpened, ExecuteAutoSQL eaSQL)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "INSERT INTO " + Constants.ExecuteAutoTable +  
                        " (uniqueID, name, mode, description, " +
@@ -76,7 +76,7 @@ class SqliteExecuteAuto : Sqlite
                dbcmd.ExecuteNonQuery();
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        protected internal static void addChronojumpProfileAndBilateral()
@@ -125,7 +125,7 @@ class SqliteExecuteAuto : Sqlite
        public static List<ExecuteAutoSQL> Select(bool dbconOpened, int uniqueID) 
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string whereStr = "";
                if(uniqueID != -1)
@@ -154,7 +154,7 @@ class SqliteExecuteAuto : Sqlite
                }
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return sequences;
        }
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 79f7464..dccc594 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -67,7 +67,7 @@ class SqliteJump : Sqlite
        public static int Insert(bool dbconOpened, string tableName, string uniqueID, int personID, int 
sessionID, string type, double tv, double tc, double fall, double weight, string description, double angle, 
int simulated)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -89,7 +89,7 @@ class SqliteJump : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -100,7 +100,7 @@ class SqliteJump : Sqlite
        public static string[] SelectJumps(bool dbconOpened, int sessionID, int personID, string 
filterWeight, string filterType) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string tp = Constants.PersonTable;
                string tps = Constants.PersonSessionTable;
@@ -165,7 +165,7 @@ class SqliteJump : Sqlite
                reader.Close();
                
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
 
                string [] myJumps = new string[count];
@@ -180,7 +180,7 @@ class SqliteJump : Sqlite
        public static Jump SelectJumpData(int uniqueID, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM jump WHERE uniqueID == " + uniqueID;
                
@@ -196,7 +196,7 @@ class SqliteJump : Sqlite
                reader.Close();
                
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myJump;
        }
@@ -204,7 +204,7 @@ class SqliteJump : Sqlite
 
        public static void Update(int jumpID, string type, string tv, string tc, string fall, int personID, 
double weight, string description, double angle)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE jump SET personID = " + personID + 
                        ", type = '" + type +
                        "', tv = " + Util.ConvertToPoint(tv) +
@@ -216,27 +216,27 @@ class SqliteJump : Sqlite
                        " WHERE uniqueID == " + jumpID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        public static void UpdateWeight(string tableName, int uniqueID, double weight)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + tableName + " SET weight = " + Util.ConvertToPoint(weight) + 
                        " WHERE uniqueID == " + uniqueID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        public static void UpdateDescription(string tableName, int uniqueID, string description)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + tableName + " SET description = '" + description + 
                        "' WHERE uniqueID == " + uniqueID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        //onle for change SJ+ CMJ+ and ABK+ to SJl...
diff --git a/src/sqlite/jumpRj.cs b/src/sqlite/jumpRj.cs
index 1603307..c2d130c 100644
--- a/src/sqlite/jumpRj.cs
+++ b/src/sqlite/jumpRj.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -61,7 +61,7 @@ class SqliteJumpRj : SqliteJump
        public static int Insert (bool dbconOpened, string tableName, string uniqueID, int personID, int 
sessionID, string type, double tvMax, double tcMax, double fall, double weight, string description, double 
tvAvg, double tcAvg, string tvString, string tcString, int jumps, double time, string limited, string 
angleString, int simulated )
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -86,7 +86,7 @@ class SqliteJumpRj : SqliteJump
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -112,7 +112,7 @@ class SqliteJumpRj : SqliteJump
                if(filterType != "")
                        filterTypeString = " AND jumpRj.type == '" + filterType + "' ";
 
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, jumpRj.*, " + tps + ".weight " +
                        " FROM " + tp + ", jumpRj, " + tps + " " +
                        " WHERE " + tp + ".uniqueID == jumpRj.personID" + 
@@ -161,7 +161,7 @@ class SqliteJumpRj : SqliteJump
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] myJumps = new string[count];
                count =0;
@@ -177,7 +177,7 @@ class SqliteJumpRj : SqliteJump
                //tableName is jumpRj or tempJumpRj
 
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + tableName + " WHERE uniqueID == " + uniqueID;
                
@@ -192,13 +192,13 @@ class SqliteJumpRj : SqliteJump
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myJump;
        }
        
        public static void Update(int jumpID, int personID, string fall, double weight, string description)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE jumpRj SET personID = " + personID + 
                        ", fall = " + Util.ConvertToPoint(Convert.ToDouble(fall)) + 
                        ", weight = " + Util.ConvertToPoint(weight) + 
@@ -206,14 +206,14 @@ class SqliteJumpRj : SqliteJump
                        "' WHERE uniqueID == " + jumpID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        //checks if there are Rjs with different number of TCs than TFs
        //then repair database manually, and look if the jump is jumpLimited, and how many jumps there are 
defined
        public static void FindBadRjs()
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                dbcmd.CommandText = "SELECT uniqueID, tcstring, tvstring, jumps, limited FROM jumpRj";
                
@@ -234,7 +234,7 @@ class SqliteJumpRj : SqliteJump
                        }
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 }
diff --git a/src/sqlite/jumpType.cs b/src/sqlite/jumpType.cs
index 4617bb3..f2f5253 100644
--- a/src/sqlite/jumpType.cs
+++ b/src/sqlite/jumpType.cs
@@ -154,7 +154,7 @@ class SqliteJumpType : Sqlite
        {
                string [] myStr = myJump.Split(new char[] {':'});
                if(! dbconOpened) {
-                       dbcon.Open();
+                       Sqlite.Open();
                }
                dbcmd.CommandText = "INSERT INTO " + Constants.JumpTypeTable +  
                                " (uniqueID, name, startIn, weight, description)" +
@@ -164,7 +164,7 @@ class SqliteJumpType : Sqlite
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                if(! dbconOpened) {
-                       dbcon.Close();
+                       Sqlite.Close();
                }
        }
 
@@ -172,7 +172,7 @@ class SqliteJumpType : Sqlite
        {
                string [] myStr = myJump.Split(new char[] {':'});
                if(! dbconOpened) {
-                       dbcon.Open();
+                       Sqlite.Open();
                }
                dbcmd.CommandText = "INSERT INTO " + Constants.JumpRjTypeTable + 
                                " (uniqueID, name, startIn, weight, jumpsLimited, fixedValue, description)" +
@@ -183,7 +183,7 @@ class SqliteJumpType : Sqlite
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                if(! dbconOpened) {
-                       dbcon.Close();
+                       Sqlite.Close();
                }
        }
 
@@ -202,7 +202,7 @@ class SqliteJumpType : Sqlite
                else if(filter == "nonTC") { whereString = " WHERE startIn == 1 "; }
        
                if(! dbconOpened)       
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.JumpTypeTable + " " +
@@ -236,7 +236,7 @@ class SqliteJumpType : Sqlite
                reader.Close();
 
                if(! dbconOpened)       
-                       dbcon.Close();
+                       Sqlite.Close();
 
                int numRows;
                if(allJumpsName != "") {
@@ -260,7 +260,7 @@ class SqliteJumpType : Sqlite
 
        public static string[] SelectJumpRjTypes(string allJumpsName, bool onlyName) 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.JumpRjTypeTable + " " +
                        " ORDER BY uniqueID";
@@ -292,7 +292,7 @@ class SqliteJumpType : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                int numRows;
                if(allJumpsName != "") {
@@ -315,7 +315,7 @@ class SqliteJumpType : Sqlite
        public static JumpType SelectAndReturnJumpType(string typeName, bool dbconOpened) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.JumpTypeTable + " " +
                        " WHERE name  = '" + typeName +
@@ -339,7 +339,7 @@ class SqliteJumpType : Sqlite
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myJumpType;
        }
@@ -347,7 +347,7 @@ class SqliteJumpType : Sqlite
        public static JumpType SelectAndReturnJumpRjType(string typeName, bool dbconOpened) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.JumpRjTypeTable + " " +
                        " WHERE name  = '" + typeName +
@@ -382,7 +382,7 @@ class SqliteJumpType : Sqlite
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myJumpType;
        }
@@ -390,7 +390,7 @@ class SqliteJumpType : Sqlite
        //tableName is jumpType or jumpRjType
        public static bool HasWeight(string tableName, string typeName) 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT weight " +
                        " FROM " + tableName +
                        " WHERE name == '" + typeName + "'";
@@ -411,14 +411,14 @@ class SqliteJumpType : Sqlite
                        }
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return hasWeight;
        }
 
        //we know if it has fall if it starts in 
        public static bool HasFall(string tableName, string typeName) 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT startIn " +
                        " FROM " + tableName +
                        " WHERE name == '" + typeName + "'";
@@ -436,41 +436,41 @@ class SqliteJumpType : Sqlite
                        }
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return hasFall;
        }
 
        //updates name  
        public static void Update(string nameOld, string nameNew)
        {
-               //dbcon.Open();
+               //Sqlite.Open();
                dbcmd.CommandText = "UPDATE jumpType SET name = '" + nameNew + 
                        "' WHERE name == '" + nameOld + "'";
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               //dbcon.Close();
+               //Sqlite.Close();
        }
 
        public static void UpdateOther(string column, string typeName, string newValue)
        {
-               //dbcon.Open();
+               //Sqlite.Open();
                dbcmd.CommandText = "UPDATE jumpType SET " + column + " = '" + newValue + 
                        "' WHERE name == '" + typeName + "'";
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               //dbcon.Close();
+               //Sqlite.Close();
        }
        
        public static void Delete(string tableName, string name, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                dbcmd.CommandText = "Delete FROM " + tableName + 
                        " WHERE name == '" + name + "'";
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
 }      
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 0e6ab7d..d486ade 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -92,8 +92,20 @@ class Sqlite
        //because lots of similar transactions have to be done
        public static void Open()
        {
-               Log.WriteLine("SQL ON");
-               dbcon.Open();
+               try {
+                       Log.WriteLine("SQL ON");
+                       dbcon.Open();
+               } catch {
+                       Log.WriteLine("-- catched --");
+
+                       Log.WriteLine("SQL OFF");
+                       dbcon.Close();
+                       
+                       Log.WriteLine("SQL ON");
+                       dbcon.Open();
+                       
+                       Log.WriteLine("-- end of catched --");
+               }
        }
        public static void Close()
        {
@@ -287,12 +299,12 @@ class Sqlite
        public static bool IsSqlite3() {
                if(sqlite3SelectWorks()){
                        Log.WriteLine("SQLITE3");
-                       dbcon.Close();
+                       Sqlite.Close();
                        return true;
                }
                else if(sqlite2SelectWorks()) {
                        Log.WriteLine("SQLITE2");
-                       dbcon.Close();
+                       Sqlite.Close();
                        //write sqlFile path on data/databasePath.txt
                        //TODO
                        //
@@ -301,7 +313,7 @@ class Sqlite
                }
                else {
                        Log.WriteLine("ERROR in sqlite detection");
-                       dbcon.Close();
+                       Sqlite.Close();
                        return false;
                }
        }
@@ -311,17 +323,17 @@ class Sqlite
                } catch {
                        /*
                        try {
-                               dbcon.Close();
+                               Sqlite.Close();
                                if(File.Exists(Util.GetDatabaseDir() + Path.DirectorySeparatorChar + 
"chronojump.db"))
                                        File.Move(Util.GetDatabaseDir() + Path.DirectorySeparatorChar + 
"chronojump.db",
                                                        Util.GetDatabaseTempDir() + 
Path.DirectorySeparatorChar + "chronojump.db");
 
                                dbcon.ConnectionString = connectionStringTemp;
                                dbcmd = dbcon.CreateCommand();
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqlitePreferences.Select("chronopicPort");
                        } catch {
-                               dbcon.Close();
+                               Sqlite.Close();
                                if(File.Exists(Util.GetDatabaseTempDir() + Path.DirectorySeparatorChar + 
"chronojump.db"))
                                        File.Move(Util.GetDatabaseTempDir() + Path.DirectorySeparatorChar + 
"chronojump.db",
                                                        Util.GetDatabaseDir() + Path.DirectorySeparatorChar + 
"chronojump.db");
@@ -338,10 +350,10 @@ class Sqlite
                 Unhandled Exception: System.NotSupportedException: Only Sqlite Version 3 is supported at 
this time
                   at Mono.Data.Sqlite.SqliteConnection.Open () [0x00000]
                 *
-               dbcon.Close();
+               Sqlite.Close();
                connectionString = "version=2; URI=file:" + sqlFile;
                dbcon.ConnectionString = connectionString;
-               dbcon.Open();
+               Sqlite.Open();
                try {
                        SqlitePreferences.Select("chronopicPort");
                } catch {
@@ -491,7 +503,7 @@ class Sqlite
                        SqlitePersonSessionOld sqlitePersonSessionOldObject = new SqlitePersonSessionOld();
 
                        if(currentVersion == "0.41") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                //SqlitePulse.createTable(Constants.PulseTable);
                                sqlitePulseObject.createTable(Constants.PulseTable);
@@ -501,62 +513,62 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.42", true); 
                                Log.WriteLine("Converted DB to 0.42 (added pulse and pulseType tables)");
 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.42";
                        }
 
                        if(currentVersion == "0.42") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqlitePulseType.Insert ("Free:-1:-1:free PulseStep mode", true); 
                                SqlitePreferences.Insert ("language", "es-ES"); 
                                SqlitePreferences.Update ("databaseVersion", "0.43", true); 
                                Log.WriteLine("Converted DB to 0.43 (added 'free' pulseType & language 
peference)");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.43";
                        }
 
                        if(currentVersion == "0.43") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqlitePreferences.Insert ("showQIndex", "False"); 
                                SqlitePreferences.Insert ("showDjIndex", "False"); 
                                SqlitePreferences.Update ("databaseVersion", "0.44", true); 
                                Log.WriteLine("Converted DB to 0.44 (added showQIndex, showDjIndex)");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.44";
                        }
 
                        if(currentVersion == "0.44") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqlitePreferences.Insert ("allowFinishRjAfterTime", "True"); 
                                SqlitePreferences.Update ("databaseVersion", "0.45", true); 
                                Log.WriteLine("Converted DB to 0.45 (added allowFinishRjAfterTime)");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.45";
                        }
 
                        if(currentVersion == "0.45") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqliteJumpType.JumpTypeInsert ("Free:1:0:Free jump", true); 
                                SqlitePreferences.Update ("databaseVersion", "0.46", true); 
                                Log.WriteLine("Added Free jump type");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.46";
                        }
 
                        if(currentVersion == "0.46") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                //SqliteReactionTime.createTable(Constants.ReactionTimeTable);
                                sqliteReactionTimeObject.createTable(Constants.ReactionTimeTable);
 
                                SqlitePreferences.Update ("databaseVersion", "0.47", true); 
                                Log.WriteLine("Added reaction time table");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.47";
                        }
 
                        if(currentVersion == "0.47") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                //SqliteJumpRj.createTable(Constants.TempJumpRjTable);
                                sqliteJumpRjObject.createTable(Constants.TempJumpRjTable);
@@ -565,12 +577,12 @@ class Sqlite
 
                                SqlitePreferences.Update ("databaseVersion", "0.48", true); 
                                Log.WriteLine("created tempJumpReactive and tempRunInterval tables");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.48";
                        }
 
                        if(currentVersion == "0.48") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                SqliteJumpType.JumpTypeInsert ("Rocket:1:0:Rocket jump", true); 
 
@@ -597,12 +609,12 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.49", true); 
                                Log.WriteLine("Added graphLinkTable, added Rocket jump and 5 agility tests: 
(20Yard, 505, Illinois, Shuttle-Run & ZigZag. Added graphs pof the 5 agility tests)");
 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.49";
                        }
 
                        if(currentVersion == "0.49") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqliteJumpType.Update ("SJ+", "SJl"); 
                                SqliteJumpType.Update ("CMJ+", "CJl"); 
                                SqliteJumpType.Update ("ABK+", "ABKl"); 
@@ -611,49 +623,49 @@ class Sqlite
                                SqliteJumpType.AddGraphLinksRj();       
                                SqlitePreferences.Update ("databaseVersion", "0.50", true); 
                                Log.WriteLine("changed SJ+ to SJl, same for CMJ+ and ABK+, added jump and 
jumpRj graph links");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.50";
                        }
 
                        if(currentVersion == "0.50") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqliteRunType.AddGraphLinksRunSimple(); 
                                SqliteRunIntervalType.AddGraphLinksRunInterval();       
                                SqlitePreferences.Update ("databaseVersion", "0.51", true); 
                                Log.WriteLine("added graphLinks for run simple and interval");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.51";
                        }
 
                        if(currentVersion == "0.51") {
-                               dbcon.Open();
+                               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); 
                                Log.WriteLine("added graphLinks for cmj_l and abk_l, fixed CMJl name");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.52";
                        }
                        
                        if(currentVersion == "0.52") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                sqlitePersonSessionOldObject.createTable (); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                
                                //this needs the dbCon closed
                                SqlitePersonSessionOld.moveOldTableToNewTable (); 
                                
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqlitePreferences.Update ("databaseVersion", "0.53", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                
                                Log.WriteLine("created weightSession table. Moved person weight data to 
weightSession table for each session that has performed");
                                currentVersion = "0.53";
                        }
                        
                        if(currentVersion == "0.53") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                SqliteSport.createTable();
                                SqliteSport.initialize();
@@ -664,35 +676,35 @@ class Sqlite
                                needToConvertPersonToSport = true;
                                
                                SqlitePreferences.Update ("databaseVersion", "0.54", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                
                                Log.WriteLine("Created sport tables. Added sport data, speciallity and level 
of practice to person table");
                                currentVersion = "0.54";
                        }
                        if(currentVersion == "0.54") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                SqliteSpeciallity.InsertUndefined(true);
 
                                SqlitePreferences.Update ("databaseVersion", "0.55", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                
                                Log.WriteLine("Added undefined to speciallity table");
                                currentVersion = "0.55";
                        }
                        if(currentVersion == "0.55") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                SqliteSessionOld.convertTableAddingSportStuff();
 
                                SqlitePreferences.Update ("databaseVersion", "0.56", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                
                                Log.WriteLine("Added session default sport stuff into session table");
                                currentVersion = "0.56";
                        }
                        if(currentVersion == "0.56") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                //jump and jumpRj
                                ArrayList arrayAngleAndSimulated = new ArrayList(1);
@@ -754,13 +766,13 @@ class Sqlite
                                convertTables(new SqlitePersonOld(), Constants.PersonOldTable, columnsBefore, 
arrayPersonRaceCountryServerID, putDescriptionInMiddle);
 
                                SqlitePreferences.Update ("databaseVersion", "0.57", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                
                                Log.WriteLine("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") {
-                               dbcon.Open();
+                               Sqlite.Open();
                
                                //check if "republic" is in country table
                                if(SqliteCountry.TableHasOldRepublicStuff()){
@@ -776,13 +788,13 @@ class Sqlite
                                }
                                
                                SqlitePreferences.Update ("databaseVersion", "0.58", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                
                                currentVersion = "0.58";
                        }
 
                        if(currentVersion == "0.58") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                conversionRateTotal = 2;
                                conversionRate = 1;
                                SqlitePreferences.Insert ("showAngle", "False"); 
@@ -794,12 +806,12 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.59", true); 
                                Log.WriteLine("Converted DB to 0.59 (added 'showAngle' to preferences, 
changed angle on jump to double)"); 
                                conversionRate = 2;
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.59";
                        }
 
                        if(currentVersion == "0.59") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                conversionRateTotal = 4;
 
                                conversionRate = 1;
@@ -820,12 +832,12 @@ class Sqlite
                                Log.WriteLine("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;
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.60";
                        }
 
                        if(currentVersion == "0.60") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                conversionRateTotal = 3;
                                conversionRate = 1;
 
@@ -850,27 +862,27 @@ class Sqlite
                                Log.WriteLine("Converted DB to 0.61 added RunIntervalType distancesString 
(now we van have interval tests with different distances of tracks). Added MTGUG");
                                
                                conversionRate = 3;
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.61";
                        }
                        if(currentVersion == "0.61") {
-                               dbcon.Open();
+                               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); 
                                Log.WriteLine("Converted DB to 0.62 added hexagon");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.62";
                        }
                        if(currentVersion == "0.62") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqlitePreferences.Insert ("versionAvailable", "");
                                SqlitePreferences.Update ("databaseVersion", "0.63", true); 
                                Log.WriteLine("Converted DB to 0.63 (added 'versionAvailable' to 
preferences)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.63";
                        }
                        if(currentVersion == "0.63") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                RunType type = new RunType();
                                type.Name = "Margaria";
@@ -882,11 +894,11 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.64", true); 
                                
                                Log.WriteLine("Converted DB to 0.64 (added margaria test)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.64";
                        }
                        if(currentVersion == "0.64") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqliteServer sqliteServerObject = new SqliteServer();
                                //user has also an evaluator table with a row (it's row)        
@@ -895,11 +907,11 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.65", true); 
                                
                                Log.WriteLine("Converted DB to 0.65 (added Sevaluator on client)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.65";
                        }
                        if(currentVersion == "0.65") {
-                               dbcon.Open();
+                               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);
 
@@ -907,32 +919,32 @@ class Sqlite
                                
                                //Log.WriteLine("Converted DB to 0.66 (added RunAnalysis Reactive jump)"); 
                                Log.WriteLine("Converted DB to 0.66 (done nothing)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.66";
                        }
                        if(currentVersion == "0.66") {
-                               dbcon.Open();
+                               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); 
                                
                                Log.WriteLine("Converted DB to 0.67 (added TakeOff jumps)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.67";
                        }
                        if(currentVersion == "0.67") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                sqliteMultiChronopicObject.createTable(Constants.MultiChronopicTable);
 
                                SqlitePreferences.Update ("databaseVersion", "0.68", true); 
                                
                                Log.WriteLine("Converted DB to 0.68 (added multiChronopic tests table)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.68";
                        }
                        if(currentVersion == "0.68") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                RunType type = new RunType();
                                type.Name = "Gesell-DBT";
@@ -944,48 +956,48 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.69", true); 
                                
                                Log.WriteLine("Converted DB to 0.69 (added Gesell-DBT test)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.69";
                        }
                        if(currentVersion == "0.69") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqlitePreferences.Insert ("showPower", "True"); 
                                SqlitePreferences.Update ("databaseVersion", "0.70", true); 
                                Log.WriteLine("Converted DB to 0.70 (added showPower)");
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.70";
                        }
                        if(currentVersion == "0.70") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqlitePersonSessionNotUpload.CreateTable();
 
                                SqlitePreferences.Update ("databaseVersion", "0.71", true); 
                                
                                Log.WriteLine("Converted DB to 0.71 (created personNotUploadTable on 
client)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.71";
                        }
                        if(currentVersion == "0.71") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                datesToYYYYMMDD();
 
                                SqlitePreferences.Update ("databaseVersion", "0.72", true); 
                                
                                Log.WriteLine("Converted DB to 0.72 (dates to YYYY-MM-DD)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.72";
                        }
                        if(currentVersion == "0.72") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                deleteOrphanedPersonsOld();
 
                                SqlitePreferences.Update ("databaseVersion", "0.73", true); 
                                
                                Log.WriteLine("Converted DB to 0.73 (deleted orphaned persons (in person 
table but not in personSessionWeight table)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.73";
                        }
                        if(currentVersion == "0.73") {
@@ -996,14 +1008,14 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.74", true); 
                                
                                Log.WriteLine("Converted DB to 0.74 (All DJ converted to DJna)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.74";
                        }
                        if(currentVersion == "0.74") {
                                conversionRateTotal = 3;
                                conversionRate = 1;
                                
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                convertTables(new SqlitePersonOld(), Constants.PersonOldTable, 13, new 
ArrayList(), false);
                                conversionRate++;
@@ -1014,13 +1026,13 @@ class Sqlite
                                conversionRate++;
                                
                                Log.WriteLine("Converted DB to 0.75 (person, and personSessionWeight have 
height and weight as double)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.75";
                        }
                        if(currentVersion == "0.75") {
                                conversionRateTotal = 3;
                                conversionRate = 1;
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                if(!jumpFallAsDouble)
                                        alterTableColumn(new SqliteJump(), Constants.JumpTable, 11);
@@ -1033,21 +1045,21 @@ class Sqlite
                                conversionRate++;
                                
                                Log.WriteLine("Converted DB to 0.76 (jump & jumpRj falls as double)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.76";
                        }
                        if(currentVersion == "0.76") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                convertPersonAndPersonSessionTo77();
                                SqlitePreferences.Update ("databaseVersion", "0.77", true); 
                                Log.WriteLine("Converted DB to 0.77 (person77, personSession77)"); 
                                
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.77";
                        }
                        if(currentVersion == "0.77") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                SqliteJumpType.UpdateOther ("weight", Constants.TakeOffWeightName, "1"); 
 
@@ -1058,22 +1070,22 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", "0.78", true); 
                                Log.WriteLine("Converted DB to 0.78 (Added machineID to preferences, 
takeOffWeight has no weight in db conversions since 0.66)"); 
 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.78";
                        }
                        if(currentVersion == "0.78") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                SqlitePreferences.Insert ("multimediaStorage", 
Constants.MultimediaStorage.BYSESSION.ToString());
 
                                SqlitePreferences.Update ("databaseVersion", "0.79", true); 
                                Log.WriteLine("Converted DB to 0.79 (Added multimediaStorage structure id)"); 
 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.79";
                        }
                        if(currentVersion == "0.79") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                if(! runAndRunIntervalInitialSpeedAdded) {
                                        ArrayList myArray = new ArrayList(1);
@@ -1090,11 +1102,11 @@ class Sqlite
 
                                SqlitePreferences.Update ("databaseVersion", "0.80", true); 
                                
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.80";
                        }
                        if(currentVersion == "0.80") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                ArrayList myArray = new ArrayList(1);
                                myArray.Add("0"); //initial speed
@@ -1108,11 +1120,11 @@ class Sqlite
 
                                SqlitePreferences.Update ("databaseVersion", "0.81", true); 
                                
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.81";
                        }
                        if(currentVersion == "0.81") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                conversionRateTotal = 2;
 
                                conversionRate = 1;
@@ -1122,11 +1134,11 @@ class Sqlite
 
                                SqlitePreferences.Update ("databaseVersion", "0.82", true); 
                                
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.82";
                        }
                        if(currentVersion == "0.82") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                conversionRateTotal = 2;
                                
                                conversionRate = 1;
@@ -1137,11 +1149,11 @@ class Sqlite
                                Log.WriteLine("Created encoder tables.");
 
                                SqlitePreferences.Update ("databaseVersion", "0.83", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.83";
                        }
                        if(currentVersion == "0.83") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                RunType type = new RunType();
                                type.Name = "RSA 8-4-R3-5";
@@ -1156,38 +1168,38 @@ class Sqlite
                                Log.WriteLine("Added 1st RSA test.");
 
                                SqlitePreferences.Update ("databaseVersion", "0.84", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.84";
                        }
                        if(currentVersion == "0.84") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                SqliteJumpType.JumpTypeInsert ("slCMJ:1:0:Single-leg CMJ jump", true);
 
                                SqlitePreferences.Update ("databaseVersion", "0.85", true); 
                                
                                Log.WriteLine("Converted DB to 0.85 (added slCMJ jump)"); 
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.85";
                        }
                        if(currentVersion == "0.85") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                Log.WriteLine("Converted DB to 0.86 videoOn: TRUE"); 
 
                                SqlitePreferences.Update("videoOn", "True", true);
                                SqlitePreferences.Update ("databaseVersion", "0.86", true); 
                                
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.86";
                        }
                        if(currentVersion == "0.86") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                Log.WriteLine("Added run speed start preferences on sqlite"); 
 
                                SqlitePreferences.Insert ("runSpeedStartArrival", "True");
                                SqlitePreferences.Insert ("runISpeedStartArrival", "True");
                                SqlitePreferences.Update ("databaseVersion", "0.87", true); 
                                
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "0.87";
                        }
                        if(currentVersion == "0.87") {
@@ -1195,7 +1207,7 @@ class Sqlite
                                SqliteRunIntervalType.Delete("RSA 8-4-R3-5");
 
                                //delete all it's runs
-                               dbcon.Open();
+                               Sqlite.Open();
                                dbcmd.CommandText = "Delete FROM " + Constants.RunIntervalTable +
                                        " WHERE type == 'RSA 8-4-R3-5'";
                                Log.WriteLine(dbcmd.CommandText.ToString());
@@ -1208,24 +1220,24 @@ class Sqlite
                                Log.WriteLine("Deleted fake RSA test and added known RSA tests.");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.88", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.88";
                        }
                        if(currentVersion == "0.88") {
-                               dbcon.Open();
+                               Sqlite.Open();
        
                                SqliteEncoder.addEncoderFreeExercise();
                                
                                Log.WriteLine("Added encoder exercise: Free");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.89", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.89";
                        }
                        if(currentVersion == "0.89") {
-                               dbcon.Open();
+                               Sqlite.Open();
        
                                SqlitePreferences.Insert("encoderPropulsive", "True");
                                SqlitePreferences.Insert("encoderSmoothEccCon", "0.6");
@@ -1233,69 +1245,69 @@ class Sqlite
                                Log.WriteLine("Preferences added propulsive and encoder smooth");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.90", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.90";
                        }
                        if(currentVersion == "0.90") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqliteEncoder.UpdateExercise(true, "Squat", "Squat", 100, "weight bar", "", 
"");        
                                Log.WriteLine("Encoder Squat 75% -> 100%");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.91", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.91";
                        }
                        if(currentVersion == "0.91") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqlitePreferences.Insert("videoDevice", "0");
                                Log.WriteLine("Added videoDevice to preferences");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.92", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.92";
                        }
                        if(currentVersion == "0.92") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqliteEncoder.UpdateExercise(true, "Bench press", "Bench press", 0, "weight 
bar", "","0.185");
                                SqliteEncoder.UpdateExercise(true, "Squat", "Squat", 100, "weight bar", 
"","0.31");
                                Log.WriteLine("Added speed1RM on encoder exercise");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.93", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.93";
                        }
                        if(currentVersion == "0.93") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqliteEncoder.createTable1RM();
                                Log.WriteLine("Added encoder1RM table");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.94", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.94";
                        }
                        if(currentVersion == "0.94") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqlitePreferences.Insert ("encoder1RMMethod", 
                                                Constants.Encoder1RMMethod.WEIGHTED2.ToString());
                                Log.WriteLine("Added encoder1RMMethod");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.95", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.95";
                        }
                        if(currentVersion == "0.95") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                Update(true, Constants.EncoderTable, "future3", "", 
Constants.EncoderConfigurationNames.LINEAR.ToString(), 
                                                "signalOrCurve", "signal");
@@ -1307,23 +1319,23 @@ class Sqlite
                                Log.WriteLine("Encoder signal future3 three modes");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.96", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.96";
                        }
                        if(currentVersion == "0.96") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                SqlitePreferences.Insert ("inertialmomentum", "0.01");
                                Log.WriteLine("Added inertialmomentum in preferences");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.97", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.97";
                        }
                        if(currentVersion == "0.97") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                Update(true, Constants.EncoderTable, "laterality", "both", "RL", "", "");
                                Update(true, Constants.EncoderTable, "laterality", "Both", "RL", "", "");
@@ -1337,12 +1349,12 @@ class Sqlite
                                Log.WriteLine("Fixed encoder laterality");
                                
                                SqlitePreferences.Update ("databaseVersion", "0.98", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.98";
                        }
                        if(currentVersion == "0.98") {
-                               dbcon.Open();
+                               Sqlite.Open();
                
                                ArrayList array = 
SqliteOldConvert.EncoderSelect098(true,-1,-1,-1,"all",false);
                                
@@ -1381,12 +1393,12 @@ class Sqlite
                                conversionRate = count;
                                Log.WriteLine("Encoder table improved");
                                SqlitePreferences.Update ("databaseVersion", "0.99", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "0.99";
                        }
                        if(currentVersion == "0.99") {
-                               dbcon.Open();
+                               Sqlite.Open();
 
                                SqliteEncoder.putEncoderExerciseAnglesAt90();
                                SqliteEncoder.addEncoderJumpExercise();
@@ -1394,23 +1406,23 @@ class Sqlite
 
                                Log.WriteLine("Added Free and inclinatedExercises");
                                SqlitePreferences.Update ("databaseVersion", "1.00", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.00";
                        }
                        if(currentVersion == "1.00") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                SqlitePreferences.Insert ("CSVExportDecimalSeparator", 
Util.GetDecimalSeparatorFromLocale());
 
                                Log.WriteLine("Added export to CSV configuration on preferences");
                                SqlitePreferences.Update ("databaseVersion", "1.01", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.01";
                        }
                        if(currentVersion == "1.01") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                RunType type = new RunType("Agility-T-Test");
                                SqliteRunType.Insert(type, Constants.RunTypeTable, true);
@@ -1419,24 +1431,24 @@ class Sqlite
 
                                Log.WriteLine("Added Agility Tests: Agility-T-Test, Agility-3l3R");
                                SqlitePreferences.Update ("databaseVersion", "1.02", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.02";
                        }
                        if(currentVersion == "1.02") {
-                               dbcon.Open();
+                               Sqlite.Open();
                
                                DeleteFromName(true, Constants.EncoderExerciseTable, "Inclinated plane 
Custom");
                                SqliteEncoder.removeEncoderExerciseAngles();
 
                                Log.WriteLine("Updated encoder exercise, angle is now on encoder 
configuration");
                                SqlitePreferences.Update ("databaseVersion", "1.03", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.03";
                        }
                        if(currentVersion == "1.03") {
-                               dbcon.Open();
+                               Sqlite.Open();
                
                                ArrayList array = 
SqliteOldConvert.EncoderSelect103(true,-1,-1,-1,"all",false);
                                
@@ -1478,12 +1490,12 @@ class Sqlite
                                conversionRate = count;
                                Log.WriteLine("Encoder table improved");
                                SqlitePreferences.Update ("databaseVersion", "1.04", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.04";
                        }
                        if(currentVersion == "1.04") {
-                               dbcon.Open();
+                               Sqlite.Open();
                                
                                dbcmd.CommandText = "DELETE FROM " + Constants.EncoderTable + 
                                        " WHERE encoderConfiguration LIKE \"%INERTIAL%\" AND " +
@@ -1493,12 +1505,12 @@ class Sqlite
 
                                Log.WriteLine("Removed inertial curves, because sign was not checked on 1.04 
when saving curves");
                                SqlitePreferences.Update ("databaseVersion", "1.05", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.05";
                        }
                        if(currentVersion == "1.05") {
-                               dbcon.Open();
+                               Sqlite.Open();
                
                                SqliteEncoder.createTableEncoderSignalCurve();
 
@@ -1563,45 +1575,45 @@ class Sqlite
                                Log.WriteLine("Curves are now linked to signals");
                                SqlitePreferences.Update ("databaseVersion", "1.06", true); 
                                
-                               dbcon.Close();
+                               Sqlite.Close();
                                currentVersion = "1.06";
                        }
                        if(currentVersion == "1.06") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Update(true, Constants.GraphLinkTable, "graphFileName", "jump_dj.png", 
"jump_dj_a.png",
                                                "eventName", "DJa");
                                
                                Log.WriteLine("Added jump_dj_a.png");
                                SqlitePreferences.Update ("databaseVersion", "1.07", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.07";
                        }
                        if(currentVersion == "1.07") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("Added translate statistics graph option to preferences");
                                
                                SqlitePreferences.Insert ("RGraphsTranslate", "True"); 
                                SqlitePreferences.Update ("databaseVersion", "1.08", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.08";
                        }
                        if(currentVersion == "1.08") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("Added option on preferences to useHeightsOnJumpIndexes 
(default) or not");
                                
                                SqlitePreferences.Insert ("useHeightsOnJumpIndexes", "True"); 
                                SqlitePreferences.Update ("databaseVersion", "1.09", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.09";
                        }
                        if(currentVersion == "1.09") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("Added RSA RAST on runType");
 
@@ -1626,62 +1638,62 @@ class Sqlite
                                }
                                
                                SqlitePreferences.Update ("databaseVersion", "1.10", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.10";
                        }
                        if(currentVersion == "1.10") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("Added option on autosave curves on capture 
(all/bestmeanpower/none)");
                                
                                SqlitePreferences.Insert ("encoderAutoSaveCurve", 
Constants.EncoderAutoSaveCurve.BESTMEANPOWER.ToString()); 
                                SqlitePreferences.Update ("databaseVersion", "1.11", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.11";
                        }
                        if(currentVersion == "1.11") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("URLs from absolute to relative)");
                                
                                SqliteOldConvert.ConvertAbsolutePathsToRelative(); 
                                SqlitePreferences.Update ("databaseVersion", "1.12", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.12";
                        }
                        if(currentVersion == "1.12") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("Added ExecuteAuto table");
                                
                                SqliteExecuteAuto.createTableExecuteAuto();
                                SqlitePreferences.Update ("databaseVersion", "1.13", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.13";
                        }
                        if(currentVersion == "1.13") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("slCMJ -> slCMJleft, slCMJright");
 
                                SqliteOldConvert.slCMJDivide();
                                SqlitePreferences.Update ("databaseVersion", "1.14", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.14";
                        }
                        if(currentVersion == "1.14") {
-                               dbcon.Open();
+                               Sqlite.Open();
                        
                                Log.WriteLine("added Chronojump profile and bilateral profile");
 
                                SqliteExecuteAuto.addChronojumpProfileAndBilateral();
                                SqlitePreferences.Update ("databaseVersion", "1.15", true); 
-                               dbcon.Close();
+                               Sqlite.Close();
 
                                currentVersion = "1.15";
                        }
@@ -1706,12 +1718,12 @@ class Sqlite
                string myPort = SqlitePreferences.Select("chronopicPort");
                if(myPort == "0") {
                        //if doesn't exist (for any reason, like old database)
-                       dbcon.Open();
+                       Sqlite.Open();
                        if(UtilAll.IsWindows() || creatingBlankDatabase)
                                SqlitePreferences.Insert ("chronopicPort", 
Constants.ChronopicDefaultPortWindows);
                        else
                                SqlitePreferences.Insert ("chronopicPort", 
Constants.ChronopicDefaultPortLinux);
-                       dbcon.Close();
+                       Sqlite.Close();
                        
                        Log.WriteLine("Added Chronopic port");
                }
@@ -1719,7 +1731,7 @@ class Sqlite
        
        public static void CreateTables(bool server)
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                creationTotal = 14;
                creationRate = 1;
@@ -1906,14 +1918,14 @@ class Sqlite
                //0.4 - 0.41: jump, jumpRj weight is double (always a percent)
                
 
-               dbcon.Close();
+               Sqlite.Close();
                creationRate ++;
        }
 
        public static bool Exists(bool dbconOpened, string tableName, string findName)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT uniqueID FROM " + tableName + 
                        " WHERE LOWER(name) == LOWER('" + findName + "')" ;
@@ -1932,7 +1944,7 @@ class Sqlite
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return exists;
        }
@@ -2008,7 +2020,7 @@ class Sqlite
        {
                //tableName can be tempJumpRj or tempRunInterval
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT MAX(uniqueID) FROM " + tableName;
                Log.WriteLine(dbcmd.CommandText.ToString());
                
@@ -2026,7 +2038,7 @@ class Sqlite
                }
                Log.WriteLine(string.Format("exists = {0}", exists.ToString()));
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                return exists;
        }
@@ -2035,12 +2047,12 @@ class Sqlite
        {
                //tableName can be tempJumpRj or tempRunInterval
 
-               dbcon.Open();
+               Sqlite.Open();
                //dbcmd.CommandText = "Delete FROM tempJumpRj";
                dbcmd.CommandText = "Delete FROM " + tableName;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        protected static void dropTable(string tableName) {
@@ -2281,7 +2293,7 @@ class Sqlite
                }
 
                //no opened before because Exists is for closed dbcon
-               dbcon.Open();
+               Sqlite.Open();
 
                //create new jump types
                SqliteJumpType.JumpTypeInsert ("DJa:0:0:DJ jump using arms", true); 
@@ -2598,7 +2610,7 @@ Console.WriteLine("5" + tableName);
        public static int Max (string tableName, string column, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT MAX(" + column + ") FROM " + tableName ;
                Log.WriteLine(dbcmd.CommandText.ToString());
@@ -2612,14 +2624,14 @@ Console.WriteLine("5" + tableName);
                reader.Close();
 
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myReturn;
        }
 
        public static int Count (string tableName, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT COUNT(*) FROM " + tableName ;
                Log.WriteLine(dbcmd.CommandText.ToString());
@@ -2633,13 +2645,13 @@ Console.WriteLine("5" + tableName);
                reader.Close();
 
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myReturn;
        }
 
        public static int CountCondition (string tableName, bool dbconOpened, string condition, string 
operand, string myValue) {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT COUNT(*) FROM " + tableName +
                        " WHERE " + condition + " " + operand + " " + myValue;
@@ -2654,7 +2666,7 @@ Console.WriteLine("5" + tableName);
                reader.Close();
 
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myReturn;
        }
 
@@ -2662,7 +2674,7 @@ Console.WriteLine("5" + tableName);
                        string columnNameCondition2, string searchValueCondition2)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                
                string andStr = "";
                if(columnNameCondition2 != "" && searchValueCondition2 != "")
@@ -2677,13 +2689,13 @@ Console.WriteLine("5" + tableName);
                dbcmd.ExecuteNonQuery();
                
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        public static void Delete(bool dbconOpened, string tableName, int uniqueID)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "Delete FROM " + tableName +
                        " WHERE uniqueID == " + uniqueID.ToString();
@@ -2691,13 +2703,13 @@ Console.WriteLine("5" + tableName);
                dbcmd.ExecuteNonQuery();
                
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
        
        public static void DeleteSelectingField(bool dbconOpened, string tableName, string fieldName, string 
id)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "Delete FROM " + tableName +
                        " WHERE " + fieldName + " == " + id;
@@ -2705,14 +2717,14 @@ Console.WriteLine("5" + tableName);
                dbcmd.ExecuteNonQuery();
                
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
 
        public static void DeleteFromName(bool dbconOpened, string tableName, string name)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "Delete FROM " + tableName +
                        " WHERE name == '" + name + "'";
@@ -2720,13 +2732,13 @@ Console.WriteLine("5" + tableName);
                dbcmd.ExecuteNonQuery();
                
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        public static void DeleteFromAnInt(bool dbconOpened, string tableName, string colName, int id)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "Delete FROM " + tableName +
                        " WHERE " + colName + " == " + id;
@@ -2734,7 +2746,7 @@ Console.WriteLine("5" + tableName);
                dbcmd.ExecuteNonQuery();
                
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
 
@@ -2763,7 +2775,7 @@ Console.WriteLine("5" + tableName);
        
        public static bool DisConnect() {
                try {
-                       dbcon.Close();
+                       Sqlite.Close();
                } catch {
                        return false;
                }
diff --git a/src/sqlite/multiChronopic.cs b/src/sqlite/multiChronopic.cs
index 0c1cc16..874f648 100644
--- a/src/sqlite/multiChronopic.cs
+++ b/src/sqlite/multiChronopic.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -77,7 +77,7 @@ class SqliteMultiChronopic : Sqlite
                        string description, int simulated)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -107,7 +107,7 @@ class SqliteMultiChronopic : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -121,7 +121,7 @@ class SqliteMultiChronopic : Sqlite
                if(personID != -1)
                        filterPersonString = " AND " + tp + ".uniqueID == " + personID;
 
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, multiChronopic.* " +
                        " FROM " + tp + ", multiChronopic " +
                        " WHERE " + tp + ".uniqueID == multiChronopic.personID" + 
@@ -168,7 +168,7 @@ class SqliteMultiChronopic : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] myEvents = new string[count];
                count =0;
@@ -182,7 +182,7 @@ class SqliteMultiChronopic : Sqlite
        public static MultiChronopic SelectMultiChronopicData(int uniqueID, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + Constants.MultiChronopicTable + " WHERE uniqueID == " 
+ uniqueID;
                
@@ -198,13 +198,13 @@ class SqliteMultiChronopic : Sqlite
        
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return mc;
        }
 
        public static int MaxCPs(int sessionID)
        {
-               dbcon.Open();
+               Sqlite.Open();
                int maxCPs = 2;
 
                dbcmd.CommandText = "SELECT uniqueID FROM " + Constants.MultiChronopicTable + 
@@ -228,20 +228,20 @@ class SqliteMultiChronopic : Sqlite
                }
                
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return maxCPs;
        }
 
        public static void Update(int eventID, int personID, string vars, string description)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.MultiChronopicTable + " SET personID = " + personID 
+ 
                        ", vars = '" + vars +           //vars is distance on runAnalysis
                        "', description = '" + description +
                        "' WHERE uniqueID == " + eventID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 }
diff --git a/src/sqlite/oldConvert.cs b/src/sqlite/oldConvert.cs
index a51eb07..bdaeeae 100644
--- a/src/sqlite/oldConvert.cs
+++ b/src/sqlite/oldConvert.cs
@@ -15,7 +15,7 @@
  *  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> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -95,7 +95,7 @@ class SqliteOldConvert : Sqlite
                        int uniqueID, int personID, int sessionID, string signalOrCurve, bool onlyActive)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string personIDStr = "";
                if(personID != -1)
@@ -170,7 +170,7 @@ class SqliteOldConvert : Sqlite
                }
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
@@ -242,7 +242,7 @@ class SqliteOldConvert : Sqlite
                        int uniqueID, int personID, int sessionID, string signalOrCurve, bool onlyActive)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string personIDStr = "";
                if(personID != -1)
@@ -312,7 +312,7 @@ class SqliteOldConvert : Sqlite
                }
                reader.Close();
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return array;
        }
diff --git a/src/sqlite/person.cs b/src/sqlite/person.cs
index a80105c..f3ef70f 100644
--- a/src/sqlite/person.cs
+++ b/src/sqlite/person.cs
@@ -15,7 +15,7 @@
  *  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-2010   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -55,8 +55,9 @@ class SqlitePerson : Sqlite
        public static int Insert(bool dbconOpened, string uniqueID, string name, string sex, DateTime 
dateBorn, 
                        int race, int countryID, string description, int serverUniqueID)
        {
+               Log.WriteLine("going to insert");
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -77,7 +78,7 @@ class SqlitePerson : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -85,7 +86,7 @@ class SqlitePerson : Sqlite
        //This is like SqlitePersonSession.Selectbut this returns a Person
        public static Person Select(int uniqueID)
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + Constants.PersonTable + " WHERE uniqueID == " + 
uniqueID;
                
@@ -109,7 +110,7 @@ class SqlitePerson : Sqlite
                                        );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return p;
        }
                
@@ -117,7 +118,7 @@ class SqlitePerson : Sqlite
        //select strings
        public static string SelectAttribute(int uniqueID, string attribute)
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                dbcmd.CommandText = "SELECT " + attribute + " FROM " + Constants.PersonTable + " WHERE 
uniqueID == " + uniqueID;
                
@@ -132,14 +133,14 @@ class SqlitePerson : Sqlite
                        myReturn = reader[0].ToString();
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myReturn;
        }
                
        //currently only used on server
        public static ArrayList SelectAllPersons() 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT uniqueID, name FROM " + Constants.PersonTable; 
                
                SqliteDataReader reader;
@@ -151,7 +152,7 @@ class SqlitePerson : Sqlite
                        myArray.Add ("(" + reader[0].ToString() + ") " + reader[1].ToString());
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                return myArray;
        }
@@ -172,7 +173,7 @@ class SqlitePerson : Sqlite
                string tp = Constants.PersonTable;
                string tps = Constants.PersonSessionTable;
 
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".uniqueID " +
                        " FROM " + tp + "," + tps +
                        " WHERE " + tps + ".sessionID == " + except + 
@@ -187,7 +188,7 @@ class SqlitePerson : Sqlite
                        arrayExcept.Add (reader[0].ToString());
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                
                //2
                //sort no case sensitive when we sort by name
@@ -197,7 +198,7 @@ class SqlitePerson : Sqlite
                        sortedBy = tp + ".uniqueID" ; 
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                if(inSession == -1) {
                        string nameLike = "";
                        if(searchFilterName != "")
@@ -252,7 +253,7 @@ finishForeach:
                }
 
                reader2.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                return arrayReturn;
        }
@@ -273,7 +274,7 @@ finishForeach:
                
                string tps = Constants.PersonSessionTable;
        
-               dbcon.Open();
+               Sqlite.Open();
                
                //session where this person is loaded
                dbcmd.CommandText = "SELECT sessionID, session.Name, session.Place, session.Date " + 
@@ -397,7 +398,7 @@ finishForeach:
        
 
 
-               dbcon.Close();
+               Sqlite.Close();
                
        
                ArrayList arrayAll = new ArrayList(2);
@@ -526,7 +527,7 @@ finishForeach:
        
        public static bool ExistsAndItsNotMe(int uniqueID, string personName)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT uniqueID FROM " + Constants.PersonTable +
                        " WHERE LOWER(" + Constants.PersonTable + ".name) == LOWER('" + personName + "')" +
                        " AND uniqueID != " + uniqueID ;
@@ -545,14 +546,14 @@ finishForeach:
                //Log.WriteLine("exists = {0}", exists.ToString());
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return exists;
        }
        
        
        public static void Update(Person myPerson)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.PersonTable + 
                        " SET name = '" + myPerson.Name + 
                        "', sex = '" + myPerson.Sex +
@@ -564,7 +565,7 @@ finishForeach:
                        " WHERE uniqueID == " + myPerson.UniqueID;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 }
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index ccc8ff0..1ac76ed 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -15,7 +15,7 @@
  *  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-2011   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -56,7 +56,7 @@ class SqlitePersonSession : Sqlite
                        string comments) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -79,7 +79,7 @@ class SqlitePersonSession : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myLast;
        }
        
@@ -88,7 +88,7 @@ class SqlitePersonSession : Sqlite
        public static double SelectAttribute(bool dbconOpened, int personID, int sessionID, string attribute)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT " + attribute + " FROM " + Constants.PersonSessionTable +
                        " WHERE personID == " + personID + 
@@ -106,7 +106,7 @@ class SqlitePersonSession : Sqlite
                }
                reader.Close();
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myReturn;
        }
@@ -115,7 +115,7 @@ class SqlitePersonSession : Sqlite
        //select doubles
        public static double SelectAttribute(int personID, string attribute)
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                dbcmd.CommandText = "SELECT " + attribute + ", sessionID FROM " + 
Constants.PersonSessionTable + 
                        " WHERE personID == " + personID + 
@@ -132,13 +132,13 @@ class SqlitePersonSession : Sqlite
                        myReturn = Convert.ToDouble(Util.ChangeDecimalSeparator(reader[0].ToString()));
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myReturn;
        }
        
        public static void Update(PersonSession ps)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.PersonSessionTable + 
                        " SET personID = " + ps.PersonID + 
                        ", sessionID = " + ps.SessionID + 
@@ -151,13 +151,13 @@ class SqlitePersonSession : Sqlite
                        "' WHERE uniqueID == " + ps.UniqueID;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        //double
        public static void UpdateAttribute(int personID, int sessionID, string attribute, double attrValue)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.PersonSessionTable + 
                        " SET " + attribute + " = " + Util.ConvertToPoint(attrValue) + 
                        " WHERE personID = " + personID +
@@ -165,12 +165,12 @@ class SqlitePersonSession : Sqlite
                        ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        public static bool PersonSelectExistsInSession(int myPersonID, int mySessionID)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * FROM " + Constants.PersonSessionTable +
                        " WHERE personID == " + myPersonID + 
                        " AND sessionID == " + mySessionID ; 
@@ -186,7 +186,7 @@ class SqlitePersonSession : Sqlite
                        exists = true;
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return exists;
        }
 
@@ -204,7 +204,7 @@ class SqlitePersonSession : Sqlite
                if(sessionID == -1)
                        sessionIDString = " ORDER BY sessionID DESC limit 1";
 
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * FROM " + tps +
                        " WHERE personID == " + personID + 
                        sessionIDString;
@@ -230,7 +230,7 @@ class SqlitePersonSession : Sqlite
                }
                
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return ps;
        }
        
@@ -242,7 +242,7 @@ class SqlitePersonSession : Sqlite
                string tp = Constants.PersonTable;
                string tps = Constants.PersonSessionTable;
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".*" +
                        " FROM " + tp + ", " + tps + 
                        " WHERE " + tps + ".sessionID == " + sessionID + 
@@ -268,7 +268,7 @@ class SqlitePersonSession : Sqlite
                        myArray.Add (person);
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
        
@@ -281,7 +281,7 @@ class SqlitePersonSession : Sqlite
                string tp = Constants.PersonTable;
                string tps = Constants.PersonSessionTable;
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".*, " + tps + ".weight, sport.name, speciallity.name " +
                        "FROM " + tp + ", " + tps + ", sport, speciallity " +
                        " WHERE " + tps + ".sessionID == " + sessionID + 
@@ -324,7 +324,7 @@ class SqlitePersonSession : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] myJumpers = new string[count];
                
@@ -348,7 +348,7 @@ class SqlitePersonSession : Sqlite
        
        public static void DeletePersonFromSessionAndTests(string sessionID, string personID)
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                //1.- first delete in personSession77 at this session
 
@@ -454,13 +454,13 @@ class SqlitePersonSession : Sqlite
                //4.- TODO: delete videos
 
 
-               dbcon.Close();
+               Sqlite.Close();
        }
 
        public static bool PersonExistsInPS(bool dbconOpened, int personID)
        {
                if( ! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + Constants.PersonSessionTable + 
                        " WHERE personID == " + personID;
@@ -480,7 +480,7 @@ class SqlitePersonSession : Sqlite
                reader.Close();
                
                if( ! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return exists;
        }
diff --git a/src/sqlite/personSessionNotUpload.cs b/src/sqlite/personSessionNotUpload.cs
index 331ed03..762bc08 100644
--- a/src/sqlite/personSessionNotUpload.cs
+++ b/src/sqlite/personSessionNotUpload.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -46,7 +46,7 @@ class SqlitePersonSessionNotUpload : Sqlite
 
        public static ArrayList SelectAll(int sessionID)
         {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT personID FROM " + Constants.PersonNotUploadTable +
                        " WHERE sessionID == " + sessionID;
                Log.WriteLine(dbcmd.CommandText.ToString());
@@ -60,30 +60,30 @@ class SqlitePersonSessionNotUpload : Sqlite
                        myArray.Add (reader[0].ToString());
                
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
         }
 
        public static void Add(int personID, int sessionID)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "INSERT INTO " + Constants.PersonNotUploadTable +  
                        " (personID, sessionID)" +
                        " VALUES (" + personID + ", " + sessionID +")";
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
-               dbcon.Close();
+               Sqlite.Close();
         }
 
        public static void Delete(int personID, int sessionID)
         {
-                dbcon.Open();
+                Sqlite.Open();
                 dbcmd.CommandText = "Delete FROM " + Constants.PersonNotUploadTable +
                         " WHERE personID == " + personID + " AND sessionID == " + sessionID;
                 Log.WriteLine(dbcmd.CommandText.ToString());
                 dbcmd.ExecuteNonQuery();
-                dbcon.Close();
+                Sqlite.Close();
         }
 
 }
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 0cced83..ce10aec 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -85,18 +85,18 @@ class SqlitePreferences : Sqlite
 
        public static void Insert(string myName, string myValue)
        {
-               //dbcon.Open();
+               //Sqlite.Open();
                dbcmd.CommandText = "INSERT INTO " + Constants.PreferencesTable + 
                        " (name, value) VALUES ('" + 
                        myName + "', '" + myValue + "')" ;
                dbcmd.ExecuteNonQuery();
-               //dbcon.Close();
+               //Sqlite.Close();
        }
 
        public static void Update(string myName, string myValue, bool dbconOpened)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "UPDATE " + Constants.PreferencesTable +
                        " SET value = '" + myValue + 
@@ -105,12 +105,12 @@ class SqlitePreferences : Sqlite
                dbcmd.ExecuteNonQuery();
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        public static string Select (string myName) 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT value FROM " + Constants.PreferencesTable + 
                        " WHERE name == '" + myName + "'" ;
                Log.WriteLine(dbcmd.CommandText.ToString());
@@ -126,14 +126,14 @@ class SqlitePreferences : Sqlite
                        myReturn = reader[0].ToString();
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                return myReturn;
        }
        
        public static Preferences SelectAll () 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * FROM " + Constants.PreferencesTable; 
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -211,7 +211,7 @@ class SqlitePreferences : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                return preferences;
        }
diff --git a/src/sqlite/pulse.cs b/src/sqlite/pulse.cs
index 8f45795..ee2838f 100644
--- a/src/sqlite/pulse.cs
+++ b/src/sqlite/pulse.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -60,7 +60,7 @@ class SqlitePulse : Sqlite
        public static int Insert(bool dbconOpened, string tableName, string uniqueID, int personID, int 
sessionID, string type, double fixedPulse, int totalPulsesNum, string timeString, string description, int 
simulated)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
        
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -80,7 +80,7 @@ class SqlitePulse : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -95,7 +95,7 @@ class SqlitePulse : Sqlite
                if(personID != -1)
                        filterPersonString = " AND " + tp + ".uniqueID == " + personID;
 
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, pulse.* " +
                        " FROM " + tp + ", pulse " +
                        " WHERE " + tp + ".uniqueID == pulse.personID" + 
@@ -130,7 +130,7 @@ class SqlitePulse : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] myPulses = new string[count];
                count =0;
@@ -144,7 +144,7 @@ class SqlitePulse : Sqlite
        public static Pulse SelectPulseData(int uniqueID, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + Constants.PulseTable + " WHERE uniqueID == " + 
uniqueID;
                
@@ -159,20 +159,20 @@ class SqlitePulse : Sqlite
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myPulse;
        }
 
        public static void Update(int pulseID, int personID, string description)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.PulseTable + 
                        " SET personID = " + personID + 
                        ", description = '" + description +
                        "' WHERE uniqueID == " + pulseID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 }
diff --git a/src/sqlite/pulseType.cs b/src/sqlite/pulseType.cs
index 99bd1b1..b0d7549 100644
--- a/src/sqlite/pulseType.cs
+++ b/src/sqlite/pulseType.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -66,7 +66,7 @@ class SqlitePulseType : Sqlite
        {
                string [] myStr = myPulse.Split(new char[] {':'});
                if(! dbconOpened) {
-                       dbcon.Open();
+                       Sqlite.Open();
                }
                dbcmd.CommandText = "INSERT INTO " + Constants.PulseTypeTable +  
                                " (uniqueID, name, fixedPulse, totalPulsesNum, description)" +
@@ -76,7 +76,7 @@ class SqlitePulseType : Sqlite
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                if(! dbconOpened) {
-                       dbcon.Close();
+                       Sqlite.Close();
                }
        }
        
@@ -85,7 +85,7 @@ class SqlitePulseType : Sqlite
                //allPulsesName: add and "allPulsesName" value
                //onlyName: return only type name
        
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.PulseTypeTable + 
                        " ORDER BY uniqueID";
@@ -115,7 +115,7 @@ class SqlitePulseType : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                int numRows;
                if(allPulsesName != "") {
@@ -139,7 +139,7 @@ class SqlitePulseType : Sqlite
 
        public static PulseType SelectAndReturnPulseType(string typeName) 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.PulseTypeTable +
                        " WHERE name  = '" + typeName +
@@ -160,7 +160,7 @@ class SqlitePulseType : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                return myPulseType;
        }
diff --git a/src/sqlite/reactionTime.cs b/src/sqlite/reactionTime.cs
index e79d429..aca96df 100644
--- a/src/sqlite/reactionTime.cs
+++ b/src/sqlite/reactionTime.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -58,7 +58,7 @@ class SqliteReactionTime : Sqlite
        public static int Insert(bool dbconOpened, string tableName, string uniqueID, int personID, int 
sessionID, string type, double time, string description, int simulated)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -78,7 +78,7 @@ class SqliteReactionTime : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -87,7 +87,7 @@ class SqliteReactionTime : Sqlite
        public static string[] SelectReactionTimes(bool dbconOpened, int sessionID, int personID) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string tp = Constants.PersonTable;
 
@@ -129,7 +129,7 @@ class SqliteReactionTime : Sqlite
                reader.Close();
                
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                string [] myEvents = new string[count];
                count =0;
@@ -143,7 +143,7 @@ class SqliteReactionTime : Sqlite
        public static ReactionTime SelectReactionTimeData(int uniqueID, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + Constants.ReactionTimeTable + " WHERE uniqueID == " + 
uniqueID;
                
@@ -159,13 +159,13 @@ class SqliteReactionTime : Sqlite
        
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myRT;
        }
                
        public static void Update(int eventID, string type, string time, int personID, string description)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.ReactionTimeTable + " SET personID = " + personID + 
                        ", type = '" + type +
                        "', time = " + Util.ConvertToPoint(time) +
@@ -173,7 +173,7 @@ class SqliteReactionTime : Sqlite
                        "' WHERE uniqueID == " + eventID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 }
diff --git a/src/sqlite/run.cs b/src/sqlite/run.cs
index 24d33e8..df13f88 100644
--- a/src/sqlite/run.cs
+++ b/src/sqlite/run.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -60,7 +60,7 @@ class SqliteRun : Sqlite
        public static int Insert(bool dbconOpened, string tableName, string uniqueID, int personID, int 
sessionID, string type, double distance, double time, string description, int simulated, bool initialSpeed)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -81,7 +81,7 @@ class SqliteRun : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -92,7 +92,7 @@ class SqliteRun : Sqlite
        public static string[] SelectRuns(bool dbconOpened, int sessionID, int personID, string filterType) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string tp = Constants.PersonTable;
 
@@ -145,7 +145,7 @@ class SqliteRun : Sqlite
                reader.Close();
                
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                string [] myRuns = new string[count];
                count =0;
@@ -159,7 +159,7 @@ class SqliteRun : Sqlite
        public static Run SelectRunData(int uniqueID, bool dbconOpened)
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + Constants.RunTable + " WHERE uniqueID == " + uniqueID;
                
@@ -175,13 +175,13 @@ class SqliteRun : Sqlite
        
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myRun;
        }
                
        public static void Update(int runID, string type, string distance, string time, int personID, string 
description)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.RunTable + 
                        " SET personID = " + personID + 
                        ", type = '" + type +
@@ -191,7 +191,7 @@ class SqliteRun : Sqlite
                        "' WHERE uniqueID == " + runID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 }
diff --git a/src/sqlite/runInterval.cs b/src/sqlite/runInterval.cs
index 096bf7c..6d0298c 100644
--- a/src/sqlite/runInterval.cs
+++ b/src/sqlite/runInterval.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -57,7 +57,7 @@ class SqliteRunInterval : SqliteRun
        public static int Insert(bool dbconOpened, string tableName, string uniqueID, int personID, int 
sessionID, string type, double distanceTotal, double timeTotal, double distanceInterval, string 
intervalTimesString, double tracks, string description, string limited, int simulated, bool initialSpeed )
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -84,7 +84,7 @@ class SqliteRunInterval : SqliteRun
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -105,7 +105,7 @@ class SqliteRunInterval : SqliteRun
                if(filterType != "")
                        filterTypeString = " AND runInterval.type == '" + filterType + "' " ;
 
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, runInterval.* " +
                        " FROM " + tp + ", runInterval " +
                        " WHERE " + tp + ".uniqueID == runInterval.personID" + 
@@ -145,7 +145,7 @@ class SqliteRunInterval : SqliteRun
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] myRuns = new string[count];
                count =0;
@@ -161,7 +161,7 @@ class SqliteRunInterval : SqliteRun
                //tableName can be runInterval or tempRunInterval
 
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "SELECT * FROM " + tableName + " WHERE uniqueID == " + uniqueID;
                
@@ -176,20 +176,20 @@ class SqliteRunInterval : SqliteRun
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
                return myRun;
        }
 
        public static void Update(int runID, int personID, string description)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.RunIntervalTable +
                        " SET personID = " + personID + 
                        ", description = '" + description +
                        "' WHERE uniqueID == " + runID ;
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 
diff --git a/src/sqlite/runType.cs b/src/sqlite/runType.cs
index fbc7a18..1ad5d29 100644
--- a/src/sqlite/runType.cs
+++ b/src/sqlite/runType.cs
@@ -102,7 +102,7 @@ class SqliteRunType : Sqlite
        {
                //string [] myStr = myRun.Split(new char[] {':'});
                if(! dbconOpened) {
-                       dbcon.Open();
+                       Sqlite.Open();
                }
                dbcmd.CommandText = "INSERT INTO " + tableName + 
                                " (uniqueID, name, distance, description)" +
@@ -122,7 +122,7 @@ class SqliteRunType : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened) {
-                       dbcon.Close();
+                       Sqlite.Close();
                }
                return myLast;
        }
@@ -130,7 +130,7 @@ class SqliteRunType : Sqlite
        public static RunType SelectAndReturnRunType(string typeName, bool dbconOpened) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.RunTypeTable +
                        " WHERE name  = '" + typeName +
@@ -154,7 +154,7 @@ class SqliteRunType : Sqlite
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myRunType;
        }
@@ -166,7 +166,7 @@ class SqliteRunType : Sqlite
        
                string whereString = "";
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.RunTypeTable +
                        whereString +
@@ -196,7 +196,7 @@ class SqliteRunType : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                int numRows;
                if(allRunsName != "") {
@@ -220,7 +220,7 @@ class SqliteRunType : Sqlite
 
        public static double Distance (string typeName) 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT distance " +
                        " FROM " + Constants.RunTypeTable +
                        " WHERE name == '" + typeName + "'";
@@ -236,7 +236,7 @@ class SqliteRunType : Sqlite
                        distance = Convert.ToDouble(reader[0].ToString());
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return distance;
        }
        
@@ -262,12 +262,12 @@ class SqliteRunType : Sqlite
 
        public static void Delete(string name)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "Delete FROM " + Constants.RunTypeTable +
                        " WHERE name == '" + name + "'";
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 
@@ -377,12 +377,12 @@ class SqliteRunIntervalType : SqliteRunType
        //public static void RunIntervalTypeInsert(string myRun, bool dbconOpened)
        public static new int Insert(RunType t, string tableName, bool dbconOpened)
        {
-               //done here for not having twho dbconsOpened
+               //done here for not having twho Sqlite.Opened
                //double distance = t.Distance;
 
                //string [] myStr = myRun.Split(new char[] {':'});
                if(! dbconOpened) {
-                       dbcon.Open();
+                       Sqlite.Open();
                }
                dbcmd.CommandText = "INSERT INTO " + tableName + 
                                " (uniqueID, name, distance, tracksLimited, fixedValue, unlimited, 
description, distancesString)" +
@@ -406,14 +406,14 @@ class SqliteRunIntervalType : SqliteRunType
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened) {
-                       dbcon.Close();
+                       Sqlite.Close();
                }
                return myLast;
        }
 
        public static string[] SelectRunIntervalTypes(string allRunsName, bool onlyName) 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.RunIntervalTypeTable +
                        " ORDER BY uniqueID";
@@ -446,7 +446,7 @@ class SqliteRunIntervalType : SqliteRunType
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                int numRows;
                if(allRunsName != "") {
@@ -469,7 +469,7 @@ class SqliteRunIntervalType : SqliteRunType
        public static RunType SelectAndReturnRunIntervalType(string typeName, bool dbconOpened) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.RunIntervalTypeTable +
                        " WHERE name  = '" + typeName +
@@ -502,7 +502,7 @@ class SqliteRunIntervalType : SqliteRunType
 
                reader.Close();
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myRunType;
        }
@@ -520,12 +520,12 @@ class SqliteRunIntervalType : SqliteRunType
        
        public static void Delete(string name)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "Delete FROM " + Constants.RunIntervalTypeTable +
                        " WHERE name == '" + name + "'";
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 
diff --git a/src/sqlite/server.cs b/src/sqlite/server.cs
index a798975..944ee30 100644
--- a/src/sqlite/server.cs
+++ b/src/sqlite/server.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -67,7 +67,7 @@ class SqliteServer : Sqlite
        public static int InsertPing(bool dbconOpened, int evaluatorID, string cjVersion, string osVersion, 
string ip, DateTime date)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string uniqueID = "NULL";
 
@@ -90,7 +90,7 @@ class SqliteServer : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -99,7 +99,7 @@ class SqliteServer : Sqlite
                        int countryID, string chronometer, string device, string comments, bool confiable)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string uniqueID = "NULL";
 
@@ -128,7 +128,7 @@ class SqliteServer : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -137,7 +137,7 @@ class SqliteServer : Sqlite
                        int countryID, string chronometer, string device, string comments, bool confiable)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.ServerEvaluatorTable + " " +
                        " SET code = '" + code +
                        "' , name = '" + name +
@@ -153,7 +153,7 @@ class SqliteServer : Sqlite
                dbcmd.ExecuteNonQuery();
 
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
        
        
@@ -161,7 +161,7 @@ class SqliteServer : Sqlite
        //if confiable is read on client, it will be also checked on server
        public static ServerEvaluator SelectEvaluator(int myUniqueID)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT * FROM " + Constants.ServerEvaluatorTable + " WHERE uniqueID == " 
+ myUniqueID ; 
                Log.WriteLine(dbcmd.CommandText.ToString());
                
@@ -187,13 +187,13 @@ class SqliteServer : Sqlite
                }
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myEval;
        }
        
        public static string [] SelectEvaluators(bool addAnyString)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + 
                        Constants.ServerEvaluatorTable + ".uniqueID, " + 
                        Constants.ServerEvaluatorTable + ".name " +
@@ -212,12 +212,12 @@ class SqliteServer : Sqlite
                        evals.Add(reader[0].ToString() + ":" + reader[1].ToString());
 
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return Util.ArrayListToString(evals);
        }
        
        public static string Query(string str) {
-               dbcon.Open();
+               Sqlite.Open();
 
                dbcmd.CommandText = str; 
                Log.WriteLine(dbcmd.CommandText.ToString());
@@ -231,14 +231,14 @@ class SqliteServer : Sqlite
                }
                
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myReturn;
        }
 
        public static string [] Stats() {
                ArrayList stats = new ArrayList();
                        
-               dbcon.Open();
+               Sqlite.Open();
 
                /*
                 * is good to add the string stuff like "Pings" 
@@ -258,7 +258,7 @@ class SqliteServer : Sqlite
                stats.Add("Pulses:" + Sqlite.Count(Constants.PulseTable, true).ToString());
                stats.Add("MultiChronopic:" + Sqlite.Count(Constants.MultiChronopicTable, true).ToString());
                
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] statsString = Util.ArrayListToString(stats);
                return statsString;
@@ -270,7 +270,7 @@ class SqliteServer : Sqlite
        public static string [] StatsMine() {
                ArrayList stats = new ArrayList();
                        
-               dbcon.Open();
+               Sqlite.Open();
 
                /*
                 * is good to add the string stuff like "Pings" 
@@ -288,7 +288,7 @@ class SqliteServer : Sqlite
                stats.Add("Pulses:" + Sqlite.CountCondition(Constants.PulseTable, true, "simulated", ">", 
"0").ToString());
                stats.Add("MultiChronopic:" + Sqlite.CountCondition(Constants.MultiChronopicTable, true, 
"simulated", ">", "0").ToString());
                
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] statsString = Util.ArrayListToString(stats);
                return statsString;
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index 89445f8..668bd6d 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -56,7 +56,7 @@ class SqliteSession : Sqlite
        public static int Insert(bool dbconOpened, string tableName, string uniqueID, string name, string 
place, DateTime date, int personsSportID, int personsSpeciallityID, int personsPractice, string comments, int 
serverUniqueID)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -77,7 +77,7 @@ class SqliteSession : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -85,7 +85,7 @@ class SqliteSession : Sqlite
        public static void Update(int uniqueID, string name, string place, DateTime date, int personsSportID, 
int personsSpeciallityID, int personsPractice, string comments) 
        {
                //TODO: serverUniqueID (but cannot be changed in gui/edit, then not need now)
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.SessionTable + " " +
                        " SET name = '" + name +
                        "' , date = '" + UtilDate.ToSql(date) +
@@ -96,14 +96,14 @@ class SqliteSession : Sqlite
                        ", comments = '" + comments +
                        "' WHERE uniqueID == " + uniqueID;
                dbcmd.ExecuteNonQuery();
-               dbcon.Close();
+               Sqlite.Close();
        }
        
        //updating local session when it gets uploaded
        public static void UpdateServerUniqueID(int uniqueID, int serverID)
        {
                //if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "UPDATE " +Constants.SessionTable + " SET serverUniqueID = " + serverID + 
                        " WHERE uniqueID == " + uniqueID ;
@@ -111,19 +111,19 @@ class SqliteSession : Sqlite
                dbcmd.ExecuteNonQuery();
 
                //if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        
        public static Session Select(string myUniqueID)
        {
                try {
-                       dbcon.Open();
+                       Sqlite.Open();
                } catch {
                        //done because there's an eventual problem maybe thread related on very few starts of 
chronojump
                        Log.WriteLine("Catched dbcon problem at Session.Select");
-                       dbcon.Close();
-                       dbcon.Open();
+                       Sqlite.Close();
+                       Sqlite.Open();
                        Log.WriteLine("reopened again");
                }
                dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE uniqueID == " + 
myUniqueID ; 
@@ -152,7 +152,7 @@ class SqliteSession : Sqlite
                        values[7], Convert.ToInt32(values[8]) );
                
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return mySession;
        }
        
@@ -165,7 +165,7 @@ class SqliteSession : Sqlite
                        selectString = " uniqueID, name, place, date ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                //dbcmd.CommandText = "SELECT * FROM session ORDER BY uniqueID";
                dbcmd.CommandText = "SELECT " + selectString + " FROM " + Constants.SessionTable + " " + 
                        " WHERE uniqueID != " + sessionIdDisable + " ORDER BY uniqueID";
@@ -195,7 +195,7 @@ class SqliteSession : Sqlite
                reader.Close();
        
                //close database connection
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] mySessions = new string[count];
                count =0;
@@ -209,7 +209,7 @@ class SqliteSession : Sqlite
 
        public static string[] SelectAllSessions() 
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = 
                        "SELECT session.*, sport.name, speciallity.name" +
                        " FROM session, sport, speciallity " +
@@ -404,7 +404,7 @@ class SqliteSession : Sqlite
        
                
                //close database connection
-               dbcon.Close();
+               Sqlite.Close();
 
                //mix seven arrayLists
                string [] mySessions = new string[count];
@@ -540,7 +540,7 @@ class SqliteSession : Sqlite
        public static double SelectAVGEventsOfAType(bool dbconOpened, int sessionID, int personID, string 
table, string type, string valueToSelect) 
        {
                if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                //if personIDString == -1, the applies for all persons
                
@@ -570,7 +570,7 @@ class SqliteSession : Sqlite
                reader.Close();
                
                if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                if (found) {
                        return myReturn;
@@ -582,7 +582,7 @@ class SqliteSession : Sqlite
        
        public static void DeleteAllStuff(string uniqueID)
        {
-               dbcon.Open();
+               Sqlite.Open();
 
                //delete the session
                dbcmd.CommandText = "Delete FROM " + Constants.SessionTable + " WHERE uniqueID == " + 
uniqueID;
@@ -657,7 +657,7 @@ class SqliteSession : Sqlite
                }
                                
                
-               dbcon.Close();
+               Sqlite.Close();
        }
 
 }
@@ -695,7 +695,7 @@ class SqliteServerSession : SqliteSession
        public static int Insert(bool dbconOpened, string tableName, string name, string place, DateTime 
date, int personsSportID, int personsSpeciallityID, int personsPractice, string comments, int serverUniqueID, 
int evaluatorID, string evaluatorCJVersion, string evaluatorOS, DateTime uploadedDate, int uploadingState)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                //(uniqueID == "-1")
                //      uniqueID = "NULL";
@@ -720,7 +720,7 @@ class SqliteServerSession : SqliteSession
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -729,7 +729,7 @@ class SqliteServerSession : SqliteSession
        public static void UpdateUploadingState(int uniqueID, int state)
        {
                //if(!dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                dbcmd.CommandText = "UPDATE " + Constants.SessionTable + " SET uploadingState = " + state + 
                        " WHERE uniqueID == " + uniqueID ;
@@ -737,7 +737,7 @@ class SqliteServerSession : SqliteSession
                dbcmd.ExecuteNonQuery();
 
                //if(!dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 
        
diff --git a/src/sqlite/speciallity.cs b/src/sqlite/speciallity.cs
index 6900f3a..5f25fef 100644
--- a/src/sqlite/speciallity.cs
+++ b/src/sqlite/speciallity.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 
@@ -58,7 +58,7 @@ class SqliteSpeciallity : Sqlite
        public static int Insert(bool dbconOpened, int sportID, string speciallityName)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string myString = "INSERT INTO " + Constants.SpeciallityTable + 
                        " (uniqueID, sportID, name) VALUES (NULL, " + sportID + ", '" + speciallityName + 
"')"; 
@@ -73,7 +73,7 @@ class SqliteSpeciallity : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
@@ -83,7 +83,7 @@ class SqliteSpeciallity : Sqlite
                if(uniqueID == -1)
                        return "";
 
-               dbcon.Open();
+               Sqlite.Open();
                
                dbcmd.CommandText = "SELECT name FROM " + Constants.SpeciallityTable + " WHERE uniqueID == " 
+ uniqueID;
                
@@ -97,7 +97,7 @@ class SqliteSpeciallity : Sqlite
                string speciallityName = reader[0].ToString(); //name
        
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                //return uniqueID + ":" + Catalog.GetString(speciallityName);
                return Catalog.GetString(speciallityName);
        }
@@ -108,7 +108,7 @@ class SqliteSpeciallity : Sqlite
                if(sportFilter != -1)
                        whereString = " WHERE sportID == " + sportFilter;
 
-               dbcon.Open();
+               Sqlite.Open();
                SqliteDataReader reader;
                ArrayList myArray = new ArrayList(2);
                int count = 0;
@@ -131,7 +131,7 @@ class SqliteSpeciallity : Sqlite
                        count ++;
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] myReturn = new string[count];
                count = 0;
@@ -202,7 +202,7 @@ class SqliteSpeciallity : Sqlite
        public static void InsertUndefined(bool dbconOpened)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                string myString = "INSERT INTO " + Constants.SpeciallityTable + 
                        " (uniqueID, sportID, name) VALUES (-1, -1, \"\")"; 
@@ -211,6 +211,6 @@ class SqliteSpeciallity : Sqlite
                dbcmd.ExecuteNonQuery();
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
        }
 }
diff --git a/src/sqlite/sport.cs b/src/sqlite/sport.cs
index d0a16e7..3fc3fa5 100644
--- a/src/sqlite/sport.cs
+++ b/src/sqlite/sport.cs
@@ -15,7 +15,7 @@
  *  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-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 
@@ -59,7 +59,7 @@ class SqliteSport : Sqlite
        public static int Insert(bool dbconOpened, string uniqueID, string name, bool userDefined, bool 
hasSpeciallities, string graphLink)
        {
                if(! dbconOpened)
-                       dbcon.Open();
+                       Sqlite.Open();
 
                if(uniqueID == "-1")
                        uniqueID = "NULL";
@@ -79,14 +79,14 @@ class SqliteSport : Sqlite
                int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since 
`ExecuteScalar` returns an object.
                
                if(! dbconOpened)
-                       dbcon.Close();
+                       Sqlite.Close();
 
                return myLast;
        }
 
        public static Sport Select(int uniqueID)
        {
-               dbcon.Open();
+               Sqlite.Open();
                
                dbcmd.CommandText = "SELECT * FROM " + Constants.SportTable + " WHERE uniqueID == " + 
uniqueID;
                
@@ -106,13 +106,13 @@ class SqliteSport : Sqlite
                                );
        
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return mySport;
        }
                
        public static int SelectID(string name)
        {
-               //dbcon.Open();
+               //Sqlite.Open();
                
                dbcmd.CommandText = "SELECT uniqueID FROM " + Constants.SportTable + " WHERE name == '" + 
name + "'";
                
@@ -125,14 +125,14 @@ class SqliteSport : Sqlite
                int myID = Convert.ToInt32(reader[0]);
                reader.Close();
                
-               //dbcon.Close();
+               //Sqlite.Close();
                
                return myID;
        }
 
        public static string [] SelectAll() 
        {
-               dbcon.Open();
+               Sqlite.Open();
                SqliteDataReader reader;
                ArrayList myArray = new ArrayList(2);
                int count = 0;
@@ -156,7 +156,7 @@ class SqliteSport : Sqlite
                        count ++;
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                string [] myReturn = new string[count];
                count = 0;
diff --git a/src/sqlite/stat.cs b/src/sqlite/stat.cs
index 720cdb5..9084053 100644
--- a/src/sqlite/stat.cs
+++ b/src/sqlite/stat.cs
@@ -63,7 +63,7 @@ class SqliteStat : Sqlite
                        orderByString = orderByString + tp + ".name, sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -108,7 +108,7 @@ class SqliteStat : Sqlite
                        }
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
        
@@ -154,7 +154,7 @@ class SqliteStat : Sqlite
                        orderByString = orderByString + "" + tp + ".name, jump.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, jump.sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -214,7 +214,7 @@ class SqliteStat : Sqlite
                        }
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -315,7 +315,7 @@ class SqliteStat : Sqlite
                        orderByString = orderByString + tp + ".name, jump.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, jump.sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -379,7 +379,7 @@ class SqliteStat : Sqlite
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -421,7 +421,7 @@ class SqliteStat : Sqlite
                        orderByString = orderByString + tp + ".name, jumpRj.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, sessionID, " + moreSelect +
                        //" FROM jumpRj, person " +
                        fromString +
@@ -474,7 +474,7 @@ class SqliteStat : Sqlite
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -518,7 +518,7 @@ class SqliteStat : Sqlite
                        orderByString = orderByString + tp + ".name, jumpRj.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -576,7 +576,7 @@ class SqliteStat : Sqlite
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -584,7 +584,7 @@ class SqliteStat : Sqlite
        //for rjEvolution (to know the number of columns)
        public static int ObtainMaxNumberOfJumps (string sessionString)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT MAX(jumps) from jumpRj " + sessionString +
                        "group by jumps order by jumps DESC limit 1";
                        //this is done because if no jumps, and we don't write last line, it returns a blank 
line
@@ -601,7 +601,7 @@ class SqliteStat : Sqlite
                        myReturn = Convert.ToInt32(reader[0].ToString());
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                if (found) {
                        return myReturn;
@@ -613,7 +613,7 @@ class SqliteStat : Sqlite
        //for start/RunIntervallic (to know the number of columns)
        public static int ObtainMaxNumberOfRuns (string sessionString)
        {
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT MAX(tracks) from runInterval " + sessionString +
                        "group by tracks order by tracks DESC limit 1";
                        //this is done because if no jumps, and we don't write last line, it returns a blank 
line
@@ -632,7 +632,7 @@ class SqliteStat : Sqlite
                        myReturn = Convert.ToInt32(Math.Floor(Convert.ToDouble(reader[0].ToString())));
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
 
                if (found) {
                        return myReturn;
@@ -704,7 +704,7 @@ class SqliteStat : Sqlite
                        orderByString = orderByString + tp + ".name, jumpRj.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -766,7 +766,7 @@ class SqliteStat : Sqlite
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -812,7 +812,7 @@ class SqliteStat : Sqlite
                //      orderByString = orderByString + tp + ".name, jumpRj.sessionID, ";
                //}
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -867,7 +867,7 @@ Log.WriteLine(intervalSpeeds);
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -907,7 +907,7 @@ Log.WriteLine(intervalSpeeds);
                        orderByString = orderByString + tp + ".name, j1.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, j1.sessionID, " + moreSelect +
                        " FROM jump AS j1, jump AS j2, " + tp + " " +
                        sessionString +
@@ -950,7 +950,7 @@ Log.WriteLine(intervalSpeeds);
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
        
@@ -984,7 +984,7 @@ Log.WriteLine(intervalSpeeds);
                        orderByString = orderByString + tp + ".name, j1.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, j1.sessionID, " + moreSelect +
                        " FROM jump AS j1, jump AS j2, " + tp + " " +
                        sessionString +
@@ -1028,7 +1028,7 @@ Log.WriteLine(intervalSpeeds);
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -1062,7 +1062,7 @@ Log.WriteLine(intervalSpeeds);
                        orderByString = orderByString + tp + ".name, j1.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, j1.sessionID, " + moreSelect +
                        " FROM jump AS j1, jump AS j2, " + tp + " " +
                        sessionString +
@@ -1112,7 +1112,7 @@ Log.WriteLine(intervalSpeeds);
                                    );
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -1217,7 +1217,7 @@ Log.WriteLine(intervalSpeeds);
                        orderByString = orderByString + "jump.sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, jump.sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -1287,7 +1287,7 @@ Log.WriteLine(intervalSpeeds);
                        }
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
 
@@ -1329,7 +1329,7 @@ Log.WriteLine(intervalSpeeds);
                        orderByString = orderByString + tp + ".name, sessionID, ";
                }
                
-               dbcon.Open();
+               Sqlite.Open();
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, sessionID, " + moreSelect +
                        fromString +
                        sessionString +
@@ -1374,7 +1374,7 @@ Log.WriteLine(intervalSpeeds);
                        }
                }
                reader.Close();
-               dbcon.Close();
+               Sqlite.Close();
                return myArray;
        }
        
@@ -1390,7 +1390,7 @@ Log.WriteLine(intervalSpeeds);
        */
        public static ArrayList SelectChronojumpProfile (string sessionID)
        {
-               dbcon.Open();
+               Sqlite.Open();
                
                //select personID and personName (IDNameList)
                IDNameList idNameList = fillIDNameList( 
@@ -1450,7 +1450,7 @@ Log.WriteLine(intervalSpeeds);
                ArrayList arrayReturn = superlist.GetArray();
                Log.WriteLine("end of superlist");
                
-               dbcon.Close();
+               Sqlite.Close();
                return arrayReturn;
        }
 


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