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;
            }
  • 相关阅读:
    谈执着
    SQL表自连接用法
    Mysql group by 排序问题
    php自动生成mysql的触发代码。
    XSS CSRF 攻击
    [微信开发利器]微信内移动前端开发抓包调试工具fiddler使用教程
    微信JS-SDK]微信公众号JS开发之卡券领取功能详解
    优化与重构的思考
    c语言 13
    c语言 13
  • 原文地址:https://www.cnblogs.com/dullbaby/p/5646307.html
Copyright © 2011-2022 走看看