public int Execute(string sql, object module) { SQLParser parser = new SQLParser(); parser.Parse(sql, module); return(Execute(parser.AsSql(), parser.GetSqlParameterNames(), parser.GetSqlParameterValues())); }
public DataRow Find(string sql, object module) { SQLParser parser = new SQLParser(); parser.Parse(sql, module); return(Find(parser.AsSql(), parser.GetSqlParameterNames(), parser.GetSqlParameterValues())); }
public DataTable Query(string sql, object module) { SQLParser parser = new SQLParser(); parser.Parse(sql, module); string limitSql = parser.AsSql(); string[] paramNames = parser.GetSqlParameterNames(); object[] paramValues = parser.GetSqlParameterValues(); BaseSO so = module as BaseSO; if (so != null && so.PageIndex != BaseSO.PAGE_INDEX_NO_PAGE) { TransactionContext tranContext = TransactionContext.get(); this.dbType = tranContext.dbType; Dialect dialect = Dialect.GetDialect(dbType); if (so.PageIndex != BaseSO.PAGE_INDEX_NO_TOTAL) { string countSql = dialect.GetCountSql(limitSql); so.Total = GetLong(countSql, paramNames, paramValues); } limitSql = dialect.GetLimitSql(limitSql, so.PageIndex, so.PageSize); string[] limitParamNames = dialect.GetLimitParamNames(so.PageIndex, so.PageSize); object[] limitParamValues = dialect.GetLimitParamValues(so.PageIndex, so.PageSize); string[] tempParamNames = new string[limitParamNames.Length + paramNames.Length]; object[] tempParamValues = new object[tempParamNames.Length]; paramNames.CopyTo(tempParamNames, 0); limitParamNames.CopyTo(tempParamNames, paramNames.Length); paramNames = tempParamNames; paramValues.CopyTo(tempParamValues, 0); limitParamValues.CopyTo(tempParamValues, paramValues.Length); paramValues = tempParamValues; } return(Query(limitSql, paramNames, paramValues)); }