/// <summary> /// Run the provided query against the source database to get the data to be moved. /// </summary> /// <param name="server">ip or name of the source database</param> /// <param name="keyspace">name of the keyspace to use for the source query</param> /// <param name="query">query to get source data</param> /// <param name="gotSourceData">Data retrieved</param> /// <param name="sourceData">indicator of if an error was thrown</param> private static void GetSourceData(string server, string keyspace, string query, TransferResultsInfo info, out bool gotSourceData, out List <dynamic> sourceData) { sourceData = new List <dynamic>(); gotSourceData = true; try { CqlConnection srcConn = new CqlConnection("Contact Points=" + server, server); CqlCommand srcCmd = new CqlCommand(); srcConn.Open(); srcConn.ChangeDatabase(keyspace); srcCmd.Connection = srcConn; srcCmd.CommandType = CommandType.Text; srcCmd.CommandText = query; sourceData = srcCmd.ExecuteDynamics(); info.SourceCount = sourceData.Count; //cleanup srcCmd.Connection.Close(); srcCmd.Connection.Dispose(); srcCmd.Dispose(); } catch (Exception ex) { info.Message = "Error getting source data: \r\n" + ex.Message; gotSourceData = false; } }