public List <AscmProcedure> GetList(string queryWord) { List <AscmProcedure> list = null; try { string sql = "select a.* from (select rownum id,up.* from user_procedures up {0}) a"; string where = "", whereQueryWord = ""; if (!string.IsNullOrEmpty(queryWord)) { whereQueryWord = " up.object_name||'.'||up.PROCEDURE_NAME like upper('%" + queryWord + "%') "; } where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, " up.SUBPROGRAM_ID>0 "); where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); if (!string.IsNullOrEmpty(where)) { where = " where " + where; } sql = string.Format(sql, where); NHibernate.ISQLQuery query = YnDaoHelper.GetInstance().nHibernateHelper.FindBySQLQuery(sql); IList <AscmProcedure> ilist = query.AddEntity("a", typeof(AscmProcedure)).List <AscmProcedure>(); if (ilist != null) { list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmProcedure>(ilist); } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmProceduresView)", ex); throw ex; } return(list); }
public List <AscmProcedureArgument> GetList(string objectType, string objectName, string procedureName) { List <AscmProcedureArgument> list = null; try { if (!string.IsNullOrEmpty(objectType)) { string sql = ""; if (objectType.Trim().ToUpper() == "PROCEDURE" && !string.IsNullOrEmpty(objectName)) { sql = "select a.* from (select rownum id,ua.* from user_arguments ua where ua.OBJECT_NAME='" + objectName.Trim().ToUpper() + "') a"; } else if (objectType.ToUpper().Trim() == "PACKAGE" && !string.IsNullOrEmpty(objectName) && !string.IsNullOrEmpty(procedureName)) { sql = "select a.* from (select rownum id,ua.* from user_arguments ua where ua.PACKAGE_NAME='" + objectName.Trim().ToUpper() + "' and ua.OBJECT_NAME='" + procedureName.Trim().ToUpper() + "') a"; } NHibernate.ISQLQuery query = YnDaoHelper.GetInstance().nHibernateHelper.FindBySQLQuery(sql + " order by position"); IList <AscmProcedureArgument> ilist = query.AddEntity("a", typeof(AscmProcedureArgument)).List <AscmProcedureArgument>(); if (ilist != null) { list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmProcedureArgument>(ilist); } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmProcedureArgument)", ex); throw ex; } return(list); }
public List <AscmJobArgument> GetList(string jobName) { List <AscmJobArgument> list = null; try { if (!string.IsNullOrEmpty(jobName)) { string sql = "select a.* from (select rownum id," + "usja.JOB_NAME," + "usja.ARGUMENT_NAME," + "usja.ARGUMENT_POSITION," + "usja.ARGUMENT_TYPE," + "usja.value," + "usja.OUT_ARGUMENT" + " from user_scheduler_job_args usja where usja.JOB_NAME='" + jobName.Trim().ToUpper() + "') a"; NHibernate.ISQLQuery query = YnDaoHelper.GetInstance().nHibernateHelper.FindBySQLQuery(sql); IList <AscmJobArgument> ilist = query.AddEntity("a", typeof(AscmJobArgument)).List <AscmJobArgument>(); if (ilist != null) { list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmJobArgument>(ilist); } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmJobArgument)", ex); throw ex; } return(list); }
/// <summary> /// 按SQL查询 /// </summary> /// <param name="sql"></param> /// <param name="_sqlParams"></param> /// <returns></returns> public static IList FindBySql(string sql, object[] _sqlParams) { IList rst = (IList)ActiveRecordBase <T> .Execute( delegate(NHibernate.ISession session, object instance) { NHibernate.ISQLQuery iSQLQuery = session.CreateSQLQuery(sql); if (_sqlParams != null && _sqlParams.Length > 0) { for (int i = 0; i < _sqlParams.Length; i++) { iSQLQuery.SetParameter(i, _sqlParams[i]); } } return(iSQLQuery.List()); }, null); return(rst); }