public IList <FuncRefInfo> LoadFuncInfoRefs(string catalogs) { string sql = "SELECT f.funcname,r.assemblyname,r.classname FROM rpt_func_ref r,rpt_func f WHERE r.funcphid = f.phid AND f.catalogid IN ({0}) order by f.catalogid"; sql = string.Format(sql, catalogs); var datas = this.QueryForDataTable(sql); if (datas == null) { throw new FuncException("无法从数据库加载公式反射信息"); } IList <FuncRefInfo> funcRefInfoList = new List <FuncRefInfo>(); foreach (DataRow dr in datas.Rows) { FuncRefInfo refInfo = new FuncRefInfo(); refInfo.FuncName = dr["funcname"].TryGetString(); refInfo.AssemblyName = dr["assemblyname"].TryGetString(); refInfo.ClassName = dr["classname"].TryGetString(); funcRefInfoList.Add(refInfo); } return(funcRefInfoList); }
public static bool AddFuncRefInfo(string funcName, FuncRefInfo refInfo) { if (string.IsNullOrEmpty(funcName)) { return(false); } return(funcRefInfoMetaCache.TryAdd(funcName.ToUpper(), refInfo)); }
public override void CheckSemantic(MoveInfo treeInfo, ScriptInfo scriptInfo, CheckingInfo checkingInfo) { if (!String.IsNullOrEmpty(this._pathOrUsing)) { CheckSemanticExtern(treeInfo, scriptInfo, checkingInfo); } else { CheckSemanticLocal(treeInfo, scriptInfo, checkingInfo); } if (_funcInfo != null) { if (Arguments.Count > _funcInfo.Parameters.Count) { if (_funcInfo.SF.IsExtern) // codapi funcs -> only warning { scriptInfo.SF.Errors.Add( new WarningError("Function '" + _funcInfo.ToString() + "' has more arguments than parameters in the definition", treeInfo.GetErrorInfo(treeInfo.Current))); } else { scriptInfo.SF.Errors.Add( new SemanticError("Function '" + _funcInfo.ToString() + "' has more arguments than parameters in the definition", treeInfo.GetErrorInfo(treeInfo.Current))); } } if ((_funcInfo.OptParamStartIndex != null && Arguments.Count < _funcInfo.OptParamStartIndex) || (_funcInfo.OptParamStartIndex == null && Arguments.Count < _funcInfo.Parameters.Count)) { scriptInfo.SF.Errors.Add( new WarningError("Could not find enough arguments, function '" + _funcInfo.ToString() + "'", treeInfo.GetErrorInfo(treeInfo.Current))); } FuncRefInfo funcRefInfo = new FuncRefInfo(scriptInfo.SF, _funcInfo, this.CharIndex, this.CharLength, checkingInfo.SC.SourceCode.Substring(this.CharIndex, this.CharLength), true); foreach (Expression arg in this.Arguments) { funcRefInfo.AddArgument(arg.CharIndex, arg.CharLength); } scriptInfo.References.Add(funcRefInfo); } }