[chronojump] Safer ' to \" on all SQL calls (fixes catalan strings with ')



commit 4a23fd6460ff019d6db1297214e6c8c04a068fa1
Author: Xavier Padullés <x padulles gmail com>
Date:   Mon Jan 25 13:44:54 2016 +0100

    Safer ' to \" on all SQL calls (fixes catalan strings with ')

 src/sqlite/country.cs        |    4 +-
 src/sqlite/encoder.cs        |   84 +++++++++++++++++++++---------------------
 src/sqlite/event.cs          |    4 +-
 src/sqlite/executeAuto.cs    |   12 +++---
 src/sqlite/jump.cs           |   26 ++++++------
 src/sqlite/jumpRj.cs         |   18 ++++----
 src/sqlite/jumpType.cs       |   34 ++++++++--------
 src/sqlite/main.cs           |   66 ++++++++++++++++----------------
 src/sqlite/multiChronopic.cs |   22 +++++-----
 src/sqlite/oldConvert.cs     |   26 ++++++------
 src/sqlite/person.cs         |   26 ++++++------
 src/sqlite/personSession.cs  |    8 ++--
 src/sqlite/preferences.cs    |   10 ++--
 src/sqlite/pulse.cs          |   10 ++--
 src/sqlite/pulseType.cs      |   10 ++--
 src/sqlite/reactionTime.cs   |   12 +++---
 src/sqlite/run.cs            |   16 ++++----
 src/sqlite/runInterval.cs    |   16 ++++----
 src/sqlite/runType.cs        |   28 +++++++-------
 src/sqlite/server.cs         |   36 +++++++++---------
 src/sqlite/session.cs        |   40 ++++++++++----------
 src/sqlite/speciallity.cs    |    2 +-
 src/sqlite/sport.cs          |    6 +-
 src/sqlite/stat.cs           |   40 ++++++++++----------
 24 files changed, 278 insertions(+), 278 deletions(-)
---
diff --git a/src/sqlite/country.cs b/src/sqlite/country.cs
index 6e10a55..b82c582 100644
--- a/src/sqlite/country.cs
+++ b/src/sqlite/country.cs
@@ -103,7 +103,7 @@ class SqliteCountry : Sqlite
        {
                Sqlite.Open();
                
-               dbcmd.CommandText = "SELECT uniqueID, name FROM " + Constants.CountryTable + " WHERE 
continent == '" + continent + "'";
+               dbcmd.CommandText = "SELECT uniqueID, name FROM " + Constants.CountryTable + " WHERE 
continent == \"" + continent + "\"";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -160,7 +160,7 @@ class SqliteCountry : Sqlite
 
        //useful to convert DB from 0.57 to 0.58 (strip republic and kingdom stuff)
        public static bool TableHasOldRepublicStuff() {
-               dbcmd.CommandText = "SELECT name FROM " + Constants.CountryTable + " WHERE code == 'DZA'";
+               dbcmd.CommandText = "SELECT name FROM " + Constants.CountryTable + " WHERE code == \"DZA\"";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index f657f49..38c079b 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -82,15 +82,15 @@ class SqliteEncoder : Sqlite
                        "videoURL, encoderConfiguration, future1, future2, future3)" +
                        " VALUES (" + es.uniqueID + ", " +
                        es.personID + ", " + es.sessionID + ", " +
-                       es.exerciseID + ", '" + es.eccon + "', '" +
-                       es.LateralityToEnglish() + "', '" + es.extraWeight + "', '" +
-                       es.signalOrCurve + "', '" + es.filename + "', '" +
-                       removeURLpath(es.url) + "', " + 
-                       es.time + ", " + es.minHeight + ", '" + es.description + 
-                       "', '" + es.status + "', '" + 
-                       removeURLpath(es.videoURL) + "', '" + 
-                       es.encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "', '" +
-                       Util.ConvertToPoint(es.future1) + "', '" + es.future2 + "', '" + es.future3 + "')";
+                       es.exerciseID + ", \"" + es.eccon + "\", \"" +
+                       es.LateralityToEnglish() + "\", \"" + es.extraWeight + "\", \"" +
+                       es.signalOrCurve + "\", \"" + es.filename + "\", \"" +
+                       removeURLpath(es.url) + "\", " + 
+                       es.time + ", " + es.minHeight + ", \"" + es.description + 
+                       "\", \"" + es.status + "\", \"" + 
+                       removeURLpath(es.videoURL) + "\", \"" + 
+                       es.encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "\", \"" +
+                       Util.ConvertToPoint(es.future1) + "\", \"" + es.future2 + "\", \"" + es.future3 + 
"\")";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -128,22 +128,22 @@ class SqliteEncoder : Sqlite
                                " personID = " + es.personID +
                                ", sessionID = " + es.sessionID +
                                ", exerciseID = " + es.exerciseID +
-                               ", eccon = '" + es.eccon +
-                               "', laterality = '" + es.LateralityToEnglish() +
-                               "', extraWeight = '" + es.extraWeight +
-                               "', signalOrCurve = '" + es.signalOrCurve +
-                               "', filename = '" + es.filename +
-                               "', url = '" + removeURLpath(es.url) +
-                               "', time = " + es.time +
+                               ", eccon = \"" + es.eccon +
+                               "\", laterality = \"" + es.LateralityToEnglish() +
+                               "\", extraWeight = \"" + es.extraWeight +
+                               "\", signalOrCurve = \"" + es.signalOrCurve +
+                               "\", filename = \"" + es.filename +
+                               "\", url = \"" + removeURLpath(es.url) +
+                               "\", time = " + es.time +
                                ", minHeight = " + es.minHeight +
-                               ", description = '" + es.description + 
-                               "', status = '" + es.status + 
-                               "', videoURL = '" + removeURLpath(es.videoURL) + 
-                               "', encoderConfiguration = '" + 
es.encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.SQL) +
-                               "', future1 = '" + Util.ConvertToPoint(es.future1) + 
-                               "', future2 = '" + es.future2 + 
-                               "', future3 = '" + es.future3 + 
-                               "' WHERE uniqueID == " + es.uniqueID ;
+                               ", description = \"" + es.description + 
+                               "\", status = \"" + es.status + 
+                               "\", videoURL = \"" + removeURLpath(es.videoURL) + 
+                               "\", encoderConfiguration = \"" + 
es.encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.SQL) +
+                               "\", future1 = \"" + Util.ConvertToPoint(es.future1) + 
+                               "\", future2 = \"" + es.future2 + 
+                               "\", future3 = \"" + es.future3 + 
+                               "\" WHERE uniqueID == " + es.uniqueID ;
 
                LogB.SQL(mycmd.CommandText.ToString());
                mycmd.ExecuteNonQuery();
@@ -230,10 +230,10 @@ class SqliteEncoder : Sqlite
                        if(signalOrCurve == "all")
                                selectStr = personIDStr + sessionIDStr + exerciseIDStr;
                        else
-                               selectStr = personIDStr + sessionIDStr + exerciseIDStr + " signalOrCurve = '" 
+ signalOrCurve + "'";
+                               selectStr = personIDStr + sessionIDStr + exerciseIDStr + " signalOrCurve = 
\"" + signalOrCurve + "\"";
                
                        if(ecconSelect != EncoderSQL.Eccons.ALL)
-                               selectStr += " AND " + Constants.EncoderTable + ".eccon = '" + 
EncoderSQL.Eccons.ecS.ToString() + "'";
+                               selectStr += " AND " + Constants.EncoderTable + ".eccon = \"" + 
EncoderSQL.Eccons.ecS.ToString() + "\"";
                }
                        
 
@@ -243,7 +243,7 @@ class SqliteEncoder : Sqlite
 
                string onlyActiveString = "";
                if(onlyActive)
-                       onlyActiveString = " AND " + Constants.EncoderTable + ".status = 'active' ";
+                       onlyActiveString = " AND " + Constants.EncoderTable + ".status = \"active\" ";
 
                string orderIDstr = "";
                if(! orderIDascendent)
@@ -332,10 +332,10 @@ class SqliteEncoder : Sqlite
                //returns a row for each session where there are active or inactive
                dbcmd.CommandText = 
                        "SELECT encoder.sessionID, session.name, session.date, " +
-                       " SUM(CASE WHEN encoder.status = 'active' THEN 1 END) as active, " +
-                       " SUM(CASE WHEN encoder.status = 'inactive' THEN 1 END) as inactive " + 
+                       " SUM(CASE WHEN encoder.status = \"active\" THEN 1 END) as active, " +
+                       " SUM(CASE WHEN encoder.status = \"inactive\" THEN 1 END) as inactive " + 
                        " FROM encoder, session, person77 " +
-                       " WHERE encoder.personID == " + personID + " AND signalOrCurve == 'curve' AND " +
+                       " WHERE encoder.personID == " + personID + " AND signalOrCurve == \"curve\" AND " +
                        " encoder.personID == person77.uniqueID AND encoder.sessionID == session.uniqueID " +
                        " GROUP BY encoder.sessionID ORDER BY encoder.sessionID, encoder.status";
        
@@ -383,7 +383,7 @@ class SqliteEncoder : Sqlite
                dbcmd.CommandText = 
                        "SELECT person77.name, encoderExercise.name, (personSession77.weight * 
encoderExercise.percentBodyWeight/100) + encoder.extraWeight, COUNT(*)" + 
                        " FROM person77, personSession77, encoderExercise, encoder" + 
-                       " WHERE person77.uniqueID == encoder.personID AND personSession77.personID == 
encoder.personID AND personSession77.sessionID == encoder.sessionID AND 
encoderExercise.uniqueID==encoder.exerciseID AND signalOrCurve == 'signal' AND encoder.sessionID == " + 
sessionID + 
+                       " WHERE person77.uniqueID == encoder.personID AND personSession77.personID == 
encoder.personID AND personSession77.sessionID == encoder.sessionID AND 
encoderExercise.uniqueID==encoder.exerciseID AND signalOrCurve == \"signal\" AND encoder.sessionID == " + 
sessionID + 
                        " GROUP BY encoder.personID, exerciseID, extraWeight" +
                        " ORDER BY person77.name";
                
@@ -435,7 +435,7 @@ class SqliteEncoder : Sqlite
 
                dbcmd.CommandText = "INSERT INTO " + Constants.EncoderSignalCurveTable +  
                        " (uniqueID, signalID, curveID, msCentral, future1) " + 
