/// <summary> /// 与查询条件合并成一个where /// </summary> /// <param name="s"></param> /// <returns></returns> public string union(SqlWhereMerge s) { var sql = this.to_sql(); if (string.IsNullOrEmpty(sql)) { return(s.to_sql()); } return(sql + " and " + s.to_sql()); }
public bool exist_same_file(string name, string pid) { SqlWhereMerge swm = new SqlWhereMerge(); swm.equal("f_nameLoc", name.Trim()); swm.equal("f_pid", pid.Trim()); swm.equal("f_deleted", 0); string sql = string.Format("select f_id from up6_files where {0} ", swm.to_sql()); DBConfig cfg = new DBConfig(); SqlExec se = cfg.se(); var arr = (JArray)se.exec("up6_files", sql, "f_id", string.Empty); return(arr.Count > 0); }
public bool exist_same_folder(string name, string pid) { DBConfig cfg = new DBConfig(); SqlWhereMerge swm = new SqlWhereMerge(); swm.equal("f_nameLoc", name.Trim()); swm.equal("f_deleted", 0); if (cfg.m_isOracle) { if (string.IsNullOrEmpty(pid)) { pid = " "; } swm.equal("nvl(f_pid,' ')", pid); } else { swm.equal("LTRIM (f_pid)", pid.Trim()); } string sql = string.Format("select f_id from up6_files where {0} " + " union select f_id from up6_folders where {0}", swm.to_sql()); SqlExec se = cfg.se(); var fid = (JArray)se.exec("up6_files", sql, "f_id", string.Empty); return(fid.Count > 0); }