Skip to content

Commit

Permalink
refactored
Browse files Browse the repository at this point in the history
Eliminated unnecessary method from DBHelper.
  • Loading branch information
sethreno committed Sep 5, 2013
1 parent 04e569d commit c5b0478
Show file tree
Hide file tree
Showing 4 changed files with 300 additions and 304 deletions.
2 changes: 1 addition & 1 deletion model/BatchSqlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal enum State {
InQuotes
}

internal class BatchSqlParser {
public class BatchSqlParser {
private static bool IsWhitespace(char c) {
return Regex.Match(c.ToString(), "\\s", RegexOptions.Multiline).Success;
}
Expand Down
6 changes: 1 addition & 5 deletions model/DBHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void ExecBatchSql(string conn, string sql) {
using (var cn = new SqlConnection(conn)) {
cn.Open();
using (SqlCommand cm = cn.CreateCommand()) {
foreach (string script in SplitBatchSql(sql)) {
foreach (string script in BatchSqlParser.SplitBatch(sql)) {
if (EchoSql) Console.WriteLine(script);
cm.CommandText = script;
try {
Expand All @@ -38,10 +38,6 @@ public static void ExecBatchSql(string conn, string sql) {
}
}

public static string[] SplitBatchSql(string batchSql) {
return BatchSqlParser.SplitBatch(batchSql);
}

public static void DropDb(string conn) {
var cnBuilder = new SqlConnectionStringBuilder(conn);
string dbName = cnBuilder.InitialCatalog;
Expand Down
Loading

0 comments on commit c5b0478

Please sign in to comment.