private void FetchKeys(AbstractQuery query) { if (onKeysRequired != null) { List<string> columns = new List<string>(); if (query.Rows.Count > 0) { foreach (string column in query.Rows[0].Keys) { columns.Add(column); } } query.Keys.AddRange(onKeysRequired(this,columns)); } else { throw new Exception("Keys required but no handler exists."); } }
private void WriteToFile(AbstractQuery query) { if (createQueryWriter == null) { throw new Exception("No query writer was specified."); } using (StreamWriter writer = new StreamWriter(DestinationFilename)) { QueryWriter queryWriter = createQueryWriter(); queryWriter.Write(query, writer); writer.Close(); } }
private void HandleQuery(AbstractQuery query) { query.Table = DestinationTable; query.Rows.AddRange(DataAccess.DataAccess.Instance.FetchData(ConnectionString, Sql)); if (query.KeysRequired) { FetchKeys(query); } }