//'从SQL MAP 命令配置文件获取命名参数信息 //Public Function GetCommandParameters() As IDataParameter() // If _SqlMapScript = String.Empty Then // Throw New Exception("未初始化命名信息,请先执行 InitCommandInfo 方法!") // End If // Return GetParameters(_SqlMapScript) //End Function #endregion #region "公开的方法" /// <summary> /// 获得配置命令信息 /// </summary> /// <param name="XmlCommandName">配置文件中的命令名称</param> /// <returns>命令信息</returns> public CommandInfo GetCommandInfo(string XmlCommandName) { XmlCommand xmlCommand = new XmlCommand(SqlMapFile, this.DataBaseType); if (!string.IsNullOrEmpty(CommandClassName)) { xmlCommand.CommandClassName = CommandClassName; } _SqlMapScript = xmlCommand.GetCommand(XmlCommandName); if (string.IsNullOrEmpty(_SqlMapScript)) { string errMsg = "没有找到配置信息中的命令:" + XmlCommandName; if (!string.IsNullOrEmpty(xmlCommand.ErrDescription)) { errMsg += "。内部错误原因:" + xmlCommand.ErrDescription; } throw new Exception(errMsg); } CommandInfo cmdInfo = new CommandInfo(this.DataBaseType); cmdInfo.ParaChar = this.ParaChar; cmdInfo.CommandType = xmlCommand.CommandType; cmdInfo.CommandText = GetScriptInfo(_SqlMapScript);//必须先分析脚本信息 cmdInfo.DataParameters = GetParameters(_SqlMapScript); //处理存储过程名中的参数 if (cmdInfo.CommandType == CommandType.StoredProcedure) { cmdInfo.CommandText = FindWords(cmdInfo.CommandText, 0, 255); } return(cmdInfo); //_CommandType = xmlCommand.CommandType; //_DataParameters = GetParameters(_SqlMapScript); }
//'从SQL MAP 命令配置文件获取命名参数信息 //Public Function GetCommandParameters() As IDataParameter() // If _SqlMapScript = String.Empty Then // Throw New Exception("未初始化命名信息,请先执行 InitCommandInfo 方法!") // End If // Return GetParameters(_SqlMapScript) //End Function #endregion #region "公开的方法" /// <summary> /// 获得配置命令信息 /// </summary> /// <param name="XmlCommandName">配置文件中的命令名称</param> /// <returns>命令信息</returns> public CommandInfo GetCommandInfo(string XmlCommandName) { XmlCommand xmlCommand = new XmlCommand(SqlMapFile, this.DataBaseType ); if (!string.IsNullOrEmpty(CommandClassName)) { xmlCommand.CommandClassName = CommandClassName; } _SqlMapScript = xmlCommand.GetCommand(XmlCommandName); if (string.IsNullOrEmpty(_SqlMapScript)) { string errMsg = "没有找到配置信息中的命令:" + XmlCommandName; if (!string.IsNullOrEmpty(xmlCommand.ErrDescription)) errMsg += "。内部错误原因:" + xmlCommand.ErrDescription; throw new Exception(errMsg ); } CommandInfo cmdInfo = new CommandInfo(this.DataBaseType ); cmdInfo.ParaChar = this.ParaChar; cmdInfo.CommandType = xmlCommand.CommandType; cmdInfo.CommandText = GetScriptInfo(_SqlMapScript);//必须先分析脚本信息 cmdInfo.DataParameters = GetParameters(_SqlMapScript); //处理存储过程名中的参数 if (cmdInfo.CommandType == CommandType.StoredProcedure) { cmdInfo.CommandText = FindWords(cmdInfo.CommandText, 0, 255); } return cmdInfo; //_CommandType = xmlCommand.CommandType; //_DataParameters = GetParameters(_SqlMapScript); }