public void ImportAll(string directoryPath) { if (string.IsNullOrWhiteSpace(directoryPath)) { throw new ArgumentNullException("directoryPath"); } if (File.Exists(Path.Combine(directoryPath, "_SummaryInformation.idt"))) { this.Import(Path.Combine(directoryPath, "_SummaryInformation.idt")); } string[] idtFiles = Directory.GetFiles(directoryPath, "*.idt"); foreach (string file in idtFiles) { if (Path.GetFileName(file) != "_SummaryInformation.idt") { this.Import(file); } } if (Directory.Exists(Path.Combine(directoryPath, "_Streams"))) { View view = this.OpenView("SELECT `Name`, `Data` FROM `_Streams`"); Record rec = null; try { view.Execute(); string[] streamFiles = Directory.GetFiles(Path.Combine(directoryPath, "_Streams")); foreach (string file in streamFiles) { rec = this.CreateRecord(2); rec[1] = Path.GetFileName(file); rec.SetStream(2, file); view.Insert(rec); rec.Close(); rec = null; } } finally { if (rec != null) { rec.Close(); } view.Close(); } } }
public object ExecuteScalar(string sql, Record record) { if (string.IsNullOrWhiteSpace(sql)) { throw new ArgumentNullException("sql"); } View view = this.OpenView(sql); Record rec = null; try { view.Execute(record); rec = view.Fetch(); if (rec == null) { throw InstallerException.ExceptionFromReturnCode((uint)NativeMethods.Error.NO_MORE_ITEMS); } return(rec[1]); } finally { if (rec != null) { rec.Close(); } view.Close(); } }