Browse Source

HPCC-12714 Catch internal consistency errors more quickly

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 10 years ago
parent
commit
2f5e18acfe
2 changed files with 8 additions and 0 deletions
  1. 2 0
      ecl/hqlcpp/hqlcerrors.hpp
  2. 6 0
      ecl/hqlcpp/hqlttcpp.cpp

+ 2 - 0
ecl/hqlcpp/hqlcerrors.hpp

@@ -214,6 +214,7 @@
 #define HQLERR_CouldNotGenerateDefault          4194
 #define HQLERR_DistributionVariableLengthX      4195
 #define HQLERR_DistributionUnsupportedTypeXX    4196
+#define HQLERR_InconsistentEmbedded             4197
 
 //Warnings....
 #define HQLWRN_PersistDataNotLikely             4500
@@ -539,6 +540,7 @@
 
 #define HQLERR_DistributionVariableLengthX_Text "DISTRIBUTION does not support variable length field '%s'"
 #define HQLERR_DistributionUnsupportedTypeXX_Text "DISTRIBUTION does not support field '%s' with type %s"
+#define HQLERR_InconsistentEmbedded_Text        "Field '%s' is specified as embedded but child record requires link counting"
 
 #define HQLERR_OrderOnVarlengthStrings_Text     "Rank/Ranked not supported on variable length strings"
 #define HQLERR_DistributionNoSequence_Text      "DISTRIBUTION() only supported at the outer level"

+ 6 - 0
ecl/hqlcpp/hqlttcpp.cpp

@@ -8945,6 +8945,12 @@ IHqlExpression * HqlLinkedChildRowTransformer::createTransformedBody(IHqlExpress
             case type_dictionary:
             case type_table:
             case type_groupedtable:
+                OwnedHqlExpr transformedRecord = transform(expr->queryRecord());
+                if (recordRequiresLinkCount(transformedRecord))
+                {
+                    if (expr->hasAttribute(embeddedAtom) || queryAttribute(type, embeddedAtom) || expr->hasAttribute(countAtom) || expr->hasAttribute(sizeofAtom))
+                        throwError1(HQLERR_InconsistentEmbedded, expr->queryId()->str());
+                }
                 if (expr->hasAttribute(embeddedAtom))
                 {
                     OwnedHqlExpr transformed = QuickHqlTransformer::createTransformedBody(expr);