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;
            }
  • 相关阅读:
    第3章 文件I/O(4)_dup、dup2、fcntl和ioctl函数
    第3章 文件I/O(3)_内核数据结构、原子操作
    MyBatis Geneator详解<转>
    MapReduce原理<转>
    maven配置nexus
    myeclipse 上安装 Maven3<转>
    Lucene 工作原理<转>
    获取本工程的真实路径
    webservice文件上传下载
    fastjson常用操作
  • 原文地址:https://www.cnblogs.com/dullbaby/p/5646307.html
Copyright © 2011-2022 走看看