5 |
|
using System.Data.Common; |
6 |
|
using System.Data; |
7 |
|
using System.Text.RegularExpressions; |
8 |
+ |
using System.IO; |
9 |
+ |
|
10 |
|
|
11 |
|
namespace AnywhereTS.DBSupport |
12 |
|
{ |
301 |
|
} |
302 |
|
#endregion |
303 |
|
#region public string[] ParseScriptToCommands(string strScript) |
304 |
< |
public string[] ParseScriptToCommands(string strScript) |
305 |
< |
{ |
304 |
< |
string[] commands; |
305 |
< |
commands = strScript.Split(new string[] { string.Format("GO{0}", System.Environment.NewLine) }, StringSplitOptions.RemoveEmptyEntries); |
306 |
< |
return commands; |
307 |
< |
} |
304 |
> |
|
305 |
> |
protected abstract bool ClientRunScript(string strFile, out Exception ErrorInfo); |
306 |
|
#endregion |
307 |
|
#region public virtual bool RunScript(string strFile, out Exception ErrorInfo) |
308 |
|
public bool RunScript(string strFile, out Exception ErrorInfo) |
310 |
|
ErrorInfo = null; |
311 |
|
try |
312 |
|
{ |
315 |
– |
string[] strCommands; |
316 |
– |
strCommands = ParseScriptToCommands(strFile); |
313 |
|
if (this.ConnectionIsOpen) |
314 |
|
{ |
315 |
< |
if (!ClientRunScript(strCommands, out ErrorInfo)) |
315 |
> |
if (!ClientRunScript(strFile, out ErrorInfo)) |
316 |
|
{ |
317 |
|
return false; |
318 |
|
} |
341 |
|
} |
342 |
|
return false; |
343 |
|
} |
348 |
– |
public abstract bool ClientRunScript(string[] strCommands, out Exception ErrorInfo); |
344 |
|
#endregion |
345 |
|
#endregion |
346 |
|
|