int Value_money_null::Compare( const I_Value& inOther, COMPARE_TYPE inCompareType ) const { argused1( inCompareType ); FBL_CHECK( get_Type() == inOther.get_Type() ); // If one of values (this or inOther) have null... if( get_IsNull() ) { if( inOther.get_IsNull() ) return 0; // Both are NULL else return -1; // Any NULL is less then NOT NULL } else { if( inOther.get_IsNull() ) return 1; // Any NOT NULL is greater then NULL else { // ... have not null values - compare them. return Value_money::Compare( inOther ); } } }
I_Value* CreateValue( VALUE_TYPE inType, vuint16 inFlags, void* inParam1, void* inParam2, bool inIsRemote ) { TVALUE_FACTORY::iterator p = gValueFactory.find( inType ); if( p == gValueFactory.end() ) return nullptr; MAKE_VALUE_FUNC_PTR pFactory = (*p).second; bool Nullable = bool(inFlags & fNullable); I_Value* pValue = pFactory( Nullable, inParam1, inParam2 ); // on default value has inIsRemote = false, // so we need to assign it only if it is really remote. if( inIsRemote ) pValue->put_IsRemote( inIsRemote ); return pValue; }
I_Value* CreateValue_Enum( I_Type_Enumerated_Ptr inpType, vuint16 inFlags, bool inIsRemote ) { FBL_CHECK( inpType ); I_Value* pValue = nullptr; switch( inpType->get_MaxIdentCount() ) { case ENUM_8_IDENT_COUNT: { pValue = (bool(inFlags & fNullable)) ? new Value_enum_null8( inpType ) : new Value_enum8( inpType ); } break; case ENUM_16_IDENT_COUNT: { pValue = (bool(inFlags & fNullable)) ? new Value_enum_null16( inpType ) : new Value_enum16( inpType ); } break; default: { FBL_Throw( xFeatureError( ERR_FEATURE_NOT_SUPPORTED, "Not enum8 or enum16" ) ); } } if( inIsRemote ) pValue->put_IsRemote( inIsRemote ); return pValue; }
I_Value* toValue_long( vint32 inValue ) { I_Value* pValue = new FBL::Value_long(); pValue->put_Long( inValue ); return pValue; }
I_Value* toValue_umedium( vuint32 inValue ) { I_Value* pValue = new FBL::Value_umedium(); pValue->put_ULong( inValue ); return pValue; }
I_Value* toValue_ushort( vuint16 inValue ) { I_Value* pValue = new FBL::Value_ushort(); pValue->put_UShort( inValue ); return pValue; }
I_Value* toValue_byte( vuint8 inValue ) { I_Value* pValue = new FBL::Value_byte(); pValue->put_Byte( inValue ); return pValue; }
I_Value* toValue_text( const FBL::String& inStrObject ) { I_Value* pValue = new FBL::Value_text_null(); pValue->put_String( inStrObject.begin(), inStrObject.end() ); return pValue; }
I_Value* toValue_varchar( const FBL::String& inStrObject ) { I_Value* pValue = new FBL::Value_varchar( inStrObject.length() + 1 ); pValue->put_String( inStrObject.begin(), inStrObject.end() ); // not nullable return pValue; }
I_Value* toValue_double( double inValue ) { I_Value* pValue = new FBL::Value_double(); pValue->put_Double( inValue ); return pValue; }
I_Value* toValue_float( float inValue ) { I_Value* pValue = new FBL::Value_float(); pValue->put_Float( inValue ); return pValue; }
I_Value* toValue_ullong( vuint64 inValue ) { I_Value* pValue = new FBL::Value_ullong(); pValue->put_ULLong( inValue ); return pValue; }
FBL_Begin_Namespace /**********************************************************************************************/ I_Value* toValue_bool( vuint32 inValue ) { I_Value* pValue = new FBL::Value_bool(); pValue->put_Boolean( inValue ); return pValue; }
void Value_Raw::Assign( const I_Value& inValue ) { if( inValue.get_IsNull() ) { put_IsNull( true ); } else { if( get_Type() == inValue.get_Type() ) { vuint32 Len = static_cast<vuint32>(inValue.end() - inValue.begin()); put_Data( (vuint8*)inValue.begin(), Len ); } else { ConvertValue( &inValue, this ); } } }