public static List<string> ExtractQueries(string[] Lines)
{
List<string> Queries = new List<string>();
StringBuilder Query = new StringBuilder();
// Add each query to the Queries list
foreach (string line in Lines)
{
// Trim line, and make sure its not a comment of any kind
string TrimLine = line.Trim();
if (!String.IsNullOrEmpty(TrimLine) && !TrimLine.StartsWith("#") && !TrimLine.StartsWith("--"))
{
// Is the query complete?
if (TrimLine.EndsWith(";"))
{
Query.Append(TrimLine);
Queries.Add(Query.ToString());
Query.Clear();
}
else
Query.Append(TrimLine);
}
}
return Queries;
}