[chronojump] sqlite select jumptypes care for dbcon opened
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] sqlite select jumptypes care for dbcon opened
- Date: Sat, 18 Oct 2014 12:48:02 +0000 (UTC)
commit 3d26193ae6c2b5d78d9566d9bda3855d8779cb6d
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Oct 18 09:47:26 2014 -0300
sqlite select jumptypes care for dbcon opened
src/gui/chronojump.cs | 6 +++---
src/gui/executeAuto.cs | 2 +-
src/gui/jump.cs | 6 +++---
src/gui/queryServer.cs | 2 +-
src/gui/stats.cs | 16 ++++++++--------
src/sqlite/jumpType.cs | 12 ++++++++----
6 files changed, 24 insertions(+), 20 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 0d9d1fb..8b33d42 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2012,7 +2012,7 @@ public partial class ChronoJumpWindow
if(create)
combo_select_jumps = ComboBox.NewText ();
- string [] jumpTypes = SqliteJumpType.SelectJumpTypes("", "", false); //without alljumpsname,
without filter, not only name
+ string [] jumpTypes = SqliteJumpType.SelectJumpTypes(false, "", "", false); //without
alljumpsname, without filter, not only name
selectJumpsString = new String [jumpTypes.Length];
string [] jumpNamesToCombo = new String [jumpTypes.Length];
int i =0;
@@ -2132,7 +2132,7 @@ public partial class ChronoJumpWindow
private void createComboResultJumps() {
combo_result_jumps = ComboBox.NewText ();
UtilGtk.ComboUpdate(combo_result_jumps,
- SqliteJumpType.SelectJumpTypes(Constants.AllJumpsName, "", true), //with
alljumpsname, without filter, only select name
+ SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, "", true),
//with alljumpsname, without filter, only select name
"");
combo_result_jumps.Active = 0;
@@ -5337,7 +5337,7 @@ Console.WriteLine("X");
createComboSelectJumps(false); //this will update also the selectJumpsString
UtilGtk.ComboUpdate(combo_result_jumps,
- SqliteJumpType.SelectJumpTypes(Constants.AllJumpsName, "", true),
""); //without filter, only select name
+ SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, "",
true), ""); //without filter, only select name
new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Added simple
jump."));
} else {
createComboSelectJumpsRj(false); //this will update also the selectJumpsRjString
diff --git a/src/gui/executeAuto.cs b/src/gui/executeAuto.cs
index 35de0b1..737c622 100644
--- a/src/gui/executeAuto.cs
+++ b/src/gui/executeAuto.cs
@@ -152,7 +152,7 @@ public class ExecuteAutoWindow
label_tests_info.Visible = false;
label_series_info.Visible = false;
- jumpTypes = SqliteJumpType.SelectJumpTypes("", "", false); //without alljumpsname, without
filter, not only name
+ jumpTypes = SqliteJumpType.SelectJumpTypes(false, "", "", false); //without alljumpsname,
without filter, not only name
createTreeviewLoad();
fillTreeviewLoad();
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index e7a61aa..4b1f6ba 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -125,9 +125,9 @@ public class EditJumpWindow : EditEventWindow
Jump myJump = (Jump) myEvent;
string [] myTypes;
if (myJump.TypeHasFall) {
- myTypes = SqliteJumpType.SelectJumpTypes("", "TC", true); //don't show allJumpsName
row, TC jumps, only select name
+ myTypes = SqliteJumpType.SelectJumpTypes(false, "", "TC", true); //don't show
allJumpsName row, TC jumps, only select name
} else {
- myTypes = SqliteJumpType.SelectJumpTypes("", "nonTC", true); //don't show
allJumpsName row, nonTC jumps, only select name
+ myTypes = SqliteJumpType.SelectJumpTypes(false, "", "nonTC", true); //don't show
allJumpsName row, nonTC jumps, only select name
}
return myTypes;
}
@@ -1489,7 +1489,7 @@ public class JumpsMoreWindow : EventMoreWindow
protected override void fillTreeView (Gtk.TreeView tv, TreeStore store)
{
//select data without inserting an "all jumps", without filter, and not obtain only name of
jump
- string [] myJumpTypes = SqliteJumpType.SelectJumpTypes("", "", false);
+ string [] myJumpTypes = SqliteJumpType.SelectJumpTypes(false, "", "", false);
//remove typesTranslated
typesTranslated = new String [myJumpTypes.Length];
diff --git a/src/gui/queryServer.cs b/src/gui/queryServer.cs
index 4ef2d46..77085d8 100644
--- a/src/gui/queryServer.cs
+++ b/src/gui/queryServer.cs
@@ -403,7 +403,7 @@ public class QueryServerWindow
}
else if (UtilGtk.ComboGetActive(combo_test_types) ==
Catalog.GetString(Constants.JumpSimpleName))
UtilGtk.ComboUpdate(combo_tests,
- SqliteJumpType.SelectJumpTypes("", "", true), "");
+ SqliteJumpType.SelectJumpTypes(false, "", "", true), "");
else if (UtilGtk.ComboGetActive(combo_test_types) ==
Catalog.GetString(Constants.JumpReactiveName))
UtilGtk.ComboUpdate(combo_tests,
SqliteJumpType.SelectJumpRjTypes("", true), "");
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index b17cc86..6140ca6 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -589,7 +589,7 @@ public partial class ChronoJumpWindow {
//by default show all simple nonTC jumps, but if combo_stats_subtype changed
//updateComboStatsSubType() will do the work
UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
- SqliteJumpType.SelectJumpTypes(Constants.AllJumpsName, "nonTC", true), "");
//only select name
+ SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, "nonTC", true),
""); //only select name
combo_stats_stat_apply_to.Sensitive = true;
combo_stats_stat_apply_to.Active = 0;
}
@@ -600,7 +600,7 @@ public partial class ChronoJumpWindow {
combo_stats_stat_subtype.Active = 0;
UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
- SqliteJumpType.SelectJumpTypes(Constants.AllJumpsName, "TC", true), "");
//only select name
+ SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, "TC", true),
""); //only select name
combo_stats_stat_apply_to.Sensitive = true;
combo_stats_stat_apply_to.Active = 0;
}
@@ -651,7 +651,7 @@ public partial class ChronoJumpWindow {
{
if(UtilGtk.ComboGetActive(combo_stats_stat_subtype) == Catalog.GetString("No
indexes")) {
UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
- SqliteJumpType.SelectJumpTypes(Constants.AllJumpsName, "nonTC",
true), ""); //only select name
+ SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName,
"nonTC", true), ""); //only select name
combo_stats_stat_apply_to.Sensitive = true;
combo_stats_stat_apply_to.Active = 0;
} else if (UtilGtk.ComboGetActive(combo_stats_stat_subtype) ==
Constants.IeIndexFormula) {
@@ -677,9 +677,9 @@ public partial class ChronoJumpWindow {
combo_stats_stat_apply_to.Sensitive = false;
} else if (UtilGtk.ComboGetActive(combo_stats_stat_subtype) ==
Catalog.GetString(Constants.SubtractionBetweenTests)) {
UtilGtk.ComboUpdate(combo_subtraction_between_1,
- SqliteJumpType.SelectJumpTypes("", "", true), ""); //only select name
+ SqliteJumpType.SelectJumpTypes(false, "", "", true), ""); //only
select name
UtilGtk.ComboUpdate(combo_subtraction_between_2,
- SqliteJumpType.SelectJumpTypes("", "", true), ""); //only select name
+ SqliteJumpType.SelectJumpTypes(false, "", "", true), ""); //only
select name
//subtraction_between_tests_show(true);
showSubtractionBetweenTests = true;
label_apply_to.Visible = false;
@@ -688,7 +688,7 @@ public partial class ChronoJumpWindow {
} else if (UtilGtk.ComboGetActive(combo_stats_stat_subtype) ==
Constants.PotencySayersSJFormulaShort) {
combo_stats_stat_apply_to.Active =
UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
- SqliteJumpType.SelectJumpTypes("", "nonTC", true),
//only select name
+ SqliteJumpType.SelectJumpTypes(false, "", "nonTC",
true), //only select name
"SJ"); //default value
combo_stats_stat_apply_to.Sensitive = false;
} else {/*
@@ -707,14 +707,14 @@ public partial class ChronoJumpWindow {
*/
combo_stats_stat_apply_to.Active =
UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
- SqliteJumpType.SelectJumpTypes("", "nonTC", true),
//only select name
+ SqliteJumpType.SelectJumpTypes(false, "", "nonTC",
true), //only select name
"CMJ"); //default value
combo_stats_stat_apply_to.Sensitive = false;
}
} else if (UtilGtk.ComboGetActive(combo_stats_stat_type) == Constants.TypeJumpsSimpleWithTC
)
{
UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
- SqliteJumpType.SelectJumpTypes(Constants.AllJumpsName, "TC", true), "");
//only select name
+ SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, "TC", true),
""); //only select name
combo_stats_stat_apply_to.Sensitive = true;
combo_stats_stat_apply_to.Active = 0;
}
diff --git a/src/sqlite/jumpType.cs b/src/sqlite/jumpType.cs
index 6211735..49d9dde 100644
--- a/src/sqlite/jumpType.cs
+++ b/src/sqlite/jumpType.cs
@@ -186,7 +186,7 @@ class SqliteJumpType : Sqlite
}
}
- public static string[] SelectJumpTypes(string allJumpsName, string filter, bool onlyName)
+ public static string[] SelectJumpTypes(bool dbconOpened, string allJumpsName, string filter, bool
onlyName)
{
//allJumpsName: add and "allJumpsName" value
//filter:
@@ -199,8 +199,10 @@ class SqliteJumpType : Sqlite
string whereString = "";
if(filter == "TC") { whereString = " WHERE startIn == 0 "; }
else if(filter == "nonTC") { whereString = " WHERE startIn == 1 "; }
-
- dbcon.Open();
+
+ if(! dbconOpened)
+ dbcon.Open();
+
dbcmd.CommandText = "SELECT * " +
" FROM " + Constants.JumpTypeTable + " " +
whereString +
@@ -231,7 +233,9 @@ class SqliteJumpType : Sqlite
}
reader.Close();
- dbcon.Close();
+
+ if(! dbconOpened)
+ dbcon.Close();
int numRows;
if(allJumpsName != "") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]