/// <summary> /// Checks all parameters exist in SQL command. Will throw an Exception if a parameter is missing. /// </summary> /// <param name="theParamsSetInSqlCommand">The parameters set in SQL command.</param> /// <param name="parameters">The parameters.</param> private static void CheckAllParametersExistInSqlCommand(HashSet <string> theParamsSetInSqlCommand, AceQLParameterCollection parameters) { HashSet <string> parameterNames = new HashSet <string>(); for (int i = 0; i < parameters.Count; i++) { String theParm = parameters[i].ToString(); parameterNames.Add(theParm); } List <string> theParamsListInSqlCommand = theParamsSetInSqlCommand.ToList(); foreach (string theParamInSqlCommand in theParamsListInSqlCommand) { if (!parameterNames.Contains(theParamInSqlCommand)) { throw new ArgumentException("Missing parameter value for parameter name: " + theParamInSqlCommand); } } }
/// <summary> /// Initializes a new instance of the <see cref="AceQLCommandUtil"/> class. /// </summary> /// <param name="cmdText">The command text.</param> /// <param name="Parameters">The parameters.</param> /// <exception cref="System.ArgumentNullException"> /// cmdText is null! /// or /// Parameters is null! /// </exception> internal AceQLCommandUtil(String cmdText, AceQLParameterCollection Parameters) { this.cmdText = cmdText ?? throw new ArgumentNullException("cmdText is null!"); this.Parameters = Parameters ?? throw new ArgumentNullException("Parameters is null!"); }