• Ibatis 测试出SQL


    String sql = Brg.Global.Map.BaseBatis.GetRuntimeSql("select_T_JewelleryProductType", _Model);
     /// <summary>
            /// 得到运行时ibatis.net动态生成的SQL
            /// </summary>
            /// <param name="sqlMapper"></param>
            /// <param name="statementName"></param>
            /// <param name="paramObject"></param>
            /// <returns></returns>
            public static string GetRuntimeSql(string statementName, object paramObject)
            {
                string result = string.Empty;
                try
                {
                    IMappedStatement statement = SqlMap.GetMappedStatement(statementName);
                    if (!SqlMap.IsSessionStarted)
                    {
                        SqlMap.OpenConnection();
                    }
                    RequestScope scope = statement.Statement.Sql.GetRequestScope(statement, paramObject, SqlMap.LocalSession);
                    result = scope.PreparedStatement.PreparedSql;
                }
                catch (Exception ex)
                {
                    result = "获取SQL语句出现异常:" + ex.Message;
                }
                return result;
            }
  • 相关阅读:
    tyvj1061Mobile Service
    POJ3666序列最小差值
    POJ2279杨氏矩阵+钩子定理
    POJ2127 LICS模板
    codevs2189数字三角形(%100)
    qhfl-7 结算中心
    qhfl-6 购物车
    qhfl-5 redis 简单操作
    qhfl-4 注册-登录-认证
    qhfl-3 Course模块
  • 原文地址:https://www.cnblogs.com/dullbaby/p/5646307.html
Copyright © 2020-2023  润新知