void Value_Raw::put_Data( vuint8* inDataBuffer, vuint32 inBufferSize ) { vuint8* pBegin = inDataBuffer; vuint8* pEnd = inDataBuffer + inBufferSize; if( pBegin == nullptr || inBufferSize == 0 ) { put_IsNull( true ); } else { put_IsNull( false ); vuint32 OldLen = get_Length(); vuint32 Available = get_Allocated(); vuint32 Assigned = vuint32(pEnd - pBegin); Assigned = Assigned > Available ? Available : Assigned; if( Assigned > 0) { memcpy( m_pStart, pBegin, Assigned ); m_pEnd = m_pStart + Assigned; } if( gEraseInformation ) { // Fill the peace of space that has been freed after old value with 0. vuint32 NewLen = get_Length(); vint32 Diff = static_cast<vint32>(OldLen - NewLen); if( Diff > 0 ) { memset(m_pEnd, 0, static_cast<vuint32>(Diff)); } } } }
void Value_Raw::From( I_PacketRcv* inPacket, bool inBlock ) { argused1(inBlock); Clear(); bool IsNull = inPacket->get_BoolParam(); if( !IsNull ) { put_IsNull(false); vuint32 Len = inPacket->get_ULongParam(); Alloc(Len); if( Len > 0 ) { vuint32 Available = get_Allocated(); Available = Len > Available ? Available : Len; inPacket->get_BinaryParam(reinterpret_cast<void*>(m_pStart), Available); m_pEnd = m_pStart + Len; } } else { put_IsNull(true); } }
void Value_Raw::From( I_IStream_Ptr inStream, bool inBlock ) { argused1(inBlock); Clear(); bool IsNull; inStream->get(IsNull); if( !IsNull ) { put_IsNull(false); vuint32 Len; inStream->get(Len); Alloc(Len); if( Len > 0 ) { vuint32 Available = get_Allocated(); Available = Len > Available ? Available : Len; inStream->get(reinterpret_cast<void*>(m_pStart), Available); m_pEnd = m_pStart + Len; } } else { put_IsNull(true); } }
void Value_Raw::Init( void ) { if( vuint32 Len = get_Allocated() ) { memset( m_pStart, 'a', Len ); m_pEnd = m_pStart + Len; put_IsNull( false ); } else { // We don't go on this way!!! FBL_CHECK( false ); put_IsNull( true ); } }
Value_date_null::Value_date_null( const Value_date& inOther ) : Value_date( inOther ) { put_IsNull( inOther.get_IsNull() ); }
void Value_datetime_imp::put_Year( vint32 inYear ) { const DTFormat* pDTFormat = get_DTFormat(); // Year correction pDTFormat->AutoCentury( inYear ); ((DateTimeEncoded&)mValue).decoded.date.decoded.y = inYear; put_IsNull( false ); }
void Value_time_imp::put_String( const char* inStart, const char* inEnd ) { argused1( inEnd ); const DTFormat* pDTFormat = get_DTFormat(); Convert_str_time_aa_aux( inStart, pDTFormat, (TimeEncoded&)mValue ); put_IsNull( false ); }
Value_date_null::Value_date_null( vint32 inYear, vuint16 inMonth, vuint16 inDay, const DTFormat* inDTFormat ) : Value_date( inYear, inMonth, inDay, inDTFormat ) { put_IsNull(false); }
Value_time_null::Value_time_null( vuint16 inHours, vuint16 inMinutes, vuint16 inSeconds, vuint16 inMilliseconds, const DTFormat* inDTFormat ) : Value_time( inHours, inMinutes, inSeconds, inMilliseconds, inDTFormat ) { put_IsNull(false); }
void Value_date_imp::put_Date( vint32 inYear, vuint16 inMonth, vuint16 inDay ) { DateEncoded& de = (DateEncoded&)mValue; de.decoded.y = inYear; de.decoded.m = inMonth; de.decoded.d = inDay; put_IsNull( false ); }
void Value_money_imp::put_String( const char* inStart, const char* inEnd ) { argused1( inEnd ); if( IsTrueStr( inStart ) ) mValue = 1; else put_Double( atof(inStart) ); put_IsNull(false); }
void Value_datetime_imp::put_Time( vuint16 inHours, vuint16 inMinutes, vuint16 inSeconds, vuint16 inMilliseconds ) { TimeEncoded& te = ((DateTimeEncoded&)mValue).decoded.time; te.decoded.h = inHours; te.decoded.m = inMinutes; te.decoded.s = inSeconds; te.decoded.ms = inMilliseconds; put_IsNull( false ); }
void Value_datetime_imp::put_String( const UChar* inStart, const UChar* inEnd ) { argused1( inEnd ); const DTFormat* pDTFormat = get_DTFormat(); Convert_str_datetime_uu_aux( inStart, inEnd, pDTFormat, (DateTimeEncoded&) mValue ); put_IsNull( false ); }
void Value_datetime_imp::put_Date( vint32 inYear, vuint16 inMonth, vuint16 inDay ) { DateEncoded& de = ((DateTimeEncoded&)mValue).decoded.date; const DTFormat* pDTFormat = get_DTFormat(); // Year correction pDTFormat->AutoCentury( inYear ); de.decoded.y = inYear; de.decoded.m = inMonth; de.decoded.d = inDay; put_IsNull( false ); }
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 ); } } }
Value_datetime_null::Value_datetime_null( vint32 inYear, vuint16 inMonth, vuint16 inDay, vuint16 inHours, vuint16 inMinutes, vuint16 inSeconds, vuint16 inMilliseconds, const DTFormat* inDTFormat ) : Value_datetime( inYear, inMonth, inDay, inHours, inMinutes, inSeconds, inMilliseconds, inDTFormat ) { put_IsNull(false); }
void Value_datetime_imp::put_DateTime( vint32 inYear, vuint16 inMonth, vuint16 inDay, vuint16 inHours, vuint16 inMinutes, vuint16 inSeconds, vuint16 inMilliseconds ) { TimeEncoded& te = ((DateTimeEncoded&)mValue).decoded.time; te.decoded.h = inHours; te.decoded.m = inMinutes; te.decoded.s = inSeconds; te.decoded.ms = inMilliseconds; DateEncoded& de = ((DateTimeEncoded&)mValue).decoded.date; de.decoded.y = inYear; de.decoded.m = inMonth; de.decoded.d = inDay; put_IsNull( false ); }
void Value_time_imp::put_Seconds( vuint16 inSeconds ) { TimeEncoded& te = (TimeEncoded&) mValue; te.decoded.s = inSeconds; put_IsNull( false ); }
void Value_datetime_imp::put_Milliseconds( vuint16 inMilliseconds ) { ((DateTimeEncoded&)mValue).decoded.time.decoded.ms = inMilliseconds; put_IsNull( false ); }
void Value_datetime_imp::put_Seconds( vuint16 inSeconds ) { DateTimeEncoded& dte = ((DateTimeEncoded&)mValue); dte.decoded.time.decoded.s = inSeconds; put_IsNull( false ); }
void Value_datetime_imp::put_Minutes( vuint16 inMinutes ) { ((DateTimeEncoded&)mValue).decoded.time.decoded.m = inMinutes; put_IsNull( false ); }
void Value_datetime_imp::put_Hours( vuint16 inHours ) { ((DateTimeEncoded&)mValue).decoded.time.decoded.h = inHours; put_IsNull( false ); }
void Value_datetime_imp::put_Day( vuint16 inDay ) { ((DateTimeEncoded&)mValue).decoded.date.decoded.d = inDay; put_IsNull( false ); }
void Value_datetime_imp::put_Month( vuint16 inMonth ) { ((DateTimeEncoded&)mValue).decoded.date.decoded.m = inMonth; put_IsNull( false ); }
Value_time_null::Value_time_null( const Value_time_null& inOther ) : Value_time( inOther ) { put_IsNull( inOther.get_IsNull() ); }