using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace Howest.SchemaDiscovery.CommonHelpers
{
	public static class SqlHelper
	{
		public static List<string> GetNamedParametersFromSql(string sql)
		{
			List<string> parameters = new List<string>();
			Regex expr = new Regex(@"@(\w+)", RegexOptions.Compiled);
			MatchCollection results = expr.Matches(sql);
			foreach (Match match in results)
			{
				if(!parameters.Contains(match.Value))
					parameters.Add(match.Value);
			}
			return parameters;
		}
	}
}
