[chronojump] SqliteTrigger.DeleteByModeId takes care of mode
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] SqliteTrigger.DeleteByModeId takes care of mode
- Date: Thu, 3 Sep 2020 14:59:17 +0000 (UTC)
commit d2f1fed97edc58322618021bcb3478d4b636b3e0
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Sep 3 16:58:58 2020 +0200
SqliteTrigger.DeleteByModeId takes care of mode
src/gui/app1/encoder.cs | 2 +-
src/sqlite/personSession.cs | 2 +-
src/sqlite/session.cs | 5 +++--
src/sqlite/trigger.cs | 6 ++++--
4 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 2ffe5979..4ec08a80 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -1975,7 +1975,7 @@ public partial class ChronoJumpWindow
"signalID", signalID.ToString());
//delete related triggers
- SqliteTrigger.DeleteByModeID(false, signalID);
+ SqliteTrigger.DeleteByModeID(false, Trigger.Modes.ENCODER, signalID);
}
void on_button_encoder_export_all_curves_clicked (object o, EventArgs args)
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index f5345b63..b7ccdbf1 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -505,7 +505,7 @@ class SqlitePersonSession : Sqlite
SqliteEncoder.DeleteSignalCurveWithCurveID(true, Convert.ToInt32(eSQL.uniqueID));
//delete related triggers
- SqliteTrigger.DeleteByModeID(true, Convert.ToInt32(eSQL.uniqueID));
+ SqliteTrigger.DeleteByModeID(true, Trigger.Modes.ENCODER,
Convert.ToInt32(eSQL.uniqueID));
}
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index 202d0ccf..2790c920 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -999,7 +999,8 @@ class SqliteSession : Sqlite
//SqliteTrigger.DeleteByModeID(true, Convert.ToInt32(signal));
//to export we have to do it with the dbcmd:
dbcmd.CommandText = "Delete FROM " + Constants.TriggerTable +
- " WHERE modeID = " + Convert.ToInt32(signal);
+ " WHERE mode = \"" + Trigger.Modes.ENCODER.ToString() +
+ "\" AND modeID = " + Convert.ToInt32(signal);
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
}
@@ -1038,7 +1039,7 @@ class SqliteSession : Sqlite
SqliteEncoder.DeleteSignalCurveWithCurveID(true,
Convert.ToInt32(eSQL.uniqueID));
//delete related triggers
- SqliteTrigger.DeleteByModeID(true, Convert.ToInt32(eSQL.uniqueID));
+ SqliteTrigger.DeleteByModeID(true, Trigger.Modes.ENCODER,
Convert.ToInt32(eSQL.uniqueID));
}
}
diff --git a/src/sqlite/trigger.cs b/src/sqlite/trigger.cs
index 395d5f07..ebfc069d 100644
--- a/src/sqlite/trigger.cs
+++ b/src/sqlite/trigger.cs
@@ -102,11 +102,13 @@ class SqliteTrigger : Sqlite
}
//on mode == ENCODER, modeID is encoder.uniqueID
- public static void DeleteByModeID(bool dbconOpened, int modeID)
+ public static void DeleteByModeID(bool dbconOpened, Trigger.Modes mode, int modeID)
{
openIfNeeded(dbconOpened);
- dbcmd.CommandText = "Delete FROM " + table + " WHERE modeID = " + modeID;
+ dbcmd.CommandText = "Delete FROM " + table +
+ " WHERE mode = \"" + mode.ToString() +
+ "\" AND modeID = " + modeID;
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]