public static bool DatabaseHelperRunScriptByStatements( DirectoryInfo scriptDirectory, string overrideConnectionInfo) { if (scriptDirectory == null) { return(false); } bool result = false; FileInfo[] scriptFiles = scriptDirectory.GetFiles("*.config"); Array.Sort(scriptFiles, CompareFileNames); foreach (FileInfo scriptFile in scriptFiles) { if ( (overrideConnectionInfo == null) || (overrideConnectionInfo.Length == 0) ) { overrideConnectionInfo = GetConnectionString(); } result = FBSqlHelper.ExecuteBatchScript( overrideConnectionInfo, scriptFile.FullName); } return(result); }
public static bool DatabaseHelperRunScript( FileInfo scriptFile, String overrideConnectionInfo) { if (scriptFile == null) { return(false); } if ( (overrideConnectionInfo == null) || (overrideConnectionInfo.Length == 0) ) { overrideConnectionInfo = GetConnectionString(); } if (scriptFile.FullName.EndsWith(".config")) { string pathToScripts = scriptFile.FullName.Replace(".config", string.Empty); if (Directory.Exists(pathToScripts)) { DirectoryInfo scriptDirectory = new DirectoryInfo(pathToScripts); FileInfo[] scriptFiles = scriptDirectory.GetFiles("*.config"); Array.Sort(scriptFiles, CompareFileNames); foreach (FileInfo file in scriptFiles) { bool result = FBSqlHelper.ExecuteBatchScript( overrideConnectionInfo, file.FullName); if (!result) { log.Error("Failed with no exception running script " + file.FullName); } } } return(true); } return(false); }