private static IEnumerable <string> GetObjectOfType(this SQLiteGateWay SQLiteGateWay, string ObjectType, string regexp = "%") => SQLiteGateWay .GetDt("SELECT name FROM sqlite_master WHERE type =:ObjectType AND name like :name order by name", new SQLiteParameter("name", "%" + regexp + "%"), new SQLiteParameter("ObjectType", ObjectType)) .Rows .Cast <DataRow>() .Select(x => x[0].ToString());
public static ExcelPackage WriteDataBaseToExcel(this SQLiteGateWay SQLiteGateWay, IEnumerable <string> TableNames) { var ExcelPackage = new ExcelPackage(); foreach (var TableName in TableNames.ToList()) { var worksheet = ExcelPackage.Workbook.Worksheets.Add(TableName); var DataTable = SQLiteGateWay.GetDt(string.Format("select * from '{0}'", TableName)); if (DataTable.Columns.Count > 0) { worksheet.Cells["A1"].LoadFromDataTable(DataTable, true); } } return(ExcelPackage); }
public static IEnumerable <string> GetColumnNames(this SQLiteGateWay SQLiteGateWay, string TableName) => SQLiteGateWay .GetDt($"select * from '{TableName}' where 1=0") .GetColumnNames();
public static bool ViewExists(this SQLiteGateWay SQLiteGateWay, string TableName) => SQLiteGateWay .GetDt("SELECT name FROM sqlite_master WHERE type='view' AND name=:TableName", new SQLiteParameter("TableName", TableName)) .Rows .Count == 1;