[chronojump] DB 1.60 UploadExhibitionTestTemp
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] DB 1.60 UploadExhibitionTestTemp
- Date: Mon, 25 Feb 2019 10:22:01 +0000 (UTC)
commit 3aa6bfb5de47054dcab2f6b97a1c2161e90b08ae
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Feb 25 11:21:01 2019 +0100
DB 1.60 UploadExhibitionTestTemp
src/chronojump.cs | 2 +-
src/constants.cs | 3 ++-
src/gui/exhibition.cs | 3 +--
src/json.cs | 12 +++++++++++-
src/sqlite/json.cs | 31 +++++++++++++++++++++++++++++++
src/sqlite/main.cs | 14 ++++++++++++--
6 files changed, 58 insertions(+), 7 deletions(-)
---
diff --git a/src/chronojump.cs b/src/chronojump.cs
index d990e7d6..b25dfce5 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2017 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2019 Xavier de Blas <xaviblas gmail com>
*/
diff --git a/src/constants.cs b/src/constants.cs
index 8d9958bd..f6749108 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2017 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2019 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -176,6 +176,7 @@ public class Constants
//json temp tables
public const string UploadEncoderDataTempTable = "uploadEncoderDataTemp";
public const string UploadSprintDataTempTable = "uploadSprintDataTemp";
+ public const string UploadExhibitionTestTempTable = "uploadExhibitionTestTemp";
public const string UndefinedDefault = "Undefined";
public const string Any = "Any";
diff --git a/src/gui/exhibition.cs b/src/gui/exhibition.cs
index 2249b837..b0a0da6f 100644
--- a/src/gui/exhibition.cs
+++ b/src/gui/exhibition.cs
@@ -144,8 +144,7 @@ public partial class ChronoJumpWindow
if( ! js.UploadExhibitionTest (et))
{
LogB.Error(js.ResultMessage);
- //TODO
- //SqliteJson.InsertTempExhibitionTest(false, et); //insert only if could'nt be
uploaded
+ SqliteJson.InsertTempExhibitionTest(false, et); //insert only if could'nt be uploaded
}
}
diff --git a/src/json.cs b/src/json.cs
index c7e815f2..12b88b60 100644
--- a/src/json.cs
+++ b/src/json.cs
@@ -933,7 +933,7 @@ public class Json
}
//table created with:
- //CREATE TABLE exhibitionTest(dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, sessionID INT NOT NULL,
personID INT NOT NULL, testType CHAR(10), result DOUBLE);
+ //CREATE TABLE exhibitionTest(dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, schoolID INT NOT NULL, groupID
INT NOT NULL, personID INT NOT NULL, testType CHAR(10), result DOUBLE);
public bool UploadExhibitionTest(ExhibitionTest et)
{
// Create a request using a URL that can receive a post.
@@ -1420,6 +1420,16 @@ public class ExhibitionTest
this.result = result;
}
+ public string ToSQLTempInsertString()
+ {
+ return
+ schoolID.ToString() + ", " +
+ groupID.ToString() + ", " +
+ personID.ToString() + ", \"" +
+ testType.ToString() + "\", " +
+ resultToJson;
+ }
+
//convert to decimal point and str
public string resultToJson {
get { return Util.ConvertToPoint(result); }
diff --git a/src/sqlite/json.cs b/src/sqlite/json.cs
index 4576a126..ab6af0e8 100644
--- a/src/sqlite/json.cs
+++ b/src/sqlite/json.cs
@@ -26,6 +26,7 @@ class SqliteJson : Sqlite
{
private static string tableEncoder = Constants.UploadEncoderDataTempTable;
private static string tableSprint = Constants.UploadSprintDataTempTable;
+ private static string tableExhibitionTest = Constants.UploadExhibitionTestTempTable;
public SqliteJson() {
}
@@ -229,5 +230,35 @@ class SqliteJson : Sqlite
closeIfNeeded(dbconOpened);
}
+ /*
+ * EXHIBITION //right now does not upload to server when connection returns
+ */
+
+ protected internal static void createTableUploadExhibitionTestTemp()
+ {
+ dbcmd.CommandText =
+ "CREATE TABLE " + tableExhibitionTest + " (" +
+ "schoolID INT, " +
+ "groupID INT, " +
+ "personID INT, " +
+ "testType TEXT, " +
+ "result DOUBLE)";
+ dbcmd.ExecuteNonQuery();
+ }
+
+ public static void InsertTempExhibitionTest (bool dbconOpened, ExhibitionTest et)
+ {
+ openIfNeeded(dbconOpened);
+
+ dbcmd.CommandText = "INSERT INTO " + tableExhibitionTest +
+ " (schoolID, groupID, personID, testType, result) VALUES (" +
+ et.ToSQLTempInsertString() + ")";
+ LogB.SQL(dbcmd.CommandText.ToString());
+
+ dbcmd.ExecuteNonQuery();
+
+ closeIfNeeded(dbconOpened);
+ }
+
}
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 0d3ba8f5..6d38e6f7 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2017 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2019 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -125,7 +125,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
- static string lastChronojumpDatabaseVersion = "1.59";
+ static string lastChronojumpDatabaseVersion = "1.60";
public Sqlite() {
}
@@ -2362,6 +2362,14 @@ class Sqlite
currentVersion = updateVersion("1.59");
}
+ if(currentVersion == "1.59")
+ {
+ LogB.SQL("Created table UploadExhibitionTestTemp");
+
+ SqliteJson.createTableUploadExhibitionTestTemp ();
+
+ currentVersion = updateVersion("1.60");
+ }
@@ -2548,8 +2556,10 @@ class Sqlite
//compujump json temp tables
SqliteJson.createTableUploadEncoderDataTemp ();
SqliteJson.createTableUploadSprintDataTemp ();
+ SqliteJson.createTableUploadExhibitionTestTemp ();
//changes [from - to - desc]
+ //1.59 - 1.60 Converted DB to 1.60 Created table UploadExhibitionTestTemp
//1.58 - 1.59 Converted DB to 1.59 Created ForceSensorExercise
//1.57 - 1.58 Converted DB to 1.58 Added to preferences: encoderCaptureShowNRepetitions
//1.56 - 1.57 Converted DB to 1.57 Created table UploadEncoderDataTemp, UploadSprintDateTemp
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]