52
52
SERIALIZABLE_CLASS_VERSIONS(CompareIterator)
54
SERIALIZABLE_TEMPLATE_INSTANCE_VERSIONS(TypedValueCompareIterator, TypedValueCompareIterator<store::XS_DOUBLE>, 1)
55
SERIALIZABLE_TEMPLATE_INSTANCE_VERSIONS(TypedValueCompareIterator, TypedValueCompareIterator<store::XS_FLOAT>, 2)
56
SERIALIZABLE_TEMPLATE_INSTANCE_VERSIONS(TypedValueCompareIterator, TypedValueCompareIterator<store::XS_DECIMAL>, 3)
57
SERIALIZABLE_TEMPLATE_INSTANCE_VERSIONS(TypedValueCompareIterator, TypedValueCompareIterator<store::XS_INTEGER>, 4)
58
SERIALIZABLE_TEMPLATE_INSTANCE_VERSIONS(TypedValueCompareIterator, TypedValueCompareIterator<store::XS_STRING>, 5)
54
SERIALIZABLE_TEMPLATE_INSTANCE(TypedValueCompareIterator,
55
TypedValueCompareIterator<store::XS_DOUBLE>,
58
SERIALIZABLE_TEMPLATE_INSTANCE(TypedValueCompareIterator,
59
TypedValueCompareIterator<store::XS_FLOAT>,
62
SERIALIZABLE_TEMPLATE_INSTANCE(TypedValueCompareIterator,
63
TypedValueCompareIterator<store::XS_DECIMAL>,
66
SERIALIZABLE_TEMPLATE_INSTANCE(TypedValueCompareIterator,
67
TypedValueCompareIterator<store::XS_INTEGER>,
70
SERIALIZABLE_TEMPLATE_INSTANCE(TypedValueCompareIterator,
71
TypedValueCompareIterator<store::XS_STRING>,
60
74
SERIALIZABLE_CLASS_VERSIONS(AtomicValuesEquivalenceIterator)
98
121
result = negate ^ true;
123
#ifdef ZORBA_WITH_JSON
124
else if (item->isJSONItem())
126
xqtref_t type = tm->create_value_type(item);
128
RAISE_ERROR(err::FORG0006, loc,
129
ERROR_PARAMS(ZED(BadArgTypeForFn_2o34o), *type, "fn:boolean" ));
102
134
store::SchemaTypeCode type = item->getTypeCode();
110
142
TypeOps::is_subtype(type, store::XS_STRING) ||
111
143
TypeOps::is_subtype(type, store::XS_ANY_URI) ||
112
144
type == store::XS_UNTYPED_ATOMIC ||
145
type == store::JS_NULL ||
113
146
TypeOps::is_numeric(type)))
115
148
// atomic type xs_boolean, xs_string, xs_anyURI, xs_untypedAtomic
335
CompareIterator::CompareIterator(::zorba::serialization::Archiver& ar)
337
BinaryBaseIterator<CompareIterator, PlanIteratorState>(ar),
338
theTypeManager(NULL),
345
void CompareIterator::serialize(::zorba::serialization::Archiver& ar)
347
serialize_baseclass(ar,
348
(BinaryBaseIterator<CompareIterator, PlanIteratorState>*)this);
350
SERIALIZE_ENUM(CompareConsts::CompareType, theCompType)
351
ar & theIsGeneralComparison;
352
SERIALIZE_TYPEMANAGER(TypeManager, theTypeManager);
302
358
BINARY_ACCEPT(CompareIterator);
432
488
if (consumeNext(item0, theChild0.getp(), planState) &&
433
489
consumeNext(item1, theChild1.getp(), planState))
435
STACK_PUSH(GENV_ITEMFACTORY->
436
createBoolean(result,
437
CompareIterator::valueComparison(loc,
446
if (consumeNext(item0, theChild0.getp(), planState) ||
447
consumeNext(item1, theChild1.getp(), planState))
491
if (item0->getTypeCode() != store::JS_NULL &&
492
item1->getTypeCode() != store::JS_NULL)
449
RAISE_ERROR(err::XPTY0004, loc, ERROR_PARAMS(ZED(NoSeqInValueComp)));
494
STACK_PUSH(GENV_ITEMFACTORY->
495
createBoolean(result,
496
CompareIterator::valueComparison(loc,
505
assert(!consumeNext(item0, theChild0.getp(), planState) &&
506
!consumeNext(item1, theChild1.getp(), planState));
946
catch(ZorbaException const& e)
1009
catch(const ZorbaException& e)
948
1011
// For example, two QName items do not have an order relationship.
949
1012
if (e.diagnostic() == zerr::ZSTR0040_TYPE_ERROR)
954
1017
RAISE_ERROR(err::XPTY0004, loc,
955
1018
ERROR_PARAMS(ZED(BadType_23o), *type0, ZED(NoCompareWithType_4), *type1));
966
1030
/////////////////////////////////////////////////////////////////////////////////
1032
template <store::SchemaTypeCode ATC>
1033
void TypedValueCompareIterator<ATC>::serialize(::zorba::serialization::Archiver& ar)
1035
serialize_baseclass(ar,
1036
(NaryBaseIterator<TypedValueCompareIterator<ATC>, PlanIteratorState>*)this);
1038
SERIALIZE_ENUM(CompareConsts::CompareType, theCompType);
969
1044
template <store::SchemaTypeCode ATC>
970
1045
void TypedValueCompareIterator<ATC>::accept(PlanIterVisitor& v) const
1030
cmp = lItem0->compare(lItem1, theTimezone, theCollation);
1104
cmp = lItem0->compare(lItem1, theTimezone, theCollation);
1032
switch (theCompType)
1106
switch (theCompType)
1108
case CompareConsts::VALUE_LESS:
1111
case CompareConsts::VALUE_GREATER:
1114
case CompareConsts::VALUE_LESS_EQUAL:
1117
case CompareConsts::VALUE_GREATER_EQUAL:
1121
ZORBA_ASSERT(false);
1122
} // switch (theCompType)
1124
catch (const ZorbaException& e)
1034
case CompareConsts::VALUE_LESS:
1037
case CompareConsts::VALUE_GREATER:
1040
case CompareConsts::VALUE_LESS_EQUAL:
1043
case CompareConsts::VALUE_GREATER_EQUAL:
1047
ZORBA_ASSERT(false);
1048
} // switch (theCompType)
1126
if (e.diagnostic() == zerr::ZSTR0041_NAN_COMPARISON)
1050
1132
} // switch (theCompType)
1053
STACK_PUSH(GENV_ITEMFACTORY->createBoolean(result, bRes), state);
1134
STACK_PUSH(GENV_ITEMFACTORY->createBoolean(result, bRes), state);
1055
if (CONSUME(lItem0, 0) || CONSUME(lItem1, 1))
1057
throw XQUERY_EXCEPTION(
1059
ERROR_PARAMS( ZED( NoSeqInValueComp ) ),
1060
ERROR_LOC( this->loc )
1136
assert(!CONSUME(lItem0, 0) && !CONSUME(lItem1, 1));
1065
1139
STACK_END(state);
1173
AtomicValuesEquivalenceIterator::AtomicValuesEquivalenceIterator(
1174
::zorba::serialization::Archiver& ar)
1176
BinaryBaseIterator<AtomicValuesEquivalenceIterator, PlanIteratorState>(ar),
1177
theTypeManager(NULL),
1184
void AtomicValuesEquivalenceIterator::serialize(::zorba::serialization::Archiver& ar)
1186
serialize_baseclass(ar,
1187
(BinaryBaseIterator<AtomicValuesEquivalenceIterator, PlanIteratorState>*)this);
1189
SERIALIZE_TYPEMANAGER(TypeManager, theTypeManager);
1099
1195
BINARY_ACCEPT(AtomicValuesEquivalenceIterator);