[chronojump/database-refactoring: 5/5] WIP - More refactoring database.
- From: Carles Pina i Estany <carlespina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/database-refactoring: 5/5] WIP - More refactoring database.
- Date: Mon, 12 Sep 2016 22:40:14 +0000 (UTC)
commit 7f5337c40fdde778cf5581142a6a4dccfe82cbbc
Author: Carles Pina i Estany <carles pina cat>
Date: Mon Sep 12 23:38:49 2016 +0100
WIP - More refactoring database.
src/chronojump.cs | 12 +-
src/gui/person.cs | 4 +-
src/oldCodeNeedToDBConvert/sqlite/person.cs | 5 +-
src/oldCodeNeedToDBConvert/sqlite/personSession.cs | 4 +-
src/oldCodeNeedToDBConvert/sqlite/session.cs | 6 +-
src/sqlite/country.cs | 6 +-
src/sqlite/encoder.cs | 5 +-
src/sqlite/event.cs | 4 +
src/sqlite/executeAuto.cs | 5 +-
src/sqlite/jump.cs | 5 +-
src/sqlite/jumpRj.cs | 6 +-
src/sqlite/jumpType.cs | 3 +
src/sqlite/main.cs | 425 +++++++++++---------
src/sqlite/multiChronopic.cs | 5 +-
src/sqlite/oldConvert.cs | 4 +
src/sqlite/person.cs | 5 +-
src/sqlite/personSession.cs | 11 +-
src/sqlite/personSessionNotUpload.cs | 5 +
src/sqlite/preferences.cs | 4 +
src/sqlite/pulse.cs | 5 +-
src/sqlite/pulseType.cs | 4 +
src/sqlite/reactionTime.cs | 5 +-
src/sqlite/run.cs | 5 +-
src/sqlite/runInterval.cs | 5 +-
src/sqlite/runType.cs | 10 +-
src/sqlite/server.cs | 5 +-
src/sqlite/session.cs | 10 +-
src/sqlite/speciallity.cs | 4 +
src/sqlite/sport.cs | 4 +
src/sqlite/stat.cs | 5 +
30 files changed, 349 insertions(+), 237 deletions(-)
---
diff --git a/src/chronojump.cs b/src/chronojump.cs
index cf6e325..74cf28e 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -159,8 +159,6 @@ public class ChronoJump
string language = "";
if(File.Exists(System.IO.Path.Combine(Util.GetDatabaseDir(), "chronojump.db"))) {
try {
- SqliteGeneral.Sqlite.Connect();
-
/*
* chronojump 1.5.2 converts DB 1.24 to 1.25 changing language to ""
* but this operation is done later (on sqliteThings)
@@ -273,7 +271,7 @@ public class ChronoJump
*/
SqliteGeneral.Sqlite.CreateDir();
- bool defaultDBLocation = SqliteGeneral.Sqlite.Connect();
+ bool defaultDBLocation = true; // TODO
LogB.SQL("sqlite connected");
@@ -301,7 +299,7 @@ public class ChronoJump
SqliteGeneral.Sqlite.CreateDir();
- SqliteGeneral.Sqlite.CreateFile();
+ //SqliteGeneral.Sqlite.CreateFile();
//SqliteGeneral.Sqlite.CreateFile(defaultDBLocation);
@@ -344,7 +342,7 @@ public class ChronoJump
chronojumpHasToExit = true;
return;
}
- SqliteGeneral.Sqlite.Connect();
+ // TODO SqliteGeneral.Sqlite.Connect();
}
splashMessageChange(4); //updating DB
@@ -585,7 +583,7 @@ public class ChronoJump
private static void createBlankDB() {
LogB.SQL("Creating blank database");
SqliteGeneral.Sqlite.ConnectBlank();
- SqliteGeneral.Sqlite.CreateFile();
+ //SqliteGeneral.Sqlite.CreateFile();
SqliteGeneral.Sqlite.CreateTables(false); //not server
LogB.SQL("Created blank database! Exiting");
}
@@ -596,7 +594,7 @@ public class ChronoJump
LogB.Error("File already exists. Cannot create.");
else {
SqliteGeneral.Sqlite.ConnectServer();
- SqliteGeneral.Sqlite.CreateFile();
+ //SqliteGeneral.Sqlite.CreateFile();
SqliteGeneral.Sqlite.CreateTables(true); //server
LogB.SQL("Created blank database! Exiting");
string myVersion = UtilAll.ReadVersion();
diff --git a/src/gui/person.cs b/src/gui/person.cs
index ce7bc61..0304926 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -587,7 +587,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
SqliteGeneral.Sqlite.Close();
//do the transaction
- SqlitePersonSessionTransaction psTr = new
SqlitePersonSessionTransaction(personSessions);
+ SqlitePersonSessionTransaction psTr = new
SqlitePersonSessionTransaction(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand, personSessions);
}
updateStoreAndEnd();
@@ -2265,7 +2265,7 @@ public class PersonAddMultipleWindow {
}
//do the transaction
- SqlitePersonSessionTransaction psTr = new SqlitePersonSessionTransaction(persons,
personSessions);
+ SqlitePersonSessionTransaction psTr = new
SqlitePersonSessionTransaction(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand, persons, personSessions);
}
public Button Button_accept
diff --git a/src/oldCodeNeedToDBConvert/sqlite/person.cs b/src/oldCodeNeedToDBConvert/sqlite/person.cs
index 7891d59..bbbe608 100644
--- a/src/oldCodeNeedToDBConvert/sqlite/person.cs
+++ b/src/oldCodeNeedToDBConvert/sqlite/person.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqlitePersonOld : Sqlite
{
- public SqlitePersonOld() {
- }
+ public SqlitePersonOld(SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqlitePersonOld() {}
diff --git a/src/oldCodeNeedToDBConvert/sqlite/personSession.cs
b/src/oldCodeNeedToDBConvert/sqlite/personSession.cs
index 8992876..8f549ec 100644
--- a/src/oldCodeNeedToDBConvert/sqlite/personSession.cs
+++ b/src/oldCodeNeedToDBConvert/sqlite/personSession.cs
@@ -28,7 +28,9 @@ using Mono.Unix;
public class SqlitePersonSessionOld : Sqlite
{
- public SqlitePersonSessionOld() {
+ public SqlitePersonSessionOld(SqliteConnection dbcon, SqliteCommand dbcmd)
+ : base (dbcon, dbcmd)
+ {
}
~SqlitePersonSessionOld() {}
diff --git a/src/oldCodeNeedToDBConvert/sqlite/session.cs b/src/oldCodeNeedToDBConvert/sqlite/session.cs
index b197f96..e2cb73e 100644
--- a/src/oldCodeNeedToDBConvert/sqlite/session.cs
+++ b/src/oldCodeNeedToDBConvert/sqlite/session.cs
@@ -28,7 +28,9 @@ using Mono.Unix;
public class SqliteSessionOld : Sqlite
{
- public SqliteSessionOld() {
+ public SqliteSessionOld(SqliteConnection dbcon, SqliteCommand dbcmd)
+ : base (dbcon, dbcmd)
+ {
}
~SqliteSessionOld() {}
@@ -45,7 +47,7 @@ public class SqliteSessionOld : Sqlite
//1st create a temp table
//createTable(Constants.ConvertTempTable);
- SqliteSessionOld sqliteSessionObject = new SqliteSessionOld();
+ SqliteSessionOld sqliteSessionObject = new
SqliteSessionOld(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteSessionObject.createTable(Constants.ConvertTempTable);
//2nd copy all data from session table to temp table
diff --git a/src/sqlite/country.cs b/src/sqlite/country.cs
index ec135f1..2aa5da9 100644
--- a/src/sqlite/country.cs
+++ b/src/sqlite/country.cs
@@ -43,8 +43,12 @@ public class SqliteCountry : Sqlite
dbcmd.ExecuteNonQuery();
}
+ public SqliteCountry (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
// intialize table
- protected internal void initialize()
+ protected internal void initialize()
{
conversionSubRateTotal = countries.Length;
conversionSubRate = 0;
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index ee62dae..7e31a95 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -29,8 +29,9 @@ using Mono.Unix;
public class SqliteEncoder : Sqlite
{
- public SqliteEncoder() {
- }
+ public SqliteEncoder(SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteEncoder() {}
diff --git a/src/sqlite/event.cs b/src/sqlite/event.cs
index 27cba61..dfd5aa3 100644
--- a/src/sqlite/event.cs
+++ b/src/sqlite/event.cs
@@ -34,6 +34,10 @@ public class SqliteEvent : Sqlite
* in the future this will not exist, and graphs will be in jumpType, runType, ... tables
*/
+ public SqliteEvent(SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
protected internal void createGraphLinkTable()
{
dbcmd.CommandText =
diff --git a/src/sqlite/executeAuto.cs b/src/sqlite/executeAuto.cs
index 33745c4..6429c31 100644
--- a/src/sqlite/executeAuto.cs
+++ b/src/sqlite/executeAuto.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqliteExecuteAuto : Sqlite
{
- public SqliteExecuteAuto() {
- }
+ public SqliteExecuteAuto (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteExecuteAuto() {}
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 2255b33..0d6d264 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -28,8 +28,9 @@ using Mono.Data.Sqlite;
public class SqliteJump : Sqlite
{
- public SqliteJump() {
- }
+ public SqliteJump(SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteJump() {}
diff --git a/src/sqlite/jumpRj.cs b/src/sqlite/jumpRj.cs
index 654bfb9..9c38081 100644
--- a/src/sqlite/jumpRj.cs
+++ b/src/sqlite/jumpRj.cs
@@ -27,8 +27,10 @@ using Mono.Data.Sqlite;
public class SqliteJumpRj : SqliteJump
{
- public SqliteJumpRj() {
- }
+ public SqliteJumpRj (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
~SqliteJumpRj() {}
protected override void createTable(string tableName)
diff --git a/src/sqlite/jumpType.cs b/src/sqlite/jumpType.cs
index 8fda994..214bb0d 100644
--- a/src/sqlite/jumpType.cs
+++ b/src/sqlite/jumpType.cs
@@ -27,6 +27,9 @@ using Mono.Data.Sqlite;
public class SqliteJumpType : Sqlite
{
+ public SqliteJumpType (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
/*
* create and initialize tables
*/
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 9f87636..88fa2bd 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -59,41 +59,44 @@ public sealed class SqliteGeneral
private static SqlitePersonOld m_sqlitePersonOld;
private static SqliteSessionOld m_sqliteSessionOld;
private static SqliteOldConvert m_sqliteOldConvert;
+ private static SqliteConnector m_sqliteConnector;
public SqliteGeneral()
{
- m_sqlite = new Sqlite();
- m_sqlite.Connect();
- m_sqlitePreferences = new SqlitePreferences();
- m_sqlitePreferences.Connect();
- m_sqliteJumpRj = new SqliteJumpRj();
- m_sqliteJump = new SqliteJump();
- m_sqliteRunInterval = new SqliteRunInterval();
- m_sqlitePerson = new SqlitePerson();
- m_sqliteExecuteAuto = new SqliteExecuteAuto();
- m_sqlitePersonSession = new SqlitePersonSession();
- m_sqliteRun = new SqliteRun();
- m_sqliteRunIntervalType = new SqliteRunIntervalType();
- m_sqliteRunType = new SqliteRunType();
- m_sqliteReactionTime = new SqliteReactionTime();
- m_sqlitePulse = new SqlitePulse();
- m_sqlitePulseType = new SqlitePulseType();
- m_sqliteMultiChronopic = new SqliteMultiChronopic();
- m_sqliteSport = new SqliteSport();
- m_sqliteSpeciallity = new SqliteSpeciallity();
- m_sqliteJumpType = new SqliteJumpType();
- m_sqliteSession = new SqliteSession();
- m_sqliteServer = new SqliteServer();
- m_sqliteServerSession = new SqliteServerSession();
- m_sqlitePersonSessionNotUpload = new SqlitePersonSessionNotUpload();
- m_sqliteEncoder = new SqliteEncoder();
- m_sqliteEvent = new SqliteEvent();
- m_sqliteCountry = new SqliteCountry();
- m_sqliteStat = new SqliteStat();
- m_sqlitePersonSessionOld = new SqlitePersonSessionOld();
- m_sqlitePersonOld = new SqlitePersonOld();
- m_sqliteSessionOld = new SqliteSessionOld();
- m_sqliteOldConvert = new SqliteOldConvert();
+ SqliteConnector sqliteConnector = new SqliteConnector();
+
+ sqliteConnector.connectGeneral();
+
+ m_sqlite = new Sqlite(sqliteConnector.sqliteConnection, sqliteConnector.sqliteCommand);
+ m_sqlitePreferences = new SqlitePreferences(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteJumpRj = new SqliteJumpRj(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteJump = new SqliteJump(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteRunInterval = new SqliteRunInterval(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqlitePerson = new SqlitePerson(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteExecuteAuto = new SqliteExecuteAuto(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqlitePersonSession = new SqlitePersonSession(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteRun = new SqliteRun(sqliteConnector.sqliteConnection, sqliteConnector.sqliteCommand);
+ m_sqliteRunIntervalType = new SqliteRunIntervalType(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteRunType = new SqliteRunType(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteReactionTime = new SqliteReactionTime(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqlitePulse = new SqlitePulse(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqlitePulseType = new SqlitePulseType(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteMultiChronopic = new SqliteMultiChronopic(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteSport = new SqliteSport(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteSpeciallity = new SqliteSpeciallity(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteJumpType = new SqliteJumpType(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteSession = new SqliteSession(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteServer = new SqliteServer(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteServerSession = new SqliteServerSession(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqlitePersonSessionNotUpload = new
SqlitePersonSessionNotUpload(sqliteConnector.sqliteConnection, sqliteConnector.sqliteCommand);
+ m_sqliteEncoder = new SqliteEncoder(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteEvent = new SqliteEvent(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteCountry = new SqliteCountry(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteStat = new SqliteStat(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqlitePersonSessionOld = new SqlitePersonSessionOld(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqlitePersonOld = new SqlitePersonOld(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteSessionOld = new SqliteSessionOld(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
+ m_sqliteOldConvert = new SqliteOldConvert(sqliteConnector.sqliteConnection,
sqliteConnector.sqliteCommand);
}
public static Sqlite Sqlite
@@ -326,114 +329,68 @@ public sealed class SqliteGeneral
return m_sqliteOldConvert;
}
}
+
+ public static SqliteConnector SqlConnector
+ {
+ get
+ {
+ return m_sqliteConnector;
+ }
+ }
}
-public class Sqlite
+public class SqliteConnector
{
- protected SqliteConnection dbcon;
- protected SqliteCommand dbcmd;
-
- //since we use installJammer (chronojump 0.7)
- //database was on c:\.chronojump\ or in ~/.chronojump
- //now it's on installed dir, eg linux: ~/Chronojump/database
- private string home = Util.GetDatabaseDir();
- private string sqlFile = Util.GetDatabaseDir() + Path.DirectorySeparatorChar + "chronojump.db";
-
- private string temp = Util.GetDatabaseTempDir();
- private string sqlFileTemp = Util.GetDatabaseTempDir() + Path.DirectorySeparatorChar +
"chronojump.db";
+ private SqliteConnection dbcon;
+ private SqliteCommand dbcmd;
- //http://www.mono-project.com/SQLite
+ private string sqlFileServer;
+ private string connectionStringServer;
- private string connectionString;
- private string connectionStringTemp;
+ private void CreateFile(string connectionString)
+ {
+ LogB.SQL("creating file...");
+ LogB.SQL(connectionString);
- //test to try to open db in a dir with accents (latin)
- //string connectionString = "globalization requestEncoding=\"iso-8859-1\";
responseEncoding=\"iso-8859-1\"; fileEncoding=\"iso-8859-1\"; culture=\"es-ES\";version = 3; Data source = "
+ sqlFile;
-
- //create blank database
- bool creatingBlankDatabase = false;
+ // if(!Directory.Exists(home)) {
+ // Directory.CreateDirectory (home);
+ // }
-
- public enum Orders_by { DEFAULT, ID_DESC }
+ //try {
+ dbcon.Open();
+ /*
+ } catch {
+ dbcon.Close();
+ dbcon.ConnectionString = connectionStringTemp;
+ dbcmd = dbcon.CreateCommand();
+ dbcon.Open();
+ }
+ */
+ dbcon.Close();
+ }
- //for db creation
- int creationRate;
- int creationTotal;
+ public bool connectGeneral()
+ {
+ //since we use installJammer (chronojump 0.7)
+ //database was on c:\.chronojump\ or in ~/.chronojump
+ //now it's on installed dir, eg linux: ~/Chronojump/database
+ string home = Util.GetDatabaseDir();
+ string sqlFile = Util.GetDatabaseDir() + Path.DirectorySeparatorChar + "chronojump.db";
- //for db conversion
- string currentVersion = "0";
-
- int conversionRate;
- int conversionRateTotal;
- protected int conversionSubRate;
- protected int conversionSubRateTotal;
+ string temp = Util.GetDatabaseTempDir();
+ string sqlFileTemp = Util.GetDatabaseTempDir() + Path.DirectorySeparatorChar +
"chronojump.db";
- public bool IsOpened = false;
- public bool SafeClose = true;
+ //http://www.mono-project.com/SQLite
- /*
- * Important, change this if there's any update to database
- */
- string lastChronojumpDatabaseVersion = "1.32";
+ string connectionString;
+ string connectionStringTemp;
- public Sqlite() {
connectionString = "version = 3; Data source = " + sqlFile;
connectionStringTemp = "version = 3; Data source = " + sqlFileTemp;
sqlFileServer = home + Path.DirectorySeparatorChar + "chronojump_server.db";
connectionStringServer = "version = 3; Data source = " + sqlFileServer;
- }
-
- protected virtual void createTable(string tableName) {
- }
-
- //used by personSessionWeight
- protected virtual void createTable() {
- }
-
- ~Sqlite() {}
-
- //these two methods are used by methods who want to leave the connection opened
- //because lots of similar transactions have to be done
- public void Open()
- {
- try {
- LogB.SQLon();
- dbcon.Open();
- } catch {
- LogB.SQL("-- catched --");
-
- Close();
- LogB.Warning(" going to open ");
- LogB.SQLon();
- dbcon.Open();
-
- LogB.SQL("-- end of catched --");
- }
-
- IsOpened = true;
- }
- public void Close()
- {
- LogB.SQLoff();
-
- if(SafeClose) {
- dbcmd.Dispose(); //this seems critical in multiple open/close SQL
- }
-
- dbcon.Close();
-
- if(SafeClose) {
- //GC.Collect(); don't need and very slow
- dbcmd = dbcon.CreateCommand();
- }
-
- IsOpened = false;
- }
-
- public bool Connect()
- {
/*
splashMessage = "pre";
needUpdateSplashMessage = true;
@@ -445,6 +402,9 @@ public class Sqlite
bool defaultDBLocation = true;
dbcon = new SqliteConnection();
+ dbcon.ConnectionString = connectionString;
+
+ CreateFile(connectionString);
/*
* the Open() helps to know it threre are problems with path and sqlite
@@ -460,6 +420,8 @@ public class Sqlite
dbcon.ConnectionString = connectionStringTest;
dbcmd = dbcon.CreateCommand();
+
+
try {
dbcon.Open();
} catch {
@@ -470,8 +432,8 @@ public class Sqlite
defaultDBLocation = false;
}
dbcon.Close();
-
-
+
+
if(defaultDBLocation) {
dbcon.ConnectionString = connectionString;
if (File.Exists(sqlFileTest)){
@@ -520,9 +482,113 @@ public class Sqlite
}
*/
-
+
return defaultDBLocation;
+ }
+
+ public SqliteConnection sqliteConnection
+ {
+ get
+ {
+ return dbcon;
+ }
+ }
+
+ public SqliteCommand sqliteCommand
+ {
+ get
+ {
+ return dbcmd;
+ }
+ }
+}
+
+public class Sqlite
+{
+ protected SqliteConnection dbcon;
+ protected SqliteCommand dbcmd;
+
+ //test to try to open db in a dir with accents (latin)
+ //string connectionString = "globalization requestEncoding=\"iso-8859-1\";
responseEncoding=\"iso-8859-1\"; fileEncoding=\"iso-8859-1\"; culture=\"es-ES\";version = 3; Data source = "
+ sqlFile;
+
+ //create blank database
+ bool creatingBlankDatabase = false;
+
+
+ public enum Orders_by { DEFAULT, ID_DESC }
+
+ //for db creation
+ int creationRate;
+ int creationTotal;
+
+ //for db conversion
+ string currentVersion = "0";
+
+ int conversionRate;
+ int conversionRateTotal;
+ protected int conversionSubRate;
+ protected int conversionSubRateTotal;
+
+ public bool IsOpened = false;
+ public bool SafeClose = true;
+
+ /*
+ * Important, change this if there's any update to database
+ */
+ string lastChronojumpDatabaseVersion = "1.32";
+
+ public Sqlite(SqliteConnection dbcon, SqliteCommand dbcmd)
+ {
+ this.dbcon = dbcon;
+ this.dbcmd = dbcmd;
+ }
+
+ protected virtual void createTable(string tableName) {
+ }
+
+ //used by personSessionWeight
+ protected virtual void createTable() {
+ }
+
+ ~Sqlite() {}
+
+ //these two methods are used by methods who want to leave the connection opened
+ //because lots of similar transactions have to be done
+ public void Open()
+ {
+ try {
+ LogB.SQLon();
+ dbcon.Open();
+ } catch {
+ LogB.SQL("-- catched --");
+
+ Close();
+
+ LogB.Warning(" going to open ");
+ LogB.SQLon();
+ dbcon.Open();
+
+ LogB.SQL("-- end of catched --");
+ }
+
+ IsOpened = true;
+ }
+ public void Close()
+ {
+ LogB.SQLoff();
+
+ if(SafeClose) {
+ dbcmd.Dispose(); //this seems critical in multiple open/close SQL
+ }
+
+ dbcon.Close();
+
+ if(SafeClose) {
+ //GC.Collect(); don't need and very slow
+ dbcmd = dbcon.CreateCommand();
+ }
+ IsOpened = false;
}
//only create blank DB
@@ -552,6 +618,7 @@ public class Sqlite
public void CreateDir()
{
+ /* TODO
LogB.SQL(connectionString);
string applicationDataDir = UtilAll.GetApplicationDataDir();
@@ -566,33 +633,14 @@ public class Sqlite
Directory.CreateDirectory (home);
}
LogB.SQL("Dirs created.");
+ */
}
- public void CreateFile()
+ public bool CheckTables(bool defaultDBLocation)
{
- LogB.SQL("creating file...");
- LogB.SQL(connectionString);
-
- // if(!Directory.Exists(home)) {
- // Directory.CreateDirectory (home);
- // }
-
- //try {
- dbcon.Open();
+ return true;
/*
- } catch {
- dbcon.Close();
- dbcon.ConnectionString = connectionStringTemp;
- dbcmd = dbcon.CreateCommand();
- dbcon.Open();
- }
- */
- dbcon.Close();
- }
-
- public bool CheckTables(bool defaultDBLocation)
- {
if(defaultDBLocation) {
if (File.Exists(sqlFile)){
return true;
@@ -611,6 +659,7 @@ public class Sqlite
}
}
return false;
+ */
}
@@ -813,12 +862,12 @@ public class Sqlite
bool runAndRunIntervalInitialSpeedAdded = false;
bool addedRSA = false;
- SqliteJumpRj sqliteJumpRjObject = new SqliteJumpRj();
- SqliteRunInterval sqliteRunIntervalObject = new SqliteRunInterval();
- SqliteReactionTime sqliteReactionTimeObject = new SqliteReactionTime();
- SqlitePulse sqlitePulseObject = new SqlitePulse();
- SqliteMultiChronopic sqliteMultiChronopicObject = new SqliteMultiChronopic();
- SqlitePersonSessionOld sqlitePersonSessionOldObject = new SqlitePersonSessionOld();
+ SqliteJumpRj sqliteJumpRjObject = new
SqliteJumpRj(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
+ SqliteRunInterval sqliteRunIntervalObject = new
SqliteRunInterval(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
+ SqliteReactionTime sqliteReactionTimeObject = new
SqliteReactionTime(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
+ SqlitePulse sqlitePulseObject = new
SqlitePulse(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
+ SqliteMultiChronopic sqliteMultiChronopicObject = new
SqliteMultiChronopic(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
+ SqlitePersonSessionOld sqlitePersonSessionOldObject = new
SqlitePersonSessionOld(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
if(currentVersion == "0.41") {
SqliteGeneral.Sqlite.Open();
@@ -1041,19 +1090,19 @@ public class Sqlite
conversionRateTotal = 9;
conversionRate = 1;
- convertTables(new SqliteJump(), Constants.JumpTable, 9,
arrayAngleAndSimulated, false);
+ convertTables(new SqliteJump(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand), Constants.JumpTable, 9, arrayAngleAndSimulated, false);
conversionRate ++;
- convertTables(new SqliteJumpRj(), Constants.JumpRjTable, 16,
arrayAngleAndSimulated, false);
+ convertTables(new SqliteJumpRj(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand), Constants.JumpRjTable, 16, arrayAngleAndSimulated, false);
conversionRate ++;
- convertTables(new SqliteRun(), Constants.RunTable, 7, arraySimulated, false);
+ convertTables(new SqliteRun(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand), Constants.RunTable, 7, arraySimulated, false);
conversionRate ++;
- convertTables(new SqliteRunInterval(), Constants.RunIntervalTable, 11,
arraySimulated, false);
+ convertTables(new
SqliteRunInterval(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.RunIntervalTable, 11, arraySimulated, false);
runAndRunIntervalInitialSpeedAdded = true;
conversionRate ++;
- convertTables(new SqliteReactionTime(), Constants.ReactionTimeTable, 6,
arraySimulated, false);
+ convertTables(new
SqliteReactionTime(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.ReactionTimeTable, 6, arraySimulated, false);
conversionRate ++;
- convertTables(new SqlitePulse(), Constants.PulseTable, 8, arraySimulated,
false);
+ convertTables(new SqlitePulse(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand), Constants.PulseTable, 8, arraySimulated, false);
//reacreate temp tables for have also the simulated column
@@ -1081,7 +1130,7 @@ public class Sqlite
arrayPersonRaceCountryServerID.Add(Constants.RaceUndefinedID.ToString());
arrayPersonRaceCountryServerID.Add(Constants.CountryUndefinedID.ToString());
arrayPersonRaceCountryServerID.Add(Constants.ServerUndefinedID.ToString());
- convertTables(new SqlitePersonOld(), Constants.PersonOldTable, columnsBefore,
arrayPersonRaceCountryServerID, putDescriptionInMiddle);
+ convertTables(new
SqlitePersonOld(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.PersonOldTable, columnsBefore, arrayPersonRaceCountryServerID, putDescriptionInMiddle);
SqliteGeneral.SqlitePreferences.Update ("databaseVersion", "0.57", true);
SqliteGeneral.Sqlite.Close();
@@ -1116,7 +1165,7 @@ public class Sqlite
conversionRateTotal = 2;
conversionRate = 1;
SqliteGeneral.SqlitePreferences.Insert ("showAngle", "False");
- alterTableColumn(new SqliteJump(), Constants.JumpTable, 11);
+ alterTableColumn(new SqliteJump(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand), Constants.JumpTable, 11);
//jump fall is also converted to double (don't need to do at conversion to
0.76)
jumpFallAsDouble = true;
@@ -1141,7 +1190,7 @@ public class Sqlite
int columnsBefore = 8;
ArrayList arrayServerID = new ArrayList(1);
arrayServerID.Add(Constants.ServerUndefinedID.ToString());
- convertTables(new SqliteSession(), Constants.SessionTable, columnsBefore,
arrayServerID, false);
+ convertTables(new SqliteSession(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand), Constants.SessionTable, columnsBefore, arrayServerID, false);
conversionRate = 3;
SqliteGeneral.SqliteEvent.SimulatedConvertToNegative();
@@ -1161,7 +1210,7 @@ public class Sqlite
ArrayList arrayDS = new ArrayList(1);
arrayDS.Add("-1"); //distancesString
- convertTables(new SqliteRunIntervalType(), Constants.RunIntervalTypeTable, 7,
arrayDS, false);
+ convertTables(new
SqliteRunIntervalType(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.RunIntervalTypeTable, 7, arrayDS, false);
conversionRate = 2;
@@ -1218,7 +1267,7 @@ public class Sqlite
if(currentVersion == "0.64") {
SqliteGeneral.Sqlite.Open();
- SqliteServer sqliteServerObject = new SqliteServer();
+ SqliteServer sqliteServerObject = new
SqliteServer(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
//user has also an evaluator table with a row (it's row)
sqliteServerObject.CreateEvaluatorTable();
@@ -1335,10 +1384,10 @@ public class Sqlite
SqliteGeneral.Sqlite.Open();
- convertTables(new SqlitePersonOld(), Constants.PersonOldTable, 13, new
ArrayList(), false);
+ convertTables(new
SqlitePersonOld(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.PersonOldTable, 13, new ArrayList(), false);
conversionRate++;
- convertTables(new SqlitePersonSessionOld(),
Constants.PersonSessionOldWeightTable, 4, new ArrayList(), false);
+ convertTables(new
SqlitePersonSessionOld(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand), Constants.PersonSessionOldWeightTable, 4, new ArrayList(), false);
SqliteGeneral.SqlitePreferences.Update ("databaseVersion", "0.75", true);
conversionRate++;
@@ -1353,11 +1402,11 @@ public class Sqlite
SqliteGeneral.Sqlite.Open();
if(!jumpFallAsDouble)
- alterTableColumn(new SqliteJump(), Constants.JumpTable, 11);
+ alterTableColumn(new
SqliteJump(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.JumpTable, 11);
conversionRate++;
- alterTableColumn(new SqliteJumpRj(), Constants.JumpRjTable, 18);
+ alterTableColumn(new
SqliteJumpRj(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.JumpRjTable, 18);
SqliteGeneral.SqlitePreferences.Update ("databaseVersion", "0.76", true);
conversionRate++;
@@ -1411,9 +1460,9 @@ public class Sqlite
conversionRateTotal = 3;
conversionRate = 1;
- convertTables(new SqliteRun(), Constants.RunTable, 8, myArray, false);
+ convertTables(new
SqliteRun(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.RunTable, 8, myArray, false);
conversionRate ++;
- convertTables(new SqliteRunInterval(), Constants.RunIntervalTable,
12, myArray, false);
+ convertTables(new
SqliteRunInterval(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand),
Constants.RunIntervalTable, 12, myArray, false);
conversionRate ++;
LogB.SQL("Converted DB to 0.80 Added run and runInterval initial
speed (if not done in 0.56 conversion)");
}
@@ -2253,17 +2302,17 @@ public class Sqlite
creationTotal = 14;
creationRate = 1;
- SqliteServer sqliteServerObject = new SqliteServer();
+ SqliteServer sqliteServerObject = new
SqliteServer(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
//user has also an evaluator table with a row (it's row)
sqliteServerObject.CreateEvaluatorTable();
if(server) {
sqliteServerObject.CreatePingTable();
- SqliteServerSession sqliteSessionObject = new SqliteServerSession();
+ SqliteServerSession sqliteSessionObject = new
SqliteServerSession(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteSessionObject.createTable(Constants.SessionTable);
} else {
- SqliteSession sqliteSessionObject = new SqliteSession();
+ SqliteSession sqliteSessionObject = new
SqliteSession(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteSessionObject.createTable(Constants.SessionTable);
//add SIMULATED session if doesn't exists. Unique session where tests can be
simulated.
@@ -2274,7 +2323,7 @@ public class Sqlite
}
- SqlitePerson sqlitePersonObject = new SqlitePerson();
+ SqlitePerson sqlitePersonObject = new
SqlitePerson(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqlitePersonObject.createTable(Constants.PersonTable);
//graphLinkTable
@@ -2282,8 +2331,8 @@ public class Sqlite
creationRate ++;
//jumps
- SqliteJump sqliteJumpObject = new SqliteJump();
- SqliteJumpRj sqliteJumpRjObject = new SqliteJumpRj();
+ SqliteJump sqliteJumpObject = new SqliteJump(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand);
+ SqliteJumpRj sqliteJumpRjObject = new
SqliteJumpRj(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteJumpObject.createTable(Constants.JumpTable);
sqliteJumpRjObject.createTable(Constants.JumpRjTable);
sqliteJumpRjObject.createTable(Constants.TempJumpRjTable);
@@ -2297,37 +2346,37 @@ public class Sqlite
//runs
creationRate ++;
- SqliteRun sqliteRunObject = new SqliteRun();
- SqliteRunInterval sqliteRunIntervalObject = new SqliteRunInterval();
+ SqliteRun sqliteRunObject = new SqliteRun(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand);
+ SqliteRunInterval sqliteRunIntervalObject = new
SqliteRunInterval(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteRunObject.createTable(Constants.RunTable);
sqliteRunIntervalObject.createTable(Constants.RunIntervalTable);
sqliteRunIntervalObject.createTable(Constants.TempRunIntervalTable);
//run Types
creationRate ++;
- SqliteRunType sqliteRunTypeObject = new SqliteRunType();
+ SqliteRunType sqliteRunTypeObject = new
SqliteRunType(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteRunTypeObject.createTable(Constants.RunTypeTable);
SqliteGeneral.SqliteRunType.initializeTable();
- SqliteRunIntervalType sqliteRunIntervalTypeObject = new SqliteRunIntervalType();
+ SqliteRunIntervalType sqliteRunIntervalTypeObject = new
SqliteRunIntervalType(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteRunIntervalTypeObject.createTable(Constants.RunIntervalTypeTable);
SqliteGeneral.SqliteRunIntervalType.initializeTable();
//reactionTimes
creationRate ++;
- SqliteReactionTime sqliteReactionTimeObject = new SqliteReactionTime();
+ SqliteReactionTime sqliteReactionTimeObject = new
SqliteReactionTime(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteReactionTimeObject.createTable(Constants.ReactionTimeTable);
//pulses and pulseTypes
creationRate ++;
- SqlitePulse sqlitePulseObject = new SqlitePulse();
+ SqlitePulse sqlitePulseObject = new SqlitePulse(SqliteGeneral.SqlConnector.sqliteConnection,
SqliteGeneral.SqlConnector.sqliteCommand);
sqlitePulseObject.createTable(Constants.PulseTable);
SqliteGeneral.SqlitePulseType.createTablePulseType();
SqliteGeneral.SqlitePulseType.initializeTablePulseType();
//multiChronopic tests
creationRate ++;
- SqliteMultiChronopic sqliteMultiChronopicObject = new SqliteMultiChronopic();
+ SqliteMultiChronopic sqliteMultiChronopicObject = new
SqliteMultiChronopic(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqliteMultiChronopicObject.createTable(Constants.MultiChronopicTable);
//encoder
@@ -2347,7 +2396,7 @@ public class Sqlite
SqliteGeneral.SqliteSpeciallity.InsertUndefined(true);
creationRate ++;
- SqlitePersonSession sqlitePersonSessionObject = new SqlitePersonSession();
+ SqlitePersonSession sqlitePersonSessionObject = new
SqlitePersonSession(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqlitePersonSessionObject.createTable(Constants.PersonSessionTable);
creationRate ++;
@@ -2600,15 +2649,15 @@ public class Sqlite
protected void convertPersonAndPersonSessionTo77() {
//create person77
- SqlitePerson sqlitePersonObject = new SqlitePerson();
+ SqlitePerson sqlitePersonObject = new
SqlitePerson(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqlitePersonObject.createTable(Constants.PersonTable);
//create personSession77
- SqlitePersonSession sqlitePersonSessionObject = new SqlitePersonSession();
+ SqlitePersonSession sqlitePersonSessionObject = new
SqlitePersonSession(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
sqlitePersonSessionObject.createTable(Constants.PersonSessionTable);
//select all personOld data
- SqlitePersonOld sqlitePersonOldObject = new SqlitePersonOld();
+ SqlitePersonOld sqlitePersonOldObject = new
SqlitePersonOld(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
ArrayList personsOld = sqlitePersonOldObject.SelectAllPersons();
conversionRateTotal = personsOld.Count;
@@ -2627,7 +2676,7 @@ public class Sqlite
p.InsertAtDB(true, Constants.PersonTable);
//select all personSessionOld data of this person
- SqlitePersonSessionOld sqlitePersonSessionOldObject = new SqlitePersonSessionOld();
+ SqlitePersonSessionOld sqlitePersonSessionOldObject = new
SqlitePersonSessionOld(SqliteGeneral.SqlConnector.sqliteConnection, SqliteGeneral.SqlConnector.sqliteCommand);
ArrayList personSessionsOld =
sqlitePersonSessionOldObject.SelectAllPersonSessionsOfAPerson(p.UniqueID);
conversionSubRateTotal = personSessionsOld.Count;
conversionSubRate = 1;
diff --git a/src/sqlite/multiChronopic.cs b/src/sqlite/multiChronopic.cs
index f40304c..c03bcdf 100644
--- a/src/sqlite/multiChronopic.cs
+++ b/src/sqlite/multiChronopic.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqliteMultiChronopic : Sqlite
{
- public SqliteMultiChronopic() {
- }
+ public SqliteMultiChronopic (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteMultiChronopic() {}
diff --git a/src/sqlite/oldConvert.cs b/src/sqlite/oldConvert.cs
index 0f0707e..5a66cf0 100644
--- a/src/sqlite/oldConvert.cs
+++ b/src/sqlite/oldConvert.cs
@@ -29,6 +29,10 @@ using Mono.Data.Sqlite;
public class SqliteOldConvert : Sqlite
{
+ public SqliteOldConvert (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
/*
* DB 1.20 -> 1.21
* "Fixing loosing of encoder videoURL after recalculate"
diff --git a/src/sqlite/person.cs b/src/sqlite/person.cs
index 32223a1..f7161c9 100644
--- a/src/sqlite/person.cs
+++ b/src/sqlite/person.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqlitePerson : Sqlite
{
- public SqlitePerson() {
- }
+ public SqlitePerson (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqlitePerson() {}
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index 946b9cc..51a4481 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -29,8 +29,9 @@ using System.Collections.Generic; //List<T>
public class SqlitePersonSession : Sqlite
{
- public SqlitePersonSession() {
- }
+ public SqlitePersonSession (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqlitePersonSession() {}
@@ -457,14 +458,16 @@ class SqlitePersonSessionTransaction : Sqlite
enum Modes { INSERT_PERSONS_MULTIPLE, RECUPERATE_PERSONS_MULTIPLE }
Modes mode;
- public SqlitePersonSessionTransaction(List <PersonSession> personSessions)
+ public SqlitePersonSessionTransaction(SqliteConnection dbcon, SqliteCommand dbcmd, List
<PersonSession> personSessions)
+ : base(dbcon, dbcmd)
{
this.personSessions = personSessions;
mode = Modes.RECUPERATE_PERSONS_MULTIPLE;
doTransaction();
}
- public SqlitePersonSessionTransaction(List <Person> persons, List <PersonSession> personSessions)
+ public SqlitePersonSessionTransaction(SqliteConnection dbcon, SqliteCommand dbcmd, List <Person>
persons, List <PersonSession> personSessions)
+ : base(dbcon, dbcmd)
{
this.persons = persons;
this.personSessions = personSessions;
diff --git a/src/sqlite/personSessionNotUpload.cs b/src/sqlite/personSessionNotUpload.cs
index 6876c47..726de87 100644
--- a/src/sqlite/personSessionNotUpload.cs
+++ b/src/sqlite/personSessionNotUpload.cs
@@ -26,6 +26,11 @@ using Mono.Data.Sqlite;
public class SqlitePersonSessionNotUpload : Sqlite
{
+
+ public SqlitePersonSessionNotUpload (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
protected internal void CreateTable()
{
dbcmd.CommandText =
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 1550a43..7875471 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -26,6 +26,10 @@ using Mono.Data.Sqlite;
public class SqlitePreferences : Sqlite
{
+ public SqlitePreferences (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
protected override void createTable()
{
dbcmd.CommandText =
diff --git a/src/sqlite/pulse.cs b/src/sqlite/pulse.cs
index 9c1e39a..1a2dab5 100644
--- a/src/sqlite/pulse.cs
+++ b/src/sqlite/pulse.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqlitePulse : Sqlite
{
- public SqlitePulse() {
- }
+ public SqlitePulse (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqlitePulse() {}
diff --git a/src/sqlite/pulseType.cs b/src/sqlite/pulseType.cs
index 05ac629..37f06d9 100644
--- a/src/sqlite/pulseType.cs
+++ b/src/sqlite/pulseType.cs
@@ -30,6 +30,10 @@ public class SqlitePulseType : Sqlite
/*
* create and initialize tables
*/
+
+ public SqlitePulseType (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
//creates table containing the types of simple Pulses
//following INT values are booleans
diff --git a/src/sqlite/reactionTime.cs b/src/sqlite/reactionTime.cs
index adb3209..8afe2ec 100644
--- a/src/sqlite/reactionTime.cs
+++ b/src/sqlite/reactionTime.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqliteReactionTime : Sqlite
{
- public SqliteReactionTime() {
- }
+ public SqliteReactionTime (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteReactionTime() {}
diff --git a/src/sqlite/run.cs b/src/sqlite/run.cs
index 6287adb..442a8d6 100644
--- a/src/sqlite/run.cs
+++ b/src/sqlite/run.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqliteRun : Sqlite
{
- public SqliteRun() {
- }
+ public SqliteRun (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteRun() {}
diff --git a/src/sqlite/runInterval.cs b/src/sqlite/runInterval.cs
index 307afef..bff0758 100644
--- a/src/sqlite/runInterval.cs
+++ b/src/sqlite/runInterval.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqliteRunInterval : SqliteRun
{
- public SqliteRunInterval() {
- }
+ public SqliteRunInterval (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteRunInterval() {}
diff --git a/src/sqlite/runType.cs b/src/sqlite/runType.cs
index 71c4c12..f8c7a12 100644
--- a/src/sqlite/runType.cs
+++ b/src/sqlite/runType.cs
@@ -27,8 +27,9 @@ using Mono.Data.Sqlite;
public class SqliteRunType : Sqlite
{
- public SqliteRunType() {
- }
+ public SqliteRunType (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteRunType() {}
@@ -309,8 +310,9 @@ public class SqliteRunType : Sqlite
public class SqliteRunIntervalType : SqliteRunType
{
- public SqliteRunIntervalType() {
- }
+ public SqliteRunIntervalType (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteRunIntervalType() {}
diff --git a/src/sqlite/server.cs b/src/sqlite/server.cs
index afcc150..04467ea 100644
--- a/src/sqlite/server.cs
+++ b/src/sqlite/server.cs
@@ -28,8 +28,9 @@ using Mono.Unix; //Catalog
public class SqliteServer : Sqlite
{
- public SqliteServer() {
- }
+ public SqliteServer (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteServer() {}
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index 2191499..e93a36e 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -28,8 +28,9 @@ using Mono.Unix;
public class SqliteSession : Sqlite
{
- public SqliteSession() {
- }
+ public SqliteSession (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
~SqliteSession() {}
@@ -745,8 +746,9 @@ public class SqliteSession : Sqlite
public class SqliteServerSession : SqliteSession
{
- public SqliteServerSession() {
- }
+ public SqliteServerSession (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
protected override void createTable(string tableName)
{
diff --git a/src/sqlite/speciallity.cs b/src/sqlite/speciallity.cs
index 532f28b..736d872 100644
--- a/src/sqlite/speciallity.cs
+++ b/src/sqlite/speciallity.cs
@@ -30,6 +30,10 @@ using Mono.Unix;
public class SqliteSpeciallity : Sqlite
{
+ public SqliteSpeciallity (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
protected override void createTable()
{
dbcmd.CommandText =
diff --git a/src/sqlite/sport.cs b/src/sqlite/sport.cs
index 9c88aec..90e7dc8 100644
--- a/src/sqlite/sport.cs
+++ b/src/sqlite/sport.cs
@@ -29,6 +29,10 @@ using Mono.Unix;
public class SqliteSport : Sqlite
{
+ public SqliteSport (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
protected internal void createTable()
{
dbcmd.CommandText =
diff --git a/src/sqlite/stat.cs b/src/sqlite/stat.cs
index bfa779a..917c953 100644
--- a/src/sqlite/stat.cs
+++ b/src/sqlite/stat.cs
@@ -28,6 +28,11 @@ using Mono.Data.Sqlite;
public class SqliteStat : Sqlite
{
+
+ public SqliteStat (SqliteConnection dbcon, SqliteCommand dbcmd)
+ :base(dbcon, dbcmd)
+ {}
+
//sj, cmj, abk (no sj+)
//AllJumpsName (simple) is not managed here, is done in SjCmjAbkPlus
public ArrayList SjCmjAbk (string sessionString, bool multisession, string operationString, string
jumpType, bool showSex, bool heightPreferred)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]