private PostgreDao GetDao() { int cmdTimeout = Common.Config.CommandTimeout; PostgreDao dao = new PostgreDao(Common.Config.DenshowDbConnection, cmdTimeout); dao.Connect(); return(dao); }
public DataTable GetResultData(string tableName, string sql) { using (PostgreDao dao = GetDao()) { using (NpgsqlCommand cmd = dao.CreateCommand()) { cmd.CommandText = sql; DataTable dtt = dao.ExecuteResultSet(cmd, tableName, true); return(dtt); } } }
public NpgTableLayoutInfo GetTableLayout(string tableName) { using (PostgreDao dao = GetDao()) { using (NpgsqlCommand cmd = dao.CreateCommand()) { cmd.CommandText = Properties.Resources.GetNpgTableLayout; cmd.Parameters.AddWithValue("@schema", Common.Config.DenshowDbSchema); cmd.Parameters.AddWithValue("@tableName", tableName); DataTable dtt = dao.ExecuteResultSet(cmd, tableName, false); NpgTableLayoutInfo tableInfo = new NpgTableLayoutInfo(tableName, dtt); return(tableInfo); } } }