[chronojump/FS-TFT-Menu] Delete encoderConfiguration uses an specific method caring on encoderGI



commit 809a19723996b9ecfcf29cf4951bbac086f7072d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 27 11:22:28 2022 +0200

    Delete encoderConfiguration uses an specific method caring on encoderGI

 src/gui/encoderConfiguration.cs    |  7 ++++---
 src/sqlite/encoderConfiguration.cs | 20 ++++++++++++++++++--
 2 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/encoderConfiguration.cs b/src/gui/encoderConfiguration.cs
index 4000eab0d..09b883b11 100644
--- a/src/gui/encoderConfiguration.cs
+++ b/src/gui/encoderConfiguration.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-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -999,8 +999,9 @@ public class EncoderConfigurationWindow
                UtilGtk.RemoveRow(treeview_select, store);                      //1 delete row
                UtilGtk.TreeviewSelectFirstRow(treeview_select, store, true);   //2 selects another row (use 
first)
 
-               //SQL
-               Sqlite.DeleteFromName(false, Constants.EncoderConfigurationTable, "name", selectedName);
+               //SQL.
+               //note deleting by name should be only on one encoderGI
+               SqliteEncoderConfiguration.Delete (false, encoderGI, selectedName);
        }
 
        private void on_button_cancel_clicked (object o, EventArgs args)
diff --git a/src/sqlite/encoderConfiguration.cs b/src/sqlite/encoderConfiguration.cs
index 8b4e1322c..736e642cd 100644
--- a/src/sqlite/encoderConfiguration.cs
+++ b/src/sqlite/encoderConfiguration.cs
@@ -15,8 +15,8 @@
  *  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) 2017   Xavier de Blas <xaviblas gmail com> 
- */
+ * Copyright (C) 2017-2022   Xavier de Blas <xaviblas gmail com>
+*/
 
 using System;
 using System.Data;
@@ -195,6 +195,22 @@ class SqliteEncoderConfiguration : Sqlite
                closeIfNeeded(dbconOpened);
        }
 
+       //note deleting by name should be only on one encoderGI, because same name could have 2 encoderGIs
+       public static void Delete (bool dbconOpened, Constants.EncoderGI encoderGI, string name)
+       {
+               openIfNeeded(dbconOpened);
+
+               dbcmd.CommandText = "DELETE FROM " + Constants.EncoderConfigurationTable +
+                       " WHERE encoderGI = \'" + encoderGI.ToString() + "\' " +
+                       " AND name = \'" + name + "\'";
+
+               LogB.SQL(dbcmd.CommandText.ToString());
+               dbcmd.ExecuteNonQuery();
+
+               closeIfNeeded(dbconOpened);
+       }
+
+
        public static void MarkAllAsUnactive(bool dbconOpened, Constants.EncoderGI encoderGI)
        {
                openIfNeeded(dbconOpened);


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