// Test query: join LogMoodData and LogPlayData by PlayerId (fake), match where they have the same PlayerId, return MoodData public void TestQuery_JoinTables() { SQLite.TableMapping resultMapping = new SQLite.TableMapping(typeof(TestQueryResult)); string query = "select LogMoodData.MoodValue from LogMoodData inner join LogPlayData on LogMoodData.Session = LogPlayData.Session"; List <object> list = this.dbManager.FindCustomDataByQuery(resultMapping, query); string output = "Test values N: " + list.Count + "\n"; foreach (var obj in list) { output += ("Test value: " + (obj as TestQueryResult).MoodValue) + "\n"; } PrintOutput(output); }
// Test query: get just the MoodValues (with a custom result class) from all LogMoodData entries public void TestQuery_SingleTable3() { SQLite.TableMapping resultMapping = new SQLite.TableMapping(typeof(TestQueryResult)); string targetPlaySessionId = "\"5\""; string query = "select LogMoodData.MoodValue from LogMoodData where LogMoodData.Session = " + targetPlaySessionId; List <object> list = this.dbManager.FindCustomDataByQuery(resultMapping, query); string output = "Test values N: " + list.Count + "\n"; foreach (var obj in list) { output += ("Test value: " + (obj as TestQueryResult).MoodValue) + "\n"; } PrintOutput(output); }
public List <object> FindCustomDataByQuery(SQLite.TableMapping mapping, string query) { return(dynamicDb.FindByQueryCustom(mapping, query)); }