//if all persons, put -1 in personID //if all types put, "" in filterType public static string[] SelectReactionTimes(bool dbconOpened, int sessionID, int personID, string filterType, Orders_by order, int limit) { if (!dbconOpened) { Sqlite.Open(); } string tp = Constants.PersonTable; string filterPersonString = ""; if (personID != -1) { filterPersonString = " AND " + tp + ".uniqueID = " + personID; } string filterTypeString = ""; if (filterType != "") { filterTypeString = " AND reactionTime.type == \"" + filterType + "\" "; } string orderByString = " ORDER BY upper(" + tp + ".name), reactionTime.uniqueID"; if (order == Orders_by.ID_DESC) { orderByString = " ORDER BY reactionTime.uniqueID DESC "; } string limitString = ""; if (limit != -1) { limitString = " LIMIT " + limit; } dbcmd.CommandText = "SELECT " + tp + ".name, reactionTime.* " + " FROM " + tp + ", reactionTime " + " WHERE " + tp + ".uniqueID = reactionTime.personID" + " AND reactionTime.sessionID = " + sessionID + filterPersonString + filterTypeString + orderByString + limitString; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList myArray = new ArrayList(2); int count = new int(); count = 0; while (reader.Read()) { myArray.Add(reader[0].ToString() + ":" + //person.name reader[1].ToString() + ":" + //uniqueID reader[2].ToString() + ":" + //personID reader[3].ToString() + ":" + //sessionID reader[4].ToString() + ":" + //type Util.ChangeDecimalSeparator(reader[5].ToString()) + ":" + //time reader[6].ToString() + ":" + //description reader[7].ToString() //simulated ); count++; } reader.Close(); if (!dbconOpened) { Sqlite.Close(); } string [] myEvents = new string[count]; count = 0; foreach (string line in myArray) { myEvents [count++] = line; } return(myEvents); }
//if all sessions, put -1 in sessionID //if all persons, put -1 in personID //if all types put, "" in filterType //unlimited put -1 in limit public static string[] SelectJumps(bool dbconOpened, int sessionID, int personID, string filterWeight, string filterType, Orders_by order, int limit) { if (!dbconOpened) { Sqlite.Open(); } string tp = Constants.PersonTable; string tps = Constants.PersonSessionTable; string filterSessionString = ""; if (sessionID != -1) { filterSessionString = " AND jump.sessionID == " + sessionID; } string filterPersonString = ""; if (personID != -1) { filterPersonString = " AND " + tp + ".uniqueID == " + personID; } string filterWeightString = ""; if (filterWeight == "withWeight") { filterWeightString = " AND jump.weight != 0 "; } string filterTypeString = ""; if (filterType != "") { filterTypeString = " AND jump.type == \"" + filterType + "\" "; } string orderByString = " ORDER BY upper(" + tp + ".name), jump.uniqueID "; if (order == Orders_by.ID_DESC) { orderByString = " ORDER BY jump.uniqueID DESC "; } string limitString = ""; if (limit != -1) { limitString = " LIMIT " + limit; } dbcmd.CommandText = "SELECT " + tp + ".name, jump.*, " + tps + ".weight " + " FROM " + tp + ", jump, " + tps + " WHERE " + tp + ".uniqueID == jump.personID " + filterSessionString + filterPersonString + filterWeightString + filterTypeString + " AND " + tps + ".personID == " + tp + ".uniqueID " + " AND " + tps + ".sessionID == jump.sessionID " + orderByString + limitString; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList myArray = new ArrayList(2); int count = new int(); count = 0; while (reader.Read()) { myArray.Add(reader[0].ToString() + ":" + //person.name reader[1].ToString() + ":" + //jump.uniqueID reader[2].ToString() + ":" + //jump.personID reader[3].ToString() + ":" + //jump.sessionID reader[4].ToString() + ":" + //jump.type Util.ChangeDecimalSeparator(reader[5].ToString()) + ":" + //jump.tv Util.ChangeDecimalSeparator(reader[6].ToString()) + ":" + //jump.tc Util.ChangeDecimalSeparator(reader[7].ToString()) + ":" + //fall Util.ChangeDecimalSeparator(reader[8].ToString()) + ":" + //weight reader[9].ToString() + ":" + //description Util.ChangeDecimalSeparator(reader[10].ToString()) + ":" + //angle reader[11].ToString() + ":" + //simulated reader[12].ToString() //person.weight ); count++; } reader.Close(); if (!dbconOpened) { Sqlite.Close(); } string [] myJumps = new string[count]; count = 0; foreach (string line in myArray) { myJumps [count++] = line; } return(myJumps); }
//if all sessions, put -1 in sessionID //if all persons, put -1 in personID //if all types put, "" in filterType //unlimited put -1 in limit public static string[] SelectJumps(bool dbconOpened, int sessionID, int personID, string filterWeight, string filterType, Orders_by order, int limit) { if(!dbconOpened) Sqlite.Open(); string tp = Constants.PersonTable; string tps = Constants.PersonSessionTable; string filterSessionString = ""; if(sessionID != -1) filterSessionString = " AND jump.sessionID == " + sessionID; string filterPersonString = ""; if(personID != -1) filterPersonString = " AND " + tp + ".uniqueID == " + personID; string filterWeightString = ""; if(filterWeight == "withWeight") filterWeightString = " AND jump.weight != 0 "; string filterTypeString = ""; if(filterType != "") filterTypeString = " AND jump.type == \"" + filterType + "\" "; string orderByString = " ORDER BY upper(" + tp + ".name), jump.uniqueID "; if(order == Orders_by.ID_DESC) orderByString = " ORDER BY jump.uniqueID DESC "; string limitString = ""; if(limit != -1) limitString = " LIMIT " + limit; dbcmd.CommandText = "SELECT " + tp + ".name, jump.*, " + tps + ".weight " + " FROM " + tp + ", jump, " + tps + " WHERE " + tp + ".uniqueID == jump.personID " + filterSessionString + filterPersonString + filterWeightString + filterTypeString + " AND " + tps + ".personID == " + tp + ".uniqueID " + " AND " + tps + ".sessionID == jump.sessionID " + orderByString + limitString; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList myArray = new ArrayList(2); int count = new int(); count = 0; while(reader.Read()) { myArray.Add (reader[0].ToString() + ":" + //person.name reader[1].ToString() + ":" + //jump.uniqueID reader[2].ToString() + ":" + //jump.personID reader[3].ToString() + ":" + //jump.sessionID reader[4].ToString() + ":" + //jump.type Util.ChangeDecimalSeparator(reader[5].ToString()) + ":" + //jump.tv Util.ChangeDecimalSeparator(reader[6].ToString()) + ":" + //jump.tc Util.ChangeDecimalSeparator(reader[7].ToString()) + ":" + //fall Util.ChangeDecimalSeparator(reader[8].ToString()) + ":" + //weight reader[9].ToString() + ":" + //description Util.ChangeDecimalSeparator(reader[10].ToString()) + ":" + //angle reader[11].ToString() + ":" + //simulated reader[12].ToString() //person.weight ); count ++; } reader.Close(); if(!dbconOpened) Sqlite.Close(); string [] myJumps = new string[count]; count =0; foreach (string line in myArray) { myJumps [count++] = line; } return myJumps; }
//if all persons, put -1 in personID //if all types put, "" in filterType public static string[] SelectReactionTimes(bool dbconOpened, int sessionID, int personID, string filterType, Orders_by order, int limit) { if(!dbconOpened) Sqlite.Open(); string tp = Constants.PersonTable; string filterPersonString = ""; if(personID != -1) filterPersonString = " AND " + tp + ".uniqueID = " + personID; string filterTypeString = ""; if(filterType != "") filterTypeString = " AND reactionTime.type == \"" + filterType + "\" "; string orderByString = " ORDER BY upper(" + tp + ".name), reactionTime.uniqueID"; if(order == Orders_by.ID_DESC) orderByString = " ORDER BY reactionTime.uniqueID DESC "; string limitString = ""; if(limit != -1) limitString = " LIMIT " + limit; dbcmd.CommandText = "SELECT " + tp + ".name, reactionTime.* " + " FROM " + tp + ", reactionTime " + " WHERE " + tp + ".uniqueID = reactionTime.personID" + " AND reactionTime.sessionID = " + sessionID + filterPersonString + filterTypeString + orderByString + limitString; LogB.SQL(dbcmd.CommandText.ToString()); dbcmd.ExecuteNonQuery(); SqliteDataReader reader; reader = dbcmd.ExecuteReader(); ArrayList myArray = new ArrayList(2); int count = new int(); count = 0; while(reader.Read()) { myArray.Add (reader[0].ToString() + ":" + //person.name reader[1].ToString() + ":" + //uniqueID reader[2].ToString() + ":" + //personID reader[3].ToString() + ":" + //sessionID reader[4].ToString() + ":" + //type Util.ChangeDecimalSeparator(reader[5].ToString()) + ":" + //time reader[6].ToString() + ":" + //description reader[7].ToString() //simulated ); count ++; } reader.Close(); if(!dbconOpened) Sqlite.Close(); string [] myEvents = new string[count]; count =0; foreach (string line in myArray) { myEvents [count++] = line; } return myEvents; }