zoukankan      html  css  js  c++  java
  • 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;
            }
  • 相关阅读:
    phpcms v9模板制作常用代码集合
    phpcms v9模板制作教程
    cookie 和session 的区别
    PHP的加密方式
    php基础
    复习 语句
    empty 和 isset的区别和联系
    MySQL数据库引擎介绍、区别、创建和性能测试的深入分析
    ThinkPHP增删改查--改
    使用ajax提交form表单,包括ajax文件上传
  • 原文地址:https://www.cnblogs.com/dullbaby/p/5646307.html
Copyright © 2011-2022 走看看