ソースを参照

HPCC-13177 Only allow #webservice to be called once

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Anthony Fishbeck 10 年 前
コミット
645d648d15
2 ファイル変更7 行追加1 行削除
  1. 2 0
      ecl/hql/hqlerrors.hpp
  2. 5 1
      ecl/hqlcpp/hqlttcpp.cpp

+ 2 - 0
ecl/hql/hqlerrors.hpp

@@ -477,6 +477,7 @@
 #define HQLERR_AtmostLegacyMismatch             3134
 #define HQLERR_PropertyArgumentNotConstant      3135
 #define HQLERR_InvalidErrorCategory             3136
+#define HQLERR_MultipleHashWebserviceCalls      3137
 
 #define HQLERR_DedupFieldNotFound_Text          "Field removed from dedup could not be found"
 #define HQLERR_CycleWithModuleDefinition_Text   "Module definition contains an illegal cycle/recursive definition %s"
@@ -515,6 +516,7 @@
 #define HQLERR_AtmostLegacyMismatch_Text        "Legacy JOIN condition on field[1..*] should be included in the optional fields"
 #define HQLERR_PropertyArgumentNotConstant_Text "The argument to attribute '%s' must be a constant"
 #define HQLERR_InvalidErrorCategory_Text        "Unrecognised ONWARNING category '%s'"
+#define HQLERR_MultipleHashWebserviceCalls_Text "#webservice can only be called once"
 
 /* parser error */
 #define ERR_PARSER_CANNOTRECOVER    3005  /* The parser can not recover from previous error(s) */

+ 5 - 1
ecl/hqlcpp/hqlttcpp.cpp

@@ -284,7 +284,11 @@ void NewThorStoredReplacer::doAnalyseBody(IHqlExpression * expr)
         IAtom * kind = expr->queryChild(0)->queryName();
         if (kind == webserviceAtom)
         {
-            Owned<IWUWebServicesInfo> wsi = wu->updateWebServicesInfo(true);
+            Owned<IWUWebServicesInfo> wsi = wu->updateWebServicesInfo(false);
+            if (wsi)
+                throwError(HQLERR_MultipleHashWebserviceCalls);
+            wsi.setown(wu->updateWebServicesInfo(true));
+
             IHqlExpression *wsExpr = expr->queryChild(0);
             ForEachChild(i, wsExpr)
             {