Azavea.Open.DAO.SQL.SqlUtilities.MakeDeleteStatement C# (CSharp) Method

MakeDeleteStatement() public static method

Generates a delete statement to delete rows where "key" = whereCols["key"] for everything in whereCols.
public static MakeDeleteStatement ( string table, object>.IDictionary whereCols, IList sqlParams ) : string
table string Name of the table to be inserted into.
whereCols object>.IDictionary Dictionary of object column values keyed by string column names. /// These columns are used in the "where" clause of the statement. If /// this collection is null or empty, all rows will be updated.
sqlParams IList List to insert sql param values (in order) into.
return string
        public static string MakeDeleteStatement(string table, IDictionary<string, object> whereCols,
            IList<object> sqlParams)
        {
            // Create the string list of where clauses (and put the matching values in sqlParams).
            StringBuilder sb = DbCaches.StringBuilders.Get();
            sb.Append("DELETE FROM ");
            sb.Append(table);
            sb.Append(MakeWhereClause(whereCols, sqlParams));
            string retVal = sb.ToString();
            DbCaches.StringBuilders.Return(sb);
            return retVal;
        }