Browse Source

Merge remote-tracking branch 'origin/candidate-3.10.x'

Conflicts:
	roxie/ccd/ccdquery.cpp

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 năm trước cách đây
mục cha
commit
d716b5a373
3 tập tin đã thay đổi với 56 bổ sung2 xóa
  1. 2 2
      common/deftype/defvalue.cpp
  2. 47 0
      ecl/regress/decimalboolcast.ecl
  3. 7 0
      roxie/ccd/ccdquery.cpp

+ 2 - 2
common/deftype/defvalue.cpp

@@ -2088,7 +2088,7 @@ IValue *DecimalValue::castTo(ITypeInfo *t)
     case type_packedint:
         return createTruncIntValue(DecPopInt64(), LINK(t));
     case type_boolean:
-        return createBoolValue(!DecCompareNull());
+        return createBoolValue(DecCompareNull() != 0);
     case type_decimal:
         return createDecimalValueFromStack(t);
     }
@@ -2143,7 +2143,7 @@ bool DecimalValue::getBoolValue()
 {
     BcdCriticalBlock bcdBlock;
     pushDecimalValue();
-    return DecCompareNull() ? 0 : 1;
+    return DecCompareNull() != 0;
 }
 
 __int64 DecimalValue::getIntValue()

+ 47 - 0
ecl/regress/decimalboolcast.ecl

@@ -0,0 +1,47 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2013 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+#IF (1.1D)
+OUTPUT('success');
+#else
+OUTPUT('failure');
+#END
+
+#IF (0.0D)
+OUTPUT('failure');
+#else
+OUTPUT('success');
+#END
+
+#IF ((boolean)1.1D)
+OUTPUT('success');
+#else
+OUTPUT('failure');
+#END
+
+#IF ((boolean)0.0D)
+OUTPUT('failure');
+#else
+OUTPUT('success');
+#END
+
+decimal10_2 zero := 0.0D : stored('zero');
+decimal10_2 one := 1.0D : stored('one');
+
+output((boolean)zero);
+output((boolean)one);
+

+ 7 - 0
roxie/ccd/ccdquery.cpp

@@ -1352,6 +1352,9 @@ extern IQueryFactory *createServerQueryFactory(const char *id, const IQueryDll *
     }
     Owned<ISharedOnceContext> sharedOnceContext;
     assertex(dll->queryWorkUnit());
+    unsigned wuVersion = dll->queryWorkUnit()->getCodeVersion();
+    if (wuVersion > ACTIVITY_INTERFACE_VERSION || wuVersion < MIN_ACTIVITY_INTERFACE_VERSION)
+        throw MakeStringException(ROXIE_MISMATCH, "Workunit was compiled for eclhelper interface version %d, this roxie requires version %d..%d", wuVersion, MIN_ACTIVITY_INTERFACE_VERSION, ACTIVITY_INTERFACE_VERSION);
     IPropertyTree *workflow = dll->queryWorkUnit()->queryWorkflowTree();
     if (workflow && workflow->hasProp("Item[@mode='once']"))
         sharedOnceContext.setown(new CSharedOnceContext);
@@ -1610,6 +1613,10 @@ IQueryFactory *createSlaveQueryFactory(const char *id, const IQueryDll *dll, con
         ::Release(dll);
         return cached;
     }
+    assertex(dll->queryWorkUnit());
+    unsigned wuVersion = dll->queryWorkUnit()->getCodeVersion();
+    if (wuVersion > ACTIVITY_INTERFACE_VERSION || wuVersion < MIN_ACTIVITY_INTERFACE_VERSION)
+        throw MakeStringException(ROXIE_MISMATCH, "Workunit was compiled for eclhelper interface version %d, this roxie requires version %d..%d", wuVersion, MIN_ACTIVITY_INTERFACE_VERSION, ACTIVITY_INTERFACE_VERSION);
     Owned<IQueryFactory> serverFactory = createServerQueryFactory(id, LINK(dll), package, stateInfo); // Should always find a cached one
     Owned<CSlaveQueryFactory> newFactory = new CSlaveQueryFactory(id, dll, dynamic_cast<const IRoxiePackage&>(package), hashValue, channel, serverFactory->querySharedOnceContext());
     newFactory->load(stateInfo);