public static Answers2Table GetActiveDataByPoliticianKeyNew([NotNull] string politicianKey, int commandTimeout = -1) { // Group to eliminate duplicates caused by questions in multiple issues const string cmdText = "SELECT a.PoliticianKey,a.QuestionId,a.Sequence," + "a.Answer,a.Source,a.DateStamp,a.UserName," + "a.YouTubeUrl,a.YouTubeSource,a.YouTubeSourceUrl,a.YouTubeDescription," + "a.YouTubeRunningTime,a.YouTubeSourceUrl,a.YouTubeRunningTime,a.YouTubeDate," + "a.YouTubeRefreshTime,a.YouTubeAutoDisable,a.FacebookVideoUrl," + "a.FacebookVideoDescription,a.FacebookVideoRunningTime,a.FacebookVideoDate," + "a.FacebookVideoRefreshTime,a.FacebookVideoAutoDisable FROM Answers2 a" + " INNER JOIN IssuesQuestions iq ON iq.QuestionId=a.QuestionId" + " INNER JOIN Issues2 i ON i.IssueId=iq.IssueId AND i.IsIssueOmit=0" + " INNER JOIN Questions2 q ON q.QuestionId=a.QuestionId AND q.IsQuestionOmit=0" + " WHERE PoliticianKey=@PoliticianKey AND" + " (TRIM(a.Answer) <> '' OR" + " TRIM(a.YouTubeUrl)<>'' AND NOT a.YouTubeUrl IS NULL AND (a.YouTubeAutoDisable IS NULL OR a.YouTubeAutoDisable='') OR" + " TRIM(a.FacebookVideoUrl)<>'' AND NOT a.FacebookVideoUrl IS NULL AND (a.FacebookVideoAutoDisable IS NULL OR a.FacebookVideoAutoDisable='')" + ") GROUP BY a.PoliticianKey,a.QuestionId,a.Sequence"; var cmd = VoteDb.GetCommand(cmdText, commandTimeout); VoteDb.AddCommandParameter(cmd, "PoliticianKey", politicianKey); return(Answers2.FillTable(cmd, Answers2Table.ColumnSet.All)); }
public static Answers2Table GetDataForYouTubeRefreshNew2(int maxRows, int commandTimeout = -1) { // We now do the oldest maxRows only var cmdText = "SELECT PoliticianKey,QuestionId,Sequence,Answer," + "Source,DateStamp,UserName,YouTubeUrl,YouTubeDescription,YouTubeRunningTime,YouTubeSource," + "YouTubeSourceUrl,YouTubeDate,YouTubeRefreshTime,YouTubeAutoDisable,FacebookVideoUrl," + "FacebookVideoDescription,FacebookVideoRunningTime,FacebookVideoDate," + "FacebookVideoRefreshTime,FacebookVideoAutoDisable" + $" FROM Answers2 WHERE YouTubeUrl!='' AND NOT YouTubeUrl IS NULL LIMIT {maxRows}"; var cmd = VoteDb.GetCommand(cmdText, commandTimeout); return(Answers2.FillTable(cmd, Answers2Table.ColumnSet.All)); }