-                       "VALUES (NULL, " + signalID + ", " + curveID + ", " + msCentral + ", '')";
+                       "VALUES (NULL, " + signalID + ", " + curveID + ", " + msCentral + ", \"\")";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
@@ -571,8 +571,8 @@ class SqliteEncoder : Sqlite
 
                dbcmd.CommandText = "INSERT INTO " + Constants.EncoderExerciseTable +  
                                " (uniqueID, name, percentBodyWeight, ressistance, description, future1, 
future2, future3)" +
-                               " VALUES (NULL, '" + name + "', " + percentBodyWeight + ", '" + 
-                               ressistance + "', '" + description + "', '" + speed1RM + "', '', '')";
+                               " VALUES (NULL, \"" + name + "\", " + percentBodyWeight + ", \"" + 
+                               ressistance + "\", \"" + description + "\", \"" + speed1RM + "\", '', '')";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -638,12 +638,12 @@ class SqliteEncoder : Sqlite
                        Sqlite.Open();
 
                dbcmd.CommandText = "UPDATE " + Constants.EncoderExerciseTable + " SET " +
-                               " name = '" + name +
-                               "', percentBodyWeight = " + percentBodyWeight +
-                               ", ressistance = '" + ressistance +
-                               "', description = '" + description +
-                               "', future1 = '" + speed1RM +
-                               "' WHERE name = '" + nameOld + "'" ;
+                               " name = \"" + name +
+                               "\", percentBodyWeight = " + percentBodyWeight +
+                               ", ressistance = \"" + ressistance +
+                               "\", description = \"" + description +
+                               "\", future1 = \"" + speed1RM +
+                               "\" WHERE name = \"" + nameOld + "\"" ;
 
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -760,7 +760,7 @@ class SqliteEncoder : Sqlite
        //conversion from DB 1.02 to 1.03
        protected internal static void removeEncoderExerciseAngles() {
                dbcmd.CommandText = "UPDATE " + Constants.EncoderExerciseTable + 
-                       " SET future2 = '', future3 = ''";
+                       " SET future2 = \"\", future3 = \"\"";
 
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -793,7 +793,7 @@ class SqliteEncoder : Sqlite
                dbcmd.CommandText = "INSERT INTO " + Constants.Encoder1RMTable +  
                                " (uniqueID, personID, sessionID, exerciseID, load1RM, future1, future2, 
future3)" +
                                " VALUES (NULL, " + personID + ", " + sessionID + ", " + 
-                               exerciseID + ", " + Util.ConvertToPoint(load1RM) + ", '','','')";
+                               exerciseID + ", " + Util.ConvertToPoint(load1RM) + ", \"\",\"\",\"\")";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
diff --git a/src/sqlite/event.cs b/src/sqlite/event.cs
index 9e4134b..29db67c 100644
--- a/src/sqlite/event.cs
+++ b/src/sqlite/event.cs
@@ -61,7 +61,7 @@ class SqliteEvent : Sqlite
                }
                mycmd.CommandText = "INSERT INTO graphLinkTable" + 
                                "(uniqueID, tableName, eventName, graphFileName, other1, other2)" +
-                               " VALUES (NULL, '" + tableName + "', '" + eventName + "', '" + graphFileName 
+ "', '', '')" ;
+                               " VALUES (NULL, \"" + tableName + "\", \"" + eventName + "\", \"" + 
graphFileName + "\", \"\", \"\")" ;
                LogB.SQL(mycmd.CommandText.ToString());
                mycmd.ExecuteNonQuery();
                //int myLast = dbcon.LastInsertRowId;
@@ -81,7 +81,7 @@ class SqliteEvent : Sqlite
        {
                Sqlite.Open();
 
-               dbcmd.CommandText = "SELECT graphFileName FROM graphLinkTable WHERE tableName == '" + 
tableName + "' AND eventName =='" + eventName + "'";
+               dbcmd.CommandText = "SELECT graphFileName FROM graphLinkTable WHERE tableName == \"" + 
tableName + "\" AND eventName ==\"" + eventName + "\"";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
diff --git a/src/sqlite/executeAuto.cs b/src/sqlite/executeAuto.cs
index 6f0704a..f192122 100644
--- a/src/sqlite/executeAuto.cs
+++ b/src/sqlite/executeAuto.cs
@@ -66,12 +66,12 @@ class SqliteExecuteAuto : Sqlite
                        " (uniqueID, name, mode, description, " +
                        " serie1IDs, serie2IDs, serie3IDs, " + 
                        " future1, future2, future3)" +
-                       " VALUES ( NULL, '" +
-                       eaSQL.name + "', '" + eaSQL.Mode.ToString() + "', '" + eaSQL.Description + "', '" +
-                       eaSQL.SerieIDsToStr(eaSQL.Serie1IDs) + "', '" + 
-                       eaSQL.SerieIDsToStr(eaSQL.Serie2IDs) + "', '" + 
-                       eaSQL.SerieIDsToStr(eaSQL.Serie3IDs) + "', " + 
-                       "'', '', '')"; //future1, future2, future3
+                       " VALUES ( NULL, \"" +
+                       eaSQL.name + "\", \"" + eaSQL.Mode.ToString() + "\", \"" + eaSQL.Description + "\", 
\"" +
+                       eaSQL.SerieIDsToStr(eaSQL.Serie1IDs) + "\", \"" + 
+                       eaSQL.SerieIDsToStr(eaSQL.Serie2IDs) + "\", \"" + 
+                       eaSQL.SerieIDsToStr(eaSQL.Serie3IDs) + "\", " + 
+                       "\"\", \"\", \"\")"; //future1, future2, future3
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index bfcfe75..74798d9 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -75,9 +75,9 @@ class SqliteJump : Sqlite
                dbcmd.CommandText = "INSERT INTO " + tableName +  
                                " (uniqueID, personID, sessionID, type, tv, tc, fall, weight, description, 
angle, simulated)" +
                                " VALUES (" + uniqueID + ", "
-                               + personID + ", " + sessionID + ", '" + type + "', "
-                               + Util.ConvertToPoint(tv) + ", " + Util.ConvertToPoint(tc) + ", " + 
Util.ConvertToPoint(fall) + ", '" 
-                               + Util.ConvertToPoint(weight) + "', '" + description + "', "
+                               + personID + ", " + sessionID + ", \"" + type + "\", "
+                               + Util.ConvertToPoint(tv) + ", " + Util.ConvertToPoint(tc) + ", " + 
Util.ConvertToPoint(fall) + ", \"" 
+                               + Util.ConvertToPoint(weight) + "\", \"" + description + "\", "
                                + Util.ConvertToPoint(angle) + ", " + simulated +")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -119,7 +119,7 @@ class SqliteJump : Sqlite
 
                string filterTypeString = "";
                if(filterType != "")
-                       filterTypeString = " AND jump.type == '" + filterType + "' ";
+                       filterTypeString = " AND jump.type == \"" + filterType + "\" ";
 
                dbcmd.CommandText = "SELECT " + tp + ".name, jump.*, " + tps + ".weight " +
                        " FROM " + tp + ", jump, " + tps + 
@@ -206,13 +206,13 @@ class SqliteJump : Sqlite
        {
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE jump SET personID = " + personID + 
-                       ", type = '" + type +
-                       "', tv = " + Util.ConvertToPoint(tv) +
+                       ", type = \"" + type +
+                       "\", tv = " + Util.ConvertToPoint(tv) +
                        ", tc = " + Util.ConvertToPoint(tc) +
                        ", fall = " + Util.ConvertToPoint(fall) +
                        ", weight = " + Util.ConvertToPoint(weight) + 
-                       ", description = '" + description +
-                       "', angle = " + Util.ConvertToPoint(angle) +
+                       ", description = \"" + description +
+                       "\", angle = " + Util.ConvertToPoint(angle) +
                        " WHERE uniqueID == " + jumpID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -232,8 +232,8 @@ class SqliteJump : Sqlite
        public static void UpdateDescription(string tableName, int uniqueID, string description)
        {
                Sqlite.Open();
-               dbcmd.CommandText = "UPDATE " + tableName + " SET description = '" + description + 
-                       "' WHERE uniqueID == " + uniqueID ;
+               dbcmd.CommandText = "UPDATE " + tableName + " SET description = \"" + description + 
+                       "\" WHERE uniqueID == " + uniqueID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
@@ -242,15 +242,15 @@ class SqliteJump : Sqlite
        //onle for change SJ+ CMJ+ and ABK+ to SJl...
        public static void ChangeWeightToL()
        {
-               dbcmd.CommandText = "UPDATE jump SET type = 'SJl' WHERE type == 'SJ+'";
+               dbcmd.CommandText = "UPDATE jump SET type = \"SJl\" WHERE type == \"SJ+\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
-               dbcmd.CommandText = "UPDATE jump SET type = 'CMJl' WHERE type == 'CMJ+'";
+               dbcmd.CommandText = "UPDATE jump SET type = \"CMJl\" WHERE type == \"CMJ+\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
-               dbcmd.CommandText = "UPDATE jump SET type = 'ABKl' WHERE type == 'ABK+'";
+               dbcmd.CommandText = "UPDATE jump SET type = \"ABKl\" WHERE type == \"ABK+\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
        }
diff --git a/src/sqlite/jumpRj.cs b/src/sqlite/jumpRj.cs
index c29cb2b..48b2aa6 100644
--- a/src/sqlite/jumpRj.cs
+++ b/src/sqlite/jumpRj.cs
@@ -70,12 +70,12 @@ class SqliteJumpRj : SqliteJump
                                " (uniqueID, personID, sessionID, type, tvMax, tcMax, fall, weight, 
description, " +
                                "tvAvg, tcAvg, tvString, tcString, jumps, time, limited, angleString, 
simulated )" +
                                "VALUES (" + uniqueID + ", " +
-                               personID + ", " + sessionID + ", '" + type + "', " +
-                               Util.ConvertToPoint(tvMax) + ", " + Util.ConvertToPoint(tcMax) + ", '" + 
-                               Util.ConvertToPoint(fall) + "', '" + Util.ConvertToPoint(weight) + "', '" + 
description + "', " +
-                               Util.ConvertToPoint(tvAvg) + ", " + Util.ConvertToPoint(tcAvg) + ", '" + 
-                               Util.ConvertToPoint(tvString) + "', '" + Util.ConvertToPoint(tcString) + "', 
" +
-                               jumps + ", " + Util.ConvertToPoint(time) + ", '" + limited + "', '" + 
angleString + "', " + simulated +")" ;
+                               personID + ", " + sessionID + ", \"" + type + "\", " +
+                               Util.ConvertToPoint(tvMax) + ", " + Util.ConvertToPoint(tcMax) + ", \"" + 
+                               Util.ConvertToPoint(fall) + "\", \"" + Util.ConvertToPoint(weight) + "\", \"" 
+ description + "\", " +
+                               Util.ConvertToPoint(tvAvg) + ", " + Util.ConvertToPoint(tcAvg) + ", \"" + 
+                               Util.ConvertToPoint(tvString) + "\", \"" + Util.ConvertToPoint(tcString) + 
"\", " +
+                               jumps + ", " + Util.ConvertToPoint(time) + ", \"" + limited + "\", \"" + 
angleString + "\", " + simulated +")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -113,7 +113,7 @@ class SqliteJumpRj : SqliteJump
 
                string filterTypeString = "";
                if(filterType != "")
-                       filterTypeString = " AND jumpRj.type == '" + filterType + "' ";
+                       filterTypeString = " AND jumpRj.type == \"" + filterType + "\" ";
 
                dbcmd.CommandText = "SELECT " + tp + ".name, jumpRj.*, " + tps + ".weight " +
                        " FROM " + tp + ", jumpRj, " + tps + " " +
@@ -206,8 +206,8 @@ class SqliteJumpRj : SqliteJump
                dbcmd.CommandText = "UPDATE jumpRj SET personID = " + personID + 
                        ", fall = " + Util.ConvertToPoint(Convert.ToDouble(fall)) + 
                        ", weight = " + Util.ConvertToPoint(weight) + 
-                       ", description = '" + description +
-                       "' WHERE uniqueID == " + jumpID ;
+                       ", description = \"" + description +
+                       "\" WHERE uniqueID == " + jumpID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/jumpType.cs b/src/sqlite/jumpType.cs
index c660f0b..40dbe17 100644
--- a/src/sqlite/jumpType.cs
+++ b/src/sqlite/jumpType.cs
@@ -202,9 +202,9 @@ class SqliteJumpType : Sqlite
                }
                mycmd.CommandText = "INSERT INTO " + Constants.JumpTypeTable +  
                                " (uniqueID, name, startIn, weight, description)" +
-                               " VALUES (NULL, '"
-                               + myStr[0] + "', " + myStr[1] + ", " +  //name, startIn
-                               myStr[2] + ", '" + myStr[3] + "')" ;    //weight, description
+                               " VALUES (NULL, \""
+                               + myStr[0] + "\", " + myStr[1] + ", " + //name, startIn
+                               myStr[2] + ", \"" + myStr[3] + "\")" ;  //weight, description
                LogB.SQL(mycmd.CommandText.ToString());
                mycmd.ExecuteNonQuery();
                if(! dbconOpened) {
@@ -227,10 +227,10 @@ class SqliteJumpType : Sqlite
                }
                mycmd.CommandText = "INSERT INTO " + Constants.JumpRjTypeTable + 
                                " (uniqueID, name, startIn, weight, jumpsLimited, fixedValue, description)" +
-                               " VALUES (NULL, '"
-                               + myStr[0] + "', " + myStr[1] + ", " +  //name, startIn
+                               " VALUES (NULL, \""
+                               + myStr[0] + "\", " + myStr[1] + ", " + //name, startIn
                                myStr[2] + ", " + myStr[3] + ", " +     //weight, jumpsLimited
-                               myStr[4] + ", '" + myStr[5] + "')" ;    //fixedValue, description
+                               myStr[4] + ", \"" + myStr[5] + "\")" ;  //fixedValue, description
                LogB.SQL(mycmd.CommandText.ToString());
                mycmd.ExecuteNonQuery();
                if(! dbconOpened) {
@@ -369,8 +369,8 @@ class SqliteJumpType : Sqlite
                        Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.JumpTypeTable + " " +
-                       " WHERE name  = '" + typeName +
-                       "' ORDER BY uniqueID";
+                       " WHERE name  = \"" + typeName +
+                       "\" ORDER BY uniqueID";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -401,8 +401,8 @@ class SqliteJumpType : Sqlite
                        Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.JumpRjTypeTable + " " +
-                       " WHERE name  = '" + typeName +
-                       "' ORDER BY uniqueID";
+                       " WHERE name  = \"" + typeName +
+                       "\" ORDER BY uniqueID";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -444,7 +444,7 @@ class SqliteJumpType : Sqlite
                Sqlite.Open();
                dbcmd.CommandText = "SELECT weight " +
                        " FROM " + tableName +
-                       " WHERE name == '" + typeName + "'";
+                       " WHERE name == \"" + typeName + "\"";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -472,7 +472,7 @@ class SqliteJumpType : Sqlite
                Sqlite.Open();
                dbcmd.CommandText = "SELECT startIn " +
                        " FROM " + tableName +
-                       " WHERE name == '" + typeName + "'";
+                       " WHERE name == \"" + typeName + "\"";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -495,8 +495,8 @@ class SqliteJumpType : Sqlite
        public static void Update(string nameOld, string nameNew)
        {
                //Sqlite.Open();
-               dbcmd.CommandText = "UPDATE jumpType SET name = '" + nameNew + 
-                       "' WHERE name == '" + nameOld + "'";
+               dbcmd.CommandText = "UPDATE jumpType SET name = \"" + nameNew + 
+                       "\" WHERE name == \"" + nameOld + "\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                //Sqlite.Close();
@@ -505,8 +505,8 @@ class SqliteJumpType : Sqlite
        public static void UpdateOther(string column, string typeName, string newValue)
        {
                //Sqlite.Open();
-               dbcmd.CommandText = "UPDATE jumpType SET " + column + " = '" + newValue + 
-                       "' WHERE name == '" + typeName + "'";
+               dbcmd.CommandText = "UPDATE jumpType SET " + column + " = \"" + newValue + 
+                       "\" WHERE name == \"" + typeName + "\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                //Sqlite.Close();
@@ -517,7 +517,7 @@ class SqliteJumpType : Sqlite
                if(!dbconOpened)
                        Sqlite.Open();
                dbcmd.CommandText = "Delete FROM " + tableName + 
-                       " WHERE name == '" + name + "'";
+                       " WHERE name == \"" + name + "\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                if(!dbconOpened)
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 6e09e55..02b42ba 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -1226,7 +1226,7 @@ class Sqlite
                                //delete all it's runs
                                Sqlite.Open();
                                dbcmd.CommandText = "DELETE FROM " + Constants.RunIntervalTable +
-                                       " WHERE type == 'RSA 8-4-R3-5'";
+                                       " WHERE type == \"RSA 8-4-R3-5\"";
                                LogB.SQL(dbcmd.CommandText.ToString());
                                dbcmd.ExecuteNonQuery();
                                
@@ -1395,13 +1395,13 @@ class Sqlite
                                                "videoURL, mode, inertiaMomentum, diameter, future1, future2, 
future3)" +
                                                " VALUES (" + es.uniqueID + ", " +
                                                es.personID + ", " + es.sessionID + ", " +
-                                               es.exerciseID + ", '" + es.eccon + "', '" +
-                                               es.laterality + "', '" + es.extraWeight + "', '" +
-                                               es.signalOrCurve + "', '" + es.filename + "', '" +
-                                               es.url + "', " + es.time + ", " + es.minHeight + ", " +
-                                               Util.ConvertToPoint(es.smooth) + ", '" + es.description + "', 
'" +
-                                               es.future1 + "', '" + es.future2 + "', 'LINEAR', " + 
//status, videoURL, mode
-                                               "0, 0, '', '', '')"; //inertiaMomentum, diameter, future1, 2, 
3
+                                               es.exerciseID + ", \"" + es.eccon + "\", \"" +
+                                               es.laterality + "\", \"" + es.extraWeight + "\", \"" +
+                                               es.signalOrCurve + "\", \"" + es.filename + "\", \"" +
+                                               es.url + "\", " + es.time + ", " + es.minHeight + ", " +
+                                               Util.ConvertToPoint(es.smooth) + ", \"" + es.description + 
"\", \"" +
+                                               es.future1 + "\", \"" + es.future2 + "\", \"LINEAR\", " + 
//status, videoURL, mode
+                                               "0, 0, \"\", \"\", \"\")"; //inertiaMomentum, diameter, 
future1, 2, 3
                                        LogB.SQL(dbcmd.CommandText.ToString());
                                        dbcmd.ExecuteNonQuery();
                                        count ++;
@@ -1492,13 +1492,13 @@ class Sqlite
                                                "videoURL, encoderConfiguration, future1, future2, future3)" +
                                                " VALUES (" + es.uniqueID + ", " +
                                                es.personID + ", " + es.sessionID + ", " +
-                                               es.exerciseID + ", '" + es.eccon + "', '" +
-                                               es.laterality + "', '" + es.extraWeight + "', '" +
-                                               es.signalOrCurve + "', '" + es.filename + "', '" +
-                                               es.url + "', " + es.time + ", " + es.minHeight + ", '" + 
es.description + "', '" + 
-                                               es.status + "', '" + es.videoURL + "', '" + 
-                                               econf.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "', 
'" + //in this conversion put this as default for all SQL rows.
-                                               es.future1 + "', '" + es.future2 + "', '" + es.future3 + "')";
+                                               es.exerciseID + ", \"" + es.eccon + "\", \"" +
+                                               es.laterality + "\", \"" + es.extraWeight + "\", \"" +
+                                               es.signalOrCurve + "\", \"" + es.filename + "\", \"" +
+                                               es.url + "\", " + es.time + ", " + es.minHeight + ", \"" + 
es.description + "\", \"" + 
+                                               es.status + "\", \"" + es.videoURL + "\", \"" + 
+                                               econf.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "\", 
\"" + //in this conversion put this as default for all SQL rows.
+                                               es.future1 + "\", \"" + es.future2 + "\", \"" + es.future3 + 
"\")";
                                        LogB.SQL(dbcmd.CommandText.ToString());
                                        dbcmd.ExecuteNonQuery();
                                        count ++;
@@ -2107,7 +2107,7 @@ class Sqlite
                        Sqlite.Open();
 
                dbcmd.CommandText = "SELECT uniqueID FROM " + tableName + 
-                       " WHERE LOWER(name) == LOWER('" + findName + "')" ;
+                       " WHERE LOWER(name) == LOWER(\"" + findName + "\")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                
                SqliteDataReader reader;
@@ -2137,13 +2137,13 @@ class Sqlite
 
                string strSelect = "SELECT COUNT(" + variable + "), AVG(" + variable + ")";
                string strFrom   = " FROM " + tableName;
-               string strWhere  = " WHERE " + tableName + ".type = '" + test + "'";
+               string strWhere  = " WHERE " + tableName + ".type = \"" + test + "\"";
 
                string strSex = "";
                if(sex == Constants.MaleID) 
-                       strSex = " AND " + tp + ".sex == '" + Constants.M + "'";
+                       strSex = " AND " + tp + ".sex == \"" + Constants.M + "\"";
                else if (sex == Constants.FemaleID) 
-                       strSex = " AND " + tp + ".sex == '" + Constants.F + "'";
+                       strSex = " AND " + tp + ".sex == \"" + Constants.F + "\"";
 
                string strAge = "";
                string strEval = "";
@@ -2325,8 +2325,8 @@ class Sqlite
                foreach(string str in myArray) {
                        string [] id_date = str.Split(new char[] {':'});
                        DateTime dt = UtilDate.FromSql(id_date[1]);
-                       dbcmd.CommandText = "UPDATE person set dateBorn = '" + UtilDate.ToSql(dt) +
-                               "' WHERE uniqueID = " + id_date[0];
+                       dbcmd.CommandText = "UPDATE person set dateBorn = \"" + UtilDate.ToSql(dt) +
+                               "\" WHERE uniqueID = " + id_date[0];
                        LogB.SQL(dbcmd.CommandText.ToString());
                        dbcmd.ExecuteNonQuery();
                        conversionSubRate ++;
@@ -2353,8 +2353,8 @@ class Sqlite
                foreach(string str in myArray) {
                        string [] id_date = str.Split(new char[] {':'});
                        DateTime dt = UtilDate.FromSql(id_date[1]);
-                       dbcmd.CommandText = "UPDATE session set date = '" + UtilDate.ToSql(dt) +
-                               "' WHERE uniqueID = " + id_date[0];
+                       dbcmd.CommandText = "UPDATE session set date = \"" + UtilDate.ToSql(dt) +
+                               "\" WHERE uniqueID = " + id_date[0];
                        LogB.SQL(dbcmd.CommandText.ToString());
                        dbcmd.ExecuteNonQuery();
                        conversionSubRate ++;
@@ -2381,8 +2381,8 @@ class Sqlite
                foreach(string str in myArray) {
                        string [] id_date = str.Split(new char[] {':'});
                        DateTime dt = UtilDate.FromSql(id_date[1]);
-                       dbcmd.CommandText = "UPDATE SEvaluator set dateBorn = '" + UtilDate.ToSql(dt) +
-                               "' WHERE uniqueID = " + id_date[0];
+                       dbcmd.CommandText = "UPDATE SEvaluator set dateBorn = \"" + UtilDate.ToSql(dt) +
+                               "\" WHERE uniqueID = " + id_date[0];
                        LogB.SQL(dbcmd.CommandText.ToString());
                        dbcmd.ExecuteNonQuery();
                        conversionSubRate ++;
@@ -2446,7 +2446,7 @@ class Sqlite
                        foreach(string name in names) {
                                if(!Exists(false, Constants.JumpTypeTable, name)) {
                                        success = true;
-                                       dbcmd.CommandText = "UPDATE jump SET type = '" + name + "' WHERE type 
== 'DJa'";
+                                       dbcmd.CommandText = "UPDATE jump SET type = \"" + name + "\" WHERE 
type == \"DJa\"";
                                        LogB.SQL(dbcmd.CommandText.ToString());
                                        dbcmd.ExecuteNonQuery();
                                }
@@ -2462,7 +2462,7 @@ class Sqlite
                        foreach(string name in names) {
                                if(!Exists(false, Constants.JumpTypeTable, name)) {
                                        success = true;
-                                       dbcmd.CommandText = "UPDATE jump SET type = '" + name + "' WHERE type 
== 'DJna'";
+                                       dbcmd.CommandText = "UPDATE jump SET type = \"" + name + "\" WHERE 
type == \"DJna\"";
                                        LogB.SQL(dbcmd.CommandText.ToString());
                                        dbcmd.ExecuteNonQuery();
                                }
@@ -2479,12 +2479,12 @@ class Sqlite
                SqliteJumpType.JumpTypeInsert ("DJna:0:0:DJ jump without using arms", true); 
                
                //add auto-converted on description
-               dbcmd.CommandText = "UPDATE jump SET description = description || ' Auto-converted from DJ' 
WHERE type == 'DJ'";
+               dbcmd.CommandText = "UPDATE jump SET description = description || \" Auto-converted from DJ\" 
WHERE type == \"DJ\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
                //conversion
-               dbcmd.CommandText = "UPDATE jump SET type = 'DJna' WHERE type == 'DJ'";
+               dbcmd.CommandText = "UPDATE jump SET type = \"DJna\" WHERE type == \"DJ\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -2862,7 +2862,7 @@ LogB.SQL("5" + tableName);
                bool whereDone = false;
                string cond1 = "";
                if(searchValue != "") {
-                       cond1 = " WHERE " + columnName + " == '" + searchValue + "'";
+                       cond1 = " WHERE " + columnName + " == \"" + searchValue + "\"";
                        whereDone = true;
                }
 
@@ -2875,11 +2875,11 @@ LogB.SQL("5" + tableName);
                        else
                                cond2Pre = " WHERE ";
 
-                       cond2 = cond2Pre + columnNameCondition2 + " == '" + searchValueCondition2 + "'"; 
+                       cond2 = cond2Pre + columnNameCondition2 + " == \"" + searchValueCondition2 + "\""; 
                }
 
                dbcmd.CommandText = "UPDATE " + tableName +
-                       " SET " + columnName + " = '" + newValue + "'" +  
+                       " SET " + columnName + " = \"" + newValue + "\"" +  
                        cond1 +
                        cond2
                        ;
@@ -2925,7 +2925,7 @@ LogB.SQL("5" + tableName);
                        Sqlite.Open();
 
                dbcmd.CommandText = "DELETE FROM " + tableName +
-                       " WHERE name == '" + name + "'";
+                       " WHERE name == \"" + name + "\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
diff --git a/src/sqlite/multiChronopic.cs b/src/sqlite/multiChronopic.cs
index 72ab98a..da1d73e 100644
--- a/src/sqlite/multiChronopic.cs
+++ b/src/sqlite/multiChronopic.cs
@@ -88,15 +88,15 @@ class SqliteMultiChronopic : Sqlite
                        " cp1InStr, cp1OutStr, cp2InStr, cp2OutStr, cp3InStr, cp3OutStr, cp4InStr, cp4OutStr, 
" +
                        " vars, description, simulated)" +
                        " VALUES (" + uniqueID + ", " +
-                       personID + ", " + sessionID + ", '" + type + "', " +
+                       personID + ", " + sessionID + ", \"" + type + "\", " +
                        cp1StartedIn + ", " + cp2StartedIn + ", " +
-                       cp3StartedIn + ", " + cp4StartedIn + ", '" +
-                       cp1InStr + "', '" + cp1OutStr + "', '" +
-                       cp2InStr + "', '" + cp2OutStr + "', '" +
-                       cp3InStr + "', '" + cp3OutStr + "', '" +
-                       cp4InStr + "', '" + cp4OutStr + "', '" +
-                       vars + "', '" +
-                       description + "', " + simulated + ")" ;
+                       cp3StartedIn + ", " + cp4StartedIn + ", \"" +
+                       cp1InStr + "\", \"" + cp1OutStr + "\", \"" +
+                       cp2InStr + "\", \"" + cp2OutStr + "\", \"" +
+                       cp3InStr + "\", \"" + cp3OutStr + "\", \"" +
+                       cp4InStr + "\", \"" + cp4OutStr + "\", \"" +
+                       vars + "\", \"" +
+                       description + "\", " + simulated + ")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
@@ -245,9 +245,9 @@ class SqliteMultiChronopic : Sqlite
        {
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.MultiChronopicTable + " SET personID = " + personID 
+ 
-                       ", vars = '" + vars +           //vars is distance on runAnalysis
-                       "', description = '" + description +
-                       "' WHERE uniqueID == " + eventID ;
+                       ", vars = \"" + vars +          //vars is distance on runAnalysis
+                       "\", description = \"" + description +
+                       "\" WHERE uniqueID == " + eventID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/oldConvert.cs b/src/sqlite/oldConvert.cs
index b8c9788..acde6e4 100644
--- a/src/sqlite/oldConvert.cs
+++ b/src/sqlite/oldConvert.cs
@@ -46,8 +46,8 @@ class SqliteOldConvert : Sqlite
        {
                dbcmd.CommandText = "SELECT eSignal.uniqueID, eCurve.videoURL " + 
                        "FROM encoder AS eSignal, encoder AS eCurve, encoderSignalCurve " + 
-                       "WHERE eSignal.signalOrCurve = 'signal' AND eCurve.signalOrCurve = 'curve' " + 
-                       "AND eSignal.videoURL = '' AND eCurve.videoURL != '' " + 
+                       "WHERE eSignal.signalOrCurve = \"signal\" AND eCurve.signalOrCurve = \"curve\" " + 
+                       "AND eSignal.videoURL = \"\" AND eCurve.videoURL != \"\" " + 
                        "AND encoderSignalCurve.signalID = eSignal.uniqueID " +
                        "AND encoderSignalCurve.curveID = eCurve.uniqueID";
 
@@ -65,7 +65,7 @@ class SqliteOldConvert : Sqlite
 
                foreach(IDName idname in idnamelist.l) 
                {
-                       dbcmd.CommandText = "UPDATE encoder SET videoURL = '" + idname.Name + "' " + 
+                       dbcmd.CommandText = "UPDATE encoder SET videoURL = \"" + idname.Name + "\" " + 
                                "WHERE uniqueID = " + idname.UniqueID.ToString();
                        LogB.SQL(dbcmd.CommandText.ToString());
                        dbcmd.ExecuteNonQuery();
@@ -90,8 +90,8 @@ class SqliteOldConvert : Sqlite
                //eg. dbcmd.CommandText = "UPDATE encoder SET videoURL = replace( videoURL, 
'/home/user/.local/share/Chronojump/', '' ) " + 
                //      "WHERE videoURL LIKE '/home/user/.local/share/Chronojump/%'";
 
-               dbcmd.CommandText = "UPDATE " + table + " SET " + column + " = replace( " + column + ", '" + 
parentDir + "', '' ) " + 
-                       "WHERE " + column + " LIKE '" + parentDir + "%'";
+               dbcmd.CommandText = "UPDATE " + table + " SET " + column + " = replace( " + column + ", \"" + 
parentDir + "\", \"\" ) " + 
+                       "WHERE " + column + " LIKE \"" + parentDir + "%\"";
 
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -110,19 +110,19 @@ class SqliteOldConvert : Sqlite
 
 
                //changes on jump table
-               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET type = 'slCMJleft' WHERE 
description LIKE '%Left%'";
+               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET type = \"slCMJleft\" WHERE 
description LIKE \"%Left%\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
-               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET type = 'slCMJright' WHERE 
description LIKE '%Right%'";
+               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET type = \"slCMJright\" WHERE 
description LIKE \"%Right%\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
-               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET description=replace(description, 
' Left', '')";
+               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET description=replace(description, 
\" Left\", \"\")";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
-               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET description=replace(description, 
' Right', '')";
+               dbcmd.CommandText = "UPDATE " + Constants.JumpTable + " SET description=replace(description, 
\" Right\", \"\")";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
        }
@@ -155,7 +155,7 @@ class SqliteOldConvert : Sqlite
                        if(signalOrCurve == "all")
                                selectStr = personIDStr + sessionIDStr;
                        else
-                               selectStr = personIDStr + sessionIDStr + " signalOrCurve = '" + signalOrCurve 
+ "'";
+                               selectStr = personIDStr + sessionIDStr + " signalOrCurve = \"" + 
signalOrCurve + "\"";
                }
 
                string andString = "";
@@ -164,7 +164,7 @@ class SqliteOldConvert : Sqlite
 
                string onlyActiveString = "";
                if(onlyActive)
-                       onlyActiveString = " AND " + Constants.EncoderTable + ".status = 'active' ";
+                       onlyActiveString = " AND " + Constants.EncoderTable + ".status = \"active\" ";
 
                dbcmd.CommandText = "SELECT " + 
                        Constants.EncoderTable + ".*, " + Constants.EncoderExerciseTable + ".name FROM " + 
@@ -302,7 +302,7 @@ class SqliteOldConvert : Sqlite
                        if(signalOrCurve == "all")
                                selectStr = personIDStr + sessionIDStr;
                        else
-                               selectStr = personIDStr + sessionIDStr + " signalOrCurve = '" + signalOrCurve 
+ "'";
+                               selectStr = personIDStr + sessionIDStr + " signalOrCurve = \"" + 
signalOrCurve + "\"";
                }
 
                string andString = "";
@@ -311,7 +311,7 @@ class SqliteOldConvert : Sqlite
 
                string onlyActiveString = "";
                if(onlyActive)
-                       onlyActiveString = " AND " + Constants.EncoderTable + ".future1 = 'active' ";
+                       onlyActiveString = " AND " + Constants.EncoderTable + ".future1 = \"active\" ";
 
                dbcmd.CommandText = "SELECT " + 
                        Constants.EncoderTable + ".*, " + Constants.EncoderExerciseTable + ".name FROM " + 
diff --git a/src/sqlite/person.cs b/src/sqlite/person.cs
index ae72c9a..c44bd26 100644
--- a/src/sqlite/person.cs
+++ b/src/sqlite/person.cs
@@ -66,9 +66,9 @@ class SqlitePerson : Sqlite
                //ATTENTION: if this changes, change the Person.ToSQLInsertString()
                // -----------------------
                string myString = "INSERT INTO " + Constants.PersonTable + 
-                       " (uniqueID, name, sex, dateBorn, race, countryID, description, future1, future2, 
serverUniqueID) VALUES (" + uniqueID + ", '" +
-                       name + "', '" + sex + "', '" + UtilDate.ToSql(dateBorn) + "', " + 
-                       race + ", " + countryID + ", '" + description + "', '', '', " + serverUniqueID + ")";
+                       " (uniqueID, name, sex, dateBorn, race, countryID, description, future1, future2, 
serverUniqueID) VALUES (" + uniqueID + ", \"" +
+                       name + "\", \"" + sex + "\", \"" + UtilDate.ToSql(dateBorn) + "\", " + 
+                       race + ", " + countryID + ", \"" + description + "\", \"\", \"\", " + serverUniqueID 
+ ")";
                
                dbcmd.CommandText = myString;
                LogB.SQL(dbcmd.CommandText.ToString());
@@ -213,7 +213,7 @@ class SqlitePerson : Sqlite
                if(inSession == -1) {
                        string nameLike = "";
                        if(searchFilterName != "")
-                               nameLike = " WHERE LOWER(" + tp + ".name) LIKE LOWER ('%" + searchFilterName 
+ "%') ";
+                               nameLike = " WHERE LOWER(" + tp + ".name) LIKE LOWER (\"%" + searchFilterName 
+ "%\") ";
 
                        dbcmd.CommandText = 
                                "SELECT * FROM " + tp + 
@@ -384,7 +384,7 @@ finishForeach:
                //EncS (encoder signal)
                dbcmd.CommandText = "SELECT sessionID, count(*) FROM " + Constants.EncoderTable + 
                       " WHERE personID == " + personID +
-                      " AND signalOrCurve == 'signal' " +
+                      " AND signalOrCurve == \"signal\" " +
                        " GROUP BY sessionID ORDER BY sessionID";
                LogB.SQL(dbcmd.CommandText.ToString());
                
@@ -397,7 +397,7 @@ finishForeach:
                //EncC (encoder curve)
                dbcmd.CommandText = "SELECT sessionID, count(*) FROM " + Constants.EncoderTable + 
                       " WHERE personID == " + personID +
-                      " AND signalOrCurve == 'curve' " +
+                      " AND signalOrCurve == \"curve\" " +
                        " GROUP BY sessionID ORDER BY sessionID";
                LogB.SQL(dbcmd.CommandText.ToString());
                
@@ -540,7 +540,7 @@ finishForeach:
        {
                Sqlite.Open();
                dbcmd.CommandText = "SELECT uniqueID FROM " + Constants.PersonTable +
-                       " WHERE LOWER(" + Constants.PersonTable + ".name) == LOWER('" + personName + "')" +
+                       " WHERE LOWER(" + Constants.PersonTable + ".name) == LOWER(\"" + personName + "\")" +
                        " AND uniqueID != " + uniqueID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                
@@ -566,13 +566,13 @@ finishForeach:
        {
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.PersonTable + 
-                       " SET name = '" + myPerson.Name + 
-                       "', sex = '" + myPerson.Sex +
-                       "', dateborn = '" + UtilDate.ToSql(myPerson.DateBorn) +
-                       "', race = " + myPerson.Race +
+                       " SET name = \"" + myPerson.Name + 
+                       "\", sex = \"" + myPerson.Sex +
+                       "\", dateborn = \"" + UtilDate.ToSql(myPerson.DateBorn) +
+                       "\", race = " + myPerson.Race +
                        ", countryID = " + myPerson.CountryID +
-                       ", description = '" + myPerson.Description +
-                       "', serverUniqueID = " + myPerson.ServerUniqueID +
+                       ", description = \"" + myPerson.Description +
+                       "\", serverUniqueID = " + myPerson.ServerUniqueID +
                        " WHERE uniqueID == " + myPerson.UniqueID;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index cdef5ac..a516ea2 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -71,8 +71,8 @@ class SqlitePersonSession : Sqlite
                        " VALUES ("
                        + uniqueID + ", " + personID + ", " + sessionID + ", " + 
                        Util.ConvertToPoint(height) + ", " + Util.ConvertToPoint(weight) + ", " +
-                       sportID + ", " + speciallityID + ", " + practice + ", '" + 
-                       comments + "', '', '')"; 
+                       sportID + ", " + speciallityID + ", " + practice + ", \"" + 
+                       comments + "\", \"\", \"\")"; 
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -151,8 +151,8 @@ class SqlitePersonSession : Sqlite
                        ", sportID = " + ps.SportID + 
                        ", speciallityID = " + ps.SpeciallityID + 
                        ", practice = " + ps.Practice + 
-                       ", comments = '" + ps.Comments + 
-                       "' WHERE uniqueID == " + ps.UniqueID;
+                       ", comments = \"" + ps.Comments + 
+                       "\" WHERE uniqueID == " + ps.UniqueID;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 23db08c..d764daa 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -113,8 +113,8 @@ class SqlitePreferences : Sqlite
        {
                //Sqlite.Open();
                mycmd.CommandText = "INSERT INTO " + Constants.PreferencesTable + 
-                       " (name, value) VALUES ('" + 
-                       myName + "', '" + myValue + "')" ;
+                       " (name, value) VALUES (\"" + 
+                       myName + "\", \"" + myValue + "\")" ;
                LogB.SQL(mycmd.CommandText.ToString());
                mycmd.ExecuteNonQuery();
                //Sqlite.Close();
@@ -126,8 +126,8 @@ class SqlitePreferences : Sqlite
                        Sqlite.Open();
 
                dbcmd.CommandText = "UPDATE " + Constants.PreferencesTable +
-                       " SET value = '" + myValue + 
-                       "' WHERE name == '" + myName + "'" ;
+                       " SET value = \"" + myValue + 
+                       "\" WHERE name == \"" + myName + "\"" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
@@ -147,7 +147,7 @@ class SqlitePreferences : Sqlite
                        Sqlite.Open();
 
                dbcmd.CommandText = "SELECT value FROM " + Constants.PreferencesTable + 
-                       " WHERE name == '" + myName + "'" ;
+                       " WHERE name == \"" + myName + "\"" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                
diff --git a/src/sqlite/pulse.cs b/src/sqlite/pulse.cs
index 08b8415..ef5716e 100644
--- a/src/sqlite/pulse.cs
+++ b/src/sqlite/pulse.cs
@@ -67,9 +67,9 @@ class SqlitePulse : Sqlite
 
                dbcmd.CommandText = "INSERT INTO " + tableName + 
                                " (uniqueID, personID, sessionID, type, fixedPulse, totalPulsesNum, 
timeString, description, simulated)" +
-                               " VALUES (" + uniqueID + ", " + personID + ", " + sessionID + ", '" + type + 
"', "
-                               + Util.ConvertToPoint(fixedPulse) + ", " + totalPulsesNum + ", '"
-                               + timeString + "', '" + description + "', " + simulated + ")" ;
+                               " VALUES (" + uniqueID + ", " + personID + ", " + sessionID + ", \"" + type + 
"\", "
+                               + Util.ConvertToPoint(fixedPulse) + ", " + totalPulsesNum + ", \""
+                               + timeString + "\", \"" + description + "\", " + simulated + ")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -172,8 +172,8 @@ class SqlitePulse : Sqlite
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.PulseTable + 
                        " SET personID = " + personID + 
-                       ", description = '" + description +
-                       "' WHERE uniqueID == " + pulseID ;
+                       ", description = \"" + description +
+                       "\" WHERE uniqueID == " + pulseID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/pulseType.cs b/src/sqlite/pulseType.cs
index c46d51b..c41db21 100644
--- a/src/sqlite/pulseType.cs
+++ b/src/sqlite/pulseType.cs
@@ -70,9 +70,9 @@ class SqlitePulseType : Sqlite
                }
                dbcmd.CommandText = "INSERT INTO " + Constants.PulseTypeTable +  
                                " (uniqueID, name, fixedPulse, totalPulsesNum, description)" +
-                               " VALUES (NULL, '"
-                               + myStr[0] + "', " + myStr[1] + ", " +  //name, fixedPulse
-                               myStr[2] + ", '" + myStr[3] + "')" ;    //totalPulsesNum, description
+                               " VALUES (NULL, \""
+                               + myStr[0] + "\", " + myStr[1] + ", " + //name, fixedPulse
+                               myStr[2] + ", \"" + myStr[3] + "\")" ;  //totalPulsesNum, description
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                if(! dbconOpened) {
@@ -142,8 +142,8 @@ class SqlitePulseType : Sqlite
                Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.PulseTypeTable +
-                       " WHERE name  = '" + typeName +
-                       "' ORDER BY uniqueID";
+                       " WHERE name  = \"" + typeName +
+                       "\" ORDER BY uniqueID";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
diff --git a/src/sqlite/reactionTime.cs b/src/sqlite/reactionTime.cs
index 0dc916a..e665f86 100644
--- a/src/sqlite/reactionTime.cs
+++ b/src/sqlite/reactionTime.cs
@@ -66,8 +66,8 @@ class SqliteReactionTime : Sqlite
                dbcmd.CommandText = "INSERT INTO " + tableName +  
                                " (uniqueID, personID, sessionID, type, time, description, simulated)" +
                                " VALUES (" + uniqueID + ", "
-                               + personID + ", " + sessionID + ", '" + type + "', "
-                               + Util.ConvertToPoint(time) + ", '" + description + "', " + simulated + ")" ;
+                               + personID + ", " + sessionID + ", \"" + type + "\", "
+                               + Util.ConvertToPoint(time) + ", \"" + description + "\", " + simulated + ")" 
;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -167,10 +167,10 @@ class SqliteReactionTime : Sqlite
        {
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.ReactionTimeTable + " SET personID = " + personID + 
-                       ", type = '" + type +
-                       "', time = " + Util.ConvertToPoint(time) +
-                       ", description = '" + description +
-                       "' WHERE uniqueID == " + eventID ;
+                       ", type = \"" + type +
+                       "\", time = " + Util.ConvertToPoint(time) +
+                       ", description = \"" + description +
+                       "\" WHERE uniqueID == " + eventID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/run.cs b/src/sqlite/run.cs
index 53cf84c..74a54b3 100644
--- a/src/sqlite/run.cs
+++ b/src/sqlite/run.cs
@@ -68,9 +68,9 @@ class SqliteRun : Sqlite
                dbcmd.CommandText = "INSERT INTO " + tableName + 
                                " (uniqueID, personID, sessionID, type, distance, time, description, 
simulated, initialSpeed)" +
                                " VALUES (" + uniqueID + ", " +
-                               + personID + ", " + sessionID + ", '" + type + "', "
-                               + Util.ConvertToPoint(distance) + ", " + Util.ConvertToPoint(time) + ", '" + 
-                               description + "', " + simulated + ", " + Util.BoolToInt(initialSpeed) + ")" ;
+                               + personID + ", " + sessionID + ", \"" + type + "\", "
+                               + Util.ConvertToPoint(distance) + ", " + Util.ConvertToPoint(time) + ", \"" + 
+                               description + "\", " + simulated + ", " + Util.BoolToInt(initialSpeed) + ")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -106,7 +106,7 @@ class SqliteRun : Sqlite
 
                string filterTypeString = "";
                if(filterType != "")
-                       filterTypeString = " AND run.type == '" + filterType + "' " ;
+                       filterTypeString = " AND run.type == \"" + filterType + "\" " ;
 
                dbcmd.CommandText = "SELECT " + tp + ".name, run.* " +
                        " FROM " + tp + ", run " +
@@ -184,11 +184,11 @@ class SqliteRun : Sqlite
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.RunTable + 
                        " SET personID = " + personID + 
-                       ", type = '" + type +
-                       "', distance = " + Util.ConvertToPoint(Convert.ToDouble(distance)) + 
+                       ", type = \"" + type +
+                       "\", distance = " + Util.ConvertToPoint(Convert.ToDouble(distance)) + 
                        ", time = " + Util.ConvertToPoint(Convert.ToDouble(time)) + 
-                       ", description = '" + description +
-                       "' WHERE uniqueID == " + runID ;
+                       ", description = \"" + description +
+                       "\" WHERE uniqueID == " + runID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/runInterval.cs b/src/sqlite/runInterval.cs
index d872069..a89fb20 100644
--- a/src/sqlite/runInterval.cs
+++ b/src/sqlite/runInterval.cs
@@ -65,13 +65,13 @@ class SqliteRunInterval : SqliteRun
                dbcmd.CommandText = "INSERT INTO "+ tableName + 
                                " (uniqueID, personID, sessionID, type, distanceTotal, timeTotal, 
distanceInterval, intervalTimesString, tracks, description, limited, simulated, initialSpeed)" +
                                "VALUES (" + uniqueID + ", " +
-                               personID + ", " + sessionID + ", '" + type + "', " +
+                               personID + ", " + sessionID + ", \"" + type + "\", " +
                                Util.ConvertToPoint(distanceTotal) + ", " + 
                                Util.ConvertToPoint(timeTotal) + ", " + 
-                               Util.ConvertToPoint(distanceInterval) + ", '" + 
-                               Util.ConvertToPoint(intervalTimesString) + "', " +
-                               Util.ConvertToPoint(tracks) + ", '" + 
-                               description + "', '" + limited + "', " + simulated + ", " +
+                               Util.ConvertToPoint(distanceInterval) + ", \"" + 
+                               Util.ConvertToPoint(intervalTimesString) + "\", " +
+                               Util.ConvertToPoint(tracks) + ", \"" + 
+                               description + "\", \"" + limited + "\", " + simulated + ", " +
                                Util.BoolToInt(initialSpeed) + ")" ;
                                
                LogB.SQL(dbcmd.CommandText.ToString());
@@ -106,7 +106,7 @@ class SqliteRunInterval : SqliteRun
 
                string filterTypeString = "";
                if(filterType != "")
-                       filterTypeString = " AND runInterval.type == '" + filterType + "' " ;
+                       filterTypeString = " AND runInterval.type == \"" + filterType + "\" " ;
 
                dbcmd.CommandText = "SELECT " + tp + ".name, runInterval.* " +
                        " FROM " + tp + ", runInterval " +
@@ -189,8 +189,8 @@ class SqliteRunInterval : SqliteRun
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.RunIntervalTable +
                        " SET personID = " + personID + 
-                       ", description = '" + description +
-                       "' WHERE uniqueID == " + runID ;
+                       ", description = \"" + description +
+                       "\" WHERE uniqueID == " + runID ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/runType.cs b/src/sqlite/runType.cs
index 092efdb..866a7e2 100644
--- a/src/sqlite/runType.cs
+++ b/src/sqlite/runType.cs
@@ -122,12 +122,12 @@ class SqliteRunType : Sqlite
                }
                mycmd.CommandText = "INSERT INTO " + tableName + 
                                " (uniqueID, name, distance, description)" +
-                               " VALUES (NULL, '" +
+                               " VALUES (NULL, \"" +
                                /*
-                               myStr[0] + "', " + myStr[1] + ", '" +   //name, distance
-                               myStr[2] + "')" ;       //description
+                               myStr[0] + "\", " + myStr[1] + ", \"" + //name, distance
+                               myStr[2] + "\")" ;      //description
                                */
-                               t.Name + "', " + Util.ConvertToPoint(t.Distance) + ", '" + t.Description +    
  "')" ;  
+                               t.Name + "\", " + Util.ConvertToPoint(t.Distance) + ", \"" + t.Description +  
  "\")" ; 
                LogB.SQL(mycmd.CommandText.ToString());
                mycmd.ExecuteNonQuery();
 
@@ -149,8 +149,8 @@ class SqliteRunType : Sqlite
                        Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.RunTypeTable +
-                       " WHERE name  = '" + typeName +
-                       "' ORDER BY uniqueID";
+                       " WHERE name  = \"" + typeName +
+                       "\" ORDER BY uniqueID";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -239,7 +239,7 @@ class SqliteRunType : Sqlite
                Sqlite.Open();
                dbcmd.CommandText = "SELECT distance " +
                        " FROM " + Constants.RunTypeTable +
-                       " WHERE name == '" + typeName + "'";
+                       " WHERE name == \"" + typeName + "\"";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -298,7 +298,7 @@ class SqliteRunType : Sqlite
        {
                Sqlite.Open();
                dbcmd.CommandText = "Delete FROM " + Constants.RunTypeTable +
-                       " WHERE name == '" + name + "'";
+                       " WHERE name == \"" + name + "\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
@@ -443,9 +443,9 @@ class SqliteRunIntervalType : SqliteRunType
                }
                mycmd.CommandText = "INSERT INTO " + tableName + 
                                " (uniqueID, name, distance, tracksLimited, fixedValue, unlimited, 
description, distancesString)" +
-                               " VALUES (NULL, '" +
-                               t.Name +        "', " + t.Distance + ", " + Util.BoolToInt(t.TracksLimited) + 
  ", " + t.FixedValue + ", " +
-                               Util.BoolToInt(t.Unlimited) +   ", '" + t.Description + "', '" + 
t.DistancesString +    "')" ;  
+                               " VALUES (NULL, \"" +
+                               t.Name +        "\", " + t.Distance + ", " + Util.BoolToInt(t.TracksLimited) 
+  ", " + t.FixedValue + ", " +
+                               Util.BoolToInt(t.Unlimited) +   ", \"" + t.Description +        "\", \"" + 
t.DistancesString +  "\")" ; 
                LogB.SQL(mycmd.CommandText.ToString());
                mycmd.ExecuteNonQuery();
                
@@ -522,8 +522,8 @@ class SqliteRunIntervalType : SqliteRunType
                        Sqlite.Open();
                dbcmd.CommandText = "SELECT * " +
                        " FROM " + Constants.RunIntervalTypeTable +
-                       " WHERE name  = '" + typeName +
-                       "' ORDER BY uniqueID";
+                       " WHERE name  = \"" + typeName +
+                       "\" ORDER BY uniqueID";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -581,7 +581,7 @@ class SqliteRunIntervalType : SqliteRunType
        {
                Sqlite.Open();
                dbcmd.CommandText = "Delete FROM " + Constants.RunIntervalTypeTable +
-                       " WHERE name == '" + name + "'";
+                       " WHERE name == \"" + name + "\"";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
diff --git a/src/sqlite/server.cs b/src/sqlite/server.cs
index 20866eb..91cf963 100644
--- a/src/sqlite/server.cs
+++ b/src/sqlite/server.cs
@@ -73,9 +73,9 @@ class SqliteServer : Sqlite
 
                string myString = "INSERT INTO " + Constants.ServerPingTable + 
                        " (uniqueID, evaluatorID, cjVersion, osVersion, IP, date) VALUES (" + 
-                       uniqueID + ", " + evaluatorID + ", '" + 
-                       cjVersion + "', '" + osVersion + "', '" +
-                       ip + "', '" + UtilDate.ToSql(date) + "')" ;
+                       uniqueID + ", " + evaluatorID + ", \"" + 
+                       cjVersion + "\", \"" + osVersion + "\", \"" +
+                       ip + "\", \"" + UtilDate.ToSql(date) + "\")" ;
                
                dbcmd.CommandText = myString;
                
@@ -105,11 +105,11 @@ class SqliteServer : Sqlite
 
                string myString = "INSERT INTO " + Constants.ServerEvaluatorTable + 
                        " (uniqueID, code, name, email, dateBorn, countryID, chronometer, device, comments, 
confiable) VALUES (" + 
-                       uniqueID + ", '" + 
-                       code + "', '" + name + "', '" + 
-                       email + "', '" + UtilDate.ToSql(dateBorn) + "', " +
-                       countryID + ", '" + chronometer + "', '" + 
-                       device + "', '" + comments + "', " +
+                       uniqueID + ", \"" + 
+                       code + "\", \"" + name + "\", \"" + 
+                       email + "\", \"" + UtilDate.ToSql(dateBorn) + "\", " +
+                       countryID + ", \"" + chronometer + "\", \"" + 
+                       device + "\", \"" + comments + "\", " +
                        //Util.BoolToInt(confiable) + 
                        Util.BoolToInt(false) + //security: cannot directly insert a confiable person
                        ")" ;
@@ -139,16 +139,16 @@ class SqliteServer : Sqlite
                if(! dbconOpened)
                        Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.ServerEvaluatorTable + " " +
-                       " SET code = '" + code +
-                       "' , name = '" + name +
-                       "' , email = '" + email +
-                       "' , dateBorn = '" + UtilDate.ToSql(dateBorn) +
-                       "' , countryID = " + countryID +
-                       ", chronometer = '" + chronometer +
-                       "', device = '" + device +
-                       "', comments = '" + comments +
-                       //"', confiable = " + Util.BoolToInt(confiable) + //security: update cannot change 
confiable
-                       "' WHERE uniqueID == " + uniqueID;
+                       " SET code = \"" + code +
+                       "\" , name = \"" + name +
+                       "\" , email = \"" + email +
+                       "\" , dateBorn = \"" + UtilDate.ToSql(dateBorn) +
+                       "\" , countryID = " + countryID +
+                       ", chronometer = \"" + chronometer +
+                       "\", device = \"" + device +
+                       "\", comments = \"" + comments +
+                       //"\", confiable = " + Util.BoolToInt(confiable) + //security: update cannot change 
confiable
+                       "\" WHERE uniqueID == " + uniqueID;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index a380567..63d16df 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -62,10 +62,10 @@ class SqliteSession : Sqlite
                        uniqueID = "NULL";
 
                dbcmd.CommandText = "INSERT INTO " + tableName + " (uniqueID, name, place, date, 
personsSportID, personsSpeciallityID, personsPractice, comments, serverUniqueID)" +
-                       " VALUES (" + uniqueID + ", '"
-                       + name + "', '" + place + "', '" + UtilDate.ToSql(date) + "', " + 
+                       " VALUES (" + uniqueID + ", \""
+                       + name + "\", \"" + place + "\", \"" + UtilDate.ToSql(date) + "\", " + 
                        personsSportID + ", " + personsSpeciallityID + ", " + 
-                       personsPractice + ", '" + comments + "', " +
+                       personsPractice + ", \"" + comments + "\", " +
                        serverUniqueID + ")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -87,14 +87,14 @@ class SqliteSession : Sqlite
                //TODO: serverUniqueID (but cannot be changed in gui/edit, then not need now)
                Sqlite.Open();
                dbcmd.CommandText = "UPDATE " + Constants.SessionTable + " " +
-                       " SET name = '" + name +
-                       "' , date = '" + UtilDate.ToSql(date) +
-                       "' , place = '" + place +
-                       "' , personsSportID = " + personsSportID +
+                       " SET name = \"" + name +
+                       "\" , date = \"" + UtilDate.ToSql(date) +
+                       "\" , place = \"" + place +
+                       "\" , personsSportID = " + personsSportID +
                        ", personsSpeciallityID = " + personsSpeciallityID +
                        ", personsPractice = " + personsPractice +
-                       ", comments = '" + comments +
-                       "' WHERE uniqueID == " + uniqueID;
+                       ", comments = \"" + comments +
+                       "\" WHERE uniqueID == " + uniqueID;
                dbcmd.ExecuteNonQuery();
                Sqlite.Close();
        }
@@ -119,7 +119,7 @@ class SqliteSession : Sqlite
        //be careful because name is not unique
        public static Session SelectByName(string name)
        {
-               dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE name == '" + name + 
"'"; 
+               dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE name == \"" + name + 
"\""; 
                return SelectDo(dbcmd);
        }
        //by ID (default
@@ -225,7 +225,7 @@ class SqliteSession : Sqlite
 
                string filterNameString = "";
                if(filterName != "")
-                       filterNameString = " AND LOWER(session.name) LIKE LOWER ('%" + filterName  + "%') ";
+                       filterNameString = " AND LOWER(session.name) LIKE LOWER (\"%" + filterName  + "%\") ";
 
                dbcmd.CommandText = 
                        "SELECT session.*, sport.name, speciallity.name" +
@@ -392,7 +392,7 @@ class SqliteSession : Sqlite
        
                //select encoder signal of each session
                dbcmd.CommandText = "SELECT sessionID, count(*) FROM " + Constants.EncoderTable + 
-                       " WHERE signalOrCurve == 'signal' GROUP BY sessionID ORDER BY sessionID";
+                       " WHERE signalOrCurve == \"signal\" GROUP BY sessionID ORDER BY sessionID";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -407,7 +407,7 @@ class SqliteSession : Sqlite
        
                //select encoder curve of each session
                dbcmd.CommandText = "SELECT sessionID, count(*) FROM " + Constants.EncoderTable + 
-                       " WHERE signalOrCurve == 'curve' GROUP BY sessionID ORDER BY sessionID";
+                       " WHERE signalOrCurve == \"curve\" GROUP BY sessionID ORDER BY sessionID";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -570,7 +570,7 @@ class SqliteSession : Sqlite
                dbcmd.CommandText = "SELECT AVG(" + valueToSelect + ")" +
                        " FROM " + table +                              
                        " WHERE sessionID == " + sessionID + 
-                       " AND type == '" + type + "' " +
+                       " AND type == \"" + type + "\" " +
                        personIDString; 
                
                LogB.SQL(dbcmd.CommandText.ToString());
@@ -719,13 +719,13 @@ class SqliteServerSession : SqliteSession
                string uniqueID = "NULL";
 
                dbcmd.CommandText = "INSERT INTO " + tableName + " (uniqueID, name, place, date, 
personsSportID, personsSpeciallityID, personsPractice, comments, serverUniqueID, evaluatorID, 
evaluatorCJVersion, evaluatorOS, uploadedDate, uploadingState)" +
-                       " VALUES (" + uniqueID + ", '"
-                       + name + "', '" + place + "', '" + UtilDate.ToSql(date) + "', " + 
+                       " VALUES (" + uniqueID + ", \""
+                       + name + "\", \"" + place + "\", \"" + UtilDate.ToSql(date) + "\", " + 
                        personsSportID + ", " + personsSpeciallityID + ", " + 
-                       personsPractice + ", '" + comments + "', " +
-                       serverUniqueID + ", " + evaluatorID + ", '" +
-                       evaluatorCJVersion + "', '" + evaluatorOS + "', '" +
-                       UtilDate.ToSql(uploadedDate) + "', " + uploadingState +
+                       personsPractice + ", \"" + comments + "\", " +
+                       serverUniqueID + ", " + evaluatorID + ", \"" +
+                       evaluatorCJVersion + "\", \"" + evaluatorOS + "\", \"" +
+                       UtilDate.ToSql(uploadedDate) + "\", " + uploadingState +
                        ")" ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
diff --git a/src/sqlite/speciallity.cs b/src/sqlite/speciallity.cs
index 64431b8..cb3a301 100644
--- a/src/sqlite/speciallity.cs
+++ b/src/sqlite/speciallity.cs
@@ -71,7 +71,7 @@ class SqliteSpeciallity : Sqlite
                        Sqlite.Open();
 
                string myString = "INSERT INTO " + Constants.SpeciallityTable + 
-                       " (uniqueID, sportID, name) VALUES (NULL, " + sportID + ", '" + speciallityName + 
"')"; 
+                       " (uniqueID, sportID, name) VALUES (NULL, " + sportID + ", \"" + speciallityName + 
"\")"; 
                
                mycmd.CommandText = myString;
                LogB.SQL(mycmd.CommandText.ToString());
diff --git a/src/sqlite/sport.cs b/src/sqlite/sport.cs
index 8ca2417..c55e5ce 100644
--- a/src/sqlite/sport.cs
+++ b/src/sqlite/sport.cs
@@ -83,8 +83,8 @@ class SqliteSport : Sqlite
                        uniqueID = "NULL";
 
                string myString = "INSERT INTO " + Constants.SportTable + 
-                       " (uniqueID, name, userDefined, hasSpeciallities, graphLink) VALUES (" + uniqueID + 
", '" + name + "', " + 
-                       Util.BoolToInt(userDefined) + ", " + Util.BoolToInt(hasSpeciallities) + ", '" + 
graphLink + "')";
+                       " (uniqueID, name, userDefined, hasSpeciallities, graphLink) VALUES (" + uniqueID + 
", \"" + name + "\", " + 
+                       Util.BoolToInt(userDefined) + ", " + Util.BoolToInt(hasSpeciallities) + ", \"" + 
graphLink + "\")";
                
                mycmd.CommandText = myString;
                LogB.SQL(mycmd.CommandText.ToString());
@@ -137,7 +137,7 @@ class SqliteSport : Sqlite
        {
                //Sqlite.Open();
                
-               dbcmd.CommandText = "SELECT uniqueID FROM " + Constants.SportTable + " WHERE name == '" + 
name + "'";
+               dbcmd.CommandText = "SELECT uniqueID FROM " + Constants.SportTable + " WHERE name == \"" + 
name + "\"";
                
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
diff --git a/src/sqlite/stat.cs b/src/sqlite/stat.cs
index d8bf9eb..98ae8d9 100644
--- a/src/sqlite/stat.cs
+++ b/src/sqlite/stat.cs
@@ -50,7 +50,7 @@ class SqliteStat : Sqlite
                moreSelect = ini + "jump.tv" + end;
                
                string fromString = " FROM jump, " + tp + " ";
-               string jumpTypeString = " AND jump.type == '" + jumpType + "' ";
+               string jumpTypeString = " AND jump.type == \"" + jumpType + "\" ";
 
                //if we use AVG or MAX, then we have to group by the results
                //if there's more than one session, it sends the avg or max
@@ -135,7 +135,7 @@ class SqliteStat : Sqlite
 
                //manage allJumps
                string fromString = " FROM jump, " + tp + ", " + tps + " ";
-               string jumpTypeString = " AND jump.type == '" + jumpType + "' ";
+               string jumpTypeString = " AND jump.type == \"" + jumpType + "\" ";
                if(jumpType == Constants.AllJumpsName) {
                        moreSelect = moreSelect + ", jump.type ";
                        fromString = " FROM jump, " + tp + ", " + tps + ", jumpType ";
@@ -296,7 +296,7 @@ class SqliteStat : Sqlite
                
                //manage allJumps
                string fromString = " FROM jump, " + tp + sep + tps + " ";
-               string jumpTypeString = " AND jump.type == '" + jumpType + "' ";
+               string jumpTypeString = " AND jump.type == \"" + jumpType + "\" ";
                if(jumpType == Constants.AllJumpsName) {
                        moreSelect = moreSelect + ", jump.type ";
                        fromString = " FROM jump, " + tp + sep + tps + ", jumpType ";
@@ -403,7 +403,7 @@ class SqliteStat : Sqlite
 
                //manage allJumps
                string fromString = " FROM jumpRj, " + tp + " ";
-               string jumpTypeString = " AND jumpRj.type == '" + jumpType + "' ";
+               string jumpTypeString = " AND jumpRj.type == \"" + jumpType + "\" ";
                if(jumpType == Constants.AllJumpsName) {
                        moreSelect = moreSelect + ", jumpRj.type ";
                        fromString = " FROM jumpRj, " + tp + ", jumpRjType ";
@@ -500,7 +500,7 @@ class SqliteStat : Sqlite
 
                //manage allJumps
                string fromString = " FROM jumpRj, " + tp + " ";
-               string jumpTypeString = " AND jumpRj.type == '" + jumpType + "' ";
+               string jumpTypeString = " AND jumpRj.type == \"" + jumpType + "\" ";
                if(jumpType == Constants.AllJumpsName) {
                        moreSelect = moreSelect + ", jumpRj.type ";
                        fromString = " FROM jumpRj, " + tp + ", jumpRjType ";
@@ -686,7 +686,7 @@ class SqliteStat : Sqlite
 
                //manage allJumps
                string fromString = " FROM jumpRj, " + tp + " ";
-               string jumpTypeString = " AND jumpRj.type == '" + jumpType + "' ";
+               string jumpTypeString = " AND jumpRj.type == \"" + jumpType + "\" ";
                if(jumpType == Constants.AllJumpsName) {
                        moreSelect = moreSelect + ", jumpRj.type ";
                        fromString = " FROM jumpRj, " + tp + ", jumpRjType ";
@@ -793,7 +793,7 @@ class SqliteStat : Sqlite
                //manage allRuns
                string fromString = " FROM " + Constants.RunIntervalTable + ", " + 
                        tp + ", " + Constants.RunIntervalTypeTable + " ";
-               string runTypeString = " AND " + Constants.RunIntervalTable + ".type == '" + runType + "' ";
+               string runTypeString = " AND " + Constants.RunIntervalTable + ".type == \"" + runType + "\" ";
                if(runType == Constants.AllRunsName) {
                        moreSelect = moreSelect + ", " + Constants.RunIntervalTable + ".type ";
                        runTypeString = ""; 
@@ -911,8 +911,8 @@ LogB.SQL(intervalSpeeds);
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, j1.sessionID, " + moreSelect +
                        " FROM jump AS j1, jump AS j2, " + tp + " " +
                        sessionString +
-                       " AND j1.type == '" + jump1 + "' " +
-                       " AND j2.type == '" + jump2 + "' " +
+                       " AND j1.type == \"" + jump1 + "\" " +
+                       " AND j2.type == \"" + jump2 + "\" " +
                        " AND j1.personID == " + tp + ".uniqueID " +
                        " AND j2.personID == " + tp + ".uniqueID " +
                        groupByString +
@@ -988,8 +988,8 @@ LogB.SQL(intervalSpeeds);
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, j1.sessionID, " + moreSelect +
                        " FROM jump AS j1, jump AS j2, " + tp + " " +
                        sessionString +
-                       " AND j1.type == '" + jump1 + "' " +
-                       " AND j2.type == '" + jump2 + "' " +
+                       " AND j1.type == \"" + jump1 + "\" " +
+                       " AND j2.type == \"" + jump2 + "\" " +
                        " AND j1.personID == " + tp + ".uniqueID " +
                        " AND j2.personID == " + tp + ".uniqueID " +
                        groupByString +
@@ -1066,8 +1066,8 @@ LogB.SQL(intervalSpeeds);
                dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, j1.sessionID, " + moreSelect +
                        " FROM jump AS j1, jump AS j2, " + tp + " " +
                        sessionString +
-                       " AND j1.type == '" + jump1 + "' " +
-                       " AND j2.type == '" + jump2 + "' " +
+                       " AND j1.type == \"" + jump1 + "\" " +
+                       " AND j2.type == \"" + jump2 + "\" " +
                        //weight of SJ+ jump is 100% or equals de person weight
                        //the || is "the || concatenation operator which gives a string result." 
                        //http://sqlite.org/lang_expr.html
@@ -1202,7 +1202,7 @@ LogB.SQL(intervalSpeeds);
                //TODO: check if ini,end is needed here
 
                string fromString = " FROM jump, " + tp + ", " + tps + " ";
-               string jumpTypeString = " AND jump.type == '" + jumpType + "' ";
+               string jumpTypeString = " AND jump.type == \"" + jumpType + "\" ";
 
 
                //if we use AVG or MAX, then we have to group by the results
@@ -1310,7 +1310,7 @@ LogB.SQL(intervalSpeeds);
                moreSelect = ini + "run.distance / run.time" + end + " AS speed, " + ini + "run.distance" + 
end + ", " + ini + "run.time" + end;
                
                string fromString = " FROM run, " + tp + " ";
-               string runTypeString = " AND run.type == '" + runType + "' ";
+               string runTypeString = " AND run.type == \"" + runType + "\" ";
                if(runType == Constants.AllRunsName) {
                        moreSelect = moreSelect + ", run.type ";
                        fromString = " FROM run, " + tp + ", runType ";
@@ -1403,13 +1403,13 @@ LogB.SQL(intervalSpeeds);
                IDDoubleList listFMax = fillIDDoubleList( 
                                "SELECT personID, MAX(jump.tv * jump.tv * 1.226) " +
                                " FROM jump " +
-                               " WHERE type == 'SJl' AND jump.weight == 100 " +
+                               " WHERE type == \"SJl\" AND jump.weight == 100 " +
                                " AND sessionID == " + sessionID + " GROUP BY personID");
        
                IDDoubleList listFExpl = fillIDDoubleList( 
                                "SELECT j1.personID, MAX(j1.tv * j1.tv * 1.226) - MAX(j2.tv * j2.tv * 1.226) 
AS myIndex " +
                                " FROM jump AS j1, jump AS j2 " +
-                               " WHERE j1.type == 'SJ' AND j2.type == 'SJl' AND j2.weight=100 " +
+                               " WHERE j1.type == \"SJ\" AND j2.type == \"SJl\" AND j2.weight=100 " +
                                " AND j1.personID == j2.personID " +
                                " AND j1.sessionID == " + sessionID + " AND j2.sessionID == " + sessionID + 
                                " GROUP BY j1.personID");
@@ -1417,7 +1417,7 @@ LogB.SQL(intervalSpeeds);
                IDDoubleList listCElast = fillIDDoubleList( 
                                "SELECT j1.personID, MAX(j1.tv * j1.tv * 1.226) - MAX(j2.tv * j2.tv * 1.226) 
AS myIndex " +
                                " FROM jump AS j1, jump AS j2 " +
-                               " WHERE j1.type == 'CMJ' AND j2.type == 'SJ' " +
+                               " WHERE j1.type == \"CMJ\" AND j2.type == \"SJ\" " +
                                " AND j1.personID == j2.personID " +
                                " AND j1.sessionID == " + sessionID + " AND j2.sessionID == " + sessionID + 
                                " GROUP BY j1.personID");
@@ -1425,14 +1425,14 @@ LogB.SQL(intervalSpeeds);
                IDDoubleList listCArms = fillIDDoubleList( 
                                "SELECT j1.personID, MAX(j1.tv * j1.tv * 1.226) - MAX(j2.tv * j2.tv * 1.226) 
AS myIndex " +
                                " FROM jump AS j1, jump AS j2 " +
-                               " WHERE j1.type == 'ABK' AND j2.type == 'CMJ' " +
+                               " WHERE j1.type == \"ABK\" AND j2.type == \"CMJ\" " +
                                " AND j1.personID == j2.personID " +
                                " AND j1.sessionID == " + sessionID + " AND j2.sessionID == " + sessionID + 
                                " GROUP BY j1.personID");
 
                IDDoubleList listFReact = fillIDDoubleList( 
                                "SELECT personID, MAX(jump.tv * jump.tv * 1.226) " +
-                               " FROM jump WHERE type == 'DJa' " +
+                               " FROM jump WHERE type == \"DJa\" " +
                                " AND sessionID == " + sessionID + " GROUP BY personID");
        
                


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