public string GetDeleteByIdSql <T>() { var table = OracleCache.GetTableEntity <T>(); CommonUtil.CheckTableKey(table); return(table.DeleteByIdSql); }
public string GetInsertIdentitySql <T>() { var table = OracleCache.GetTableEntity <T>(); CommonUtil.CheckTableKey(table); return(table.InsertIdentitySql); }
public string GetExistsKeySql <T>() { var table = OracleCache.GetTableEntity <T>(); CommonUtil.CheckTableKey(table); return(string.Format("SELECT COUNT(1) FROM \"{0}\" WHERE \"{1}\"=:{1}", table.TableName, table.KeyName)); }
public string GetBySkipTakeSql <T>(int skip, int take, string where, string returnFields, string orderBy) { var table = OracleCache.GetTableEntity <T>(); StringBuilder sb = new StringBuilder(); InitPage(sb, table, skip, take, where, returnFields, orderBy); return(sb.ToString()); }
public string GetInsertReturnIdSql <T>(string sequence = null) { if (string.IsNullOrEmpty(sequence)) { throw new Exception("oracle [sequence] can't no be null or empty"); } return((OracleCache.GetTableEntity <T>().InsertReturnIdSql).Replace("```seq```", sequence)); }
public string GetByWhereSql <T>(string where, string returnFields, string orderBy) { var table = OracleCache.GetTableEntity <T>(); if (string.IsNullOrEmpty(returnFields)) { returnFields = table.AllFields; } return(string.Format("SELECT {0} FROM \"{1}\" {2} {3}", returnFields, table.TableName, where, orderBy)); }
public string GetByIdsWithFieldSql <T>(string field, string returnFields) { var table = OracleCache.GetTableEntity <T>(); if (string.IsNullOrEmpty(returnFields)) { returnFields = table.AllFields; } return(string.Format("SELECT {0} FROM \"{1}\" WHERE \"{2}\" IN :ids", returnFields, table.TableName, field)); }
public string GetUpdateSql <T>(string updateFields) { var table = OracleCache.GetTableEntity <T>(); CommonUtil.CheckTableKey(table); if (string.IsNullOrEmpty(updateFields)) { return(table.UpdateSql); } return(CommonUtil.CreateUpdateSql(table, updateFields, "\"", "\"", ":")); }
public string GetSchemaTableSql <T>(string returnFields) { var table = OracleCache.GetTableEntity <T>(); if (string.IsNullOrEmpty(returnFields)) { return(string.Format("SELECT {0} FROM \"{1}\" WHERE rownum=0", table.AllFields, table.TableName)); } else { return(string.Format("SELECT {0} FROM \"{1}\" WHERE rownum=0", returnFields, table.TableName)); } }
public string GetAllSql <T>(string returnFields, string orderBy) { var table = OracleCache.GetTableEntity <T>(); if (string.IsNullOrEmpty(returnFields)) { return(table.GetAllSql + orderBy); } else { return(string.Format("SELECT {0} FROM \"{1}\" {2}", returnFields, table.TableName, orderBy)); } }
public string GetByIdsSql <T>(string returnFields) { var table = OracleCache.GetTableEntity <T>(); CommonUtil.CheckTableKey(table); if (string.IsNullOrEmpty(returnFields)) { return(table.GetByIdsSql); } else { return(string.Format("SELECT {0} FROM \"{1}\" WHERE \"{2}\" IN :ids", returnFields, table.TableName, table.KeyName)); } }
public string GetByWhereFirstSql <T>(string where, string returnFields) { var table = OracleCache.GetTableEntity <T>(); if (string.IsNullOrEmpty(returnFields)) { returnFields = table.AllFields; } if (!string.IsNullOrEmpty(where)) { where += " AND rownum=1"; } else { where = "WHERE rownum=1"; } return(string.Format("SELECT {0} FROM \"{1}\" {2}", returnFields, table.TableName, where)); }
public string GetUpdateByWhereSql <T>(string where, string updateFields) { var table = OracleCache.GetTableEntity <T>(); return(CommonUtil.CreateUpdateByWhereSql(table, where, updateFields, "\"", "\"", ":")); }
public string GetInsertSql <T>() { return(OracleCache.GetTableEntity <T>().InsertSql); }
public string GetTotalSql <T>(string where) { var table = OracleCache.GetTableEntity <T>(); return(string.Format("SELECT COUNT(1) FROM \"{0}\" {1}", table.TableName, where)); }
public string GetDeleteAllSql <T>() { return(OracleCache.GetTableEntity <T>().DeleteAllSql); }