public ArrayList GetSelectedSessions(string sessionsString) { ArrayList sendSelectedSessions = new ArrayList(1); string [] sessionsStrFull = sessionsString.Split(new char[] { ':' }); for (int j = 0; j < sessionsStrFull.Length; j++) { Session tempSession = SqliteSession.Select(sessionsStrFull[j]); sendSelectedSessions.Add(tempSession.UniqueID + ":" + tempSession.Name + ":" + tempSession.DateShort); } return(sendSelectedSessions); }
public void ShouldSelect() { var sut = new SqliteSession("Data Source=TestDatabase.sqlite"); var result = sut.Select( "SELECT * FROM SqliteTestTableTwo WHERE Id IN (@Id1, @Id2)", new ParameterSet { new Parameter <int>("Id1", 1), new Parameter <int>("Id2", 2) }).ToList(); Assert.That(result.Count, Is.EqualTo(2)); Assert.That(result[0]["Id"], Is.EqualTo(1)); Assert.That(result[0]["TestValue"], Is.EqualTo(5)); Assert.That(result[1]["Id"], Is.EqualTo(2)); Assert.That(result[1]["TestValue"], Is.EqualTo(6)); }
public Report(int sessionID) { this.SessionID = sessionID; ShowCurrentSessionData = true; ShowCurrentSessionJumpers = true; ShowSimpleJumps = true; ShowReactiveJumps = true; ShowSimpleRuns = true; ShowIntervalRuns = true; ShowReactionTimes = true; ShowPulses = true; spreadsheetString = ""; StatisticsData = new ArrayList(1); mySession = SqliteSession.Select(sessionID.ToString()); }
public Session Select(string myUniqueID) { if (type == DatabaseType.DEFAULT) { return(SqliteSession.Select(myUniqueID)); } else { // This code could be refactored from existing code in SqliteSession::Select() SqliteGeneral sqliteGeneral = new SqliteGeneral(databasePath); SqliteCommand dbcommand = sqliteGeneral.command(); dbcommand.CommandText = "SELECT * FROM Session WHERE uniqueID == @myUniqueID"; dbcommand.Parameters.Add(new SqliteParameter("@myUniqueID", myUniqueID)); SqliteDataReader reader = dbcommand.ExecuteReader(); // Copied from a non-callable (yet) static method: SqliteSession::Select() string [] values = new string[9]; while (reader.Read()) { values[0] = reader[0].ToString(); values[1] = reader[1].ToString(); values[2] = reader[2].ToString(); values[3] = reader[3].ToString(); values[4] = reader[4].ToString(); values[5] = reader[5].ToString(); values[6] = reader[6].ToString(); values[7] = reader[7].ToString(); values[8] = reader[8].ToString(); } Session mySession = new Session(values[0], values[1], values[2], UtilDate.FromSql(values[3]), Convert.ToInt32(values[4]), Convert.ToInt32(values[5]), Convert.ToInt32(values[6]), values[7], Convert.ToInt32(values[8])); return(mySession); } }