Should VDK_Date, VDK_Time, VDK_DateTime have value methods operator = and such?

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Sep 19 08:34:44 CDT 2003


on 9/19/03 6:49 AM, Matthew Jew at mjew at icnc.com wrote:

> Ruslan,
> 
> Would it be useful to have operator = and value getters for the various
> Date and Time classes?
> 
> I find myself needing to copy values from one table to another, and now
> I have to
> do something like:
> 
> long    aYear;
> ushort    aMonth;
> ushort    aDay;
> ushort    anHour;
> ushort    aMinute;
> ushort    aSecond;
> 
> theSourceTable->modDateTimeField.GetDate( aYear, aMonth, aDay );
> theSourceTable->modDateTimeField.GetTime( anHour, aMinute, aSecond );
> 
> ... and then later ...
> 
> theDestinationTable->modDateTimeField.SetDate( aYear, aMonth, aDay );
> theDestinationTable->modDateTimeField.SetTime( anHour, aMinute, aSecond
> );
> 
> Even worse, I need to retrieve hundreds of these DateTimes in a batch,

Hi Mathew,

You have simpler way right now.

For Date and Time that have 4 bytes value:
    *(long*)f1.DataPtr() = *(long*)f2.DataPtr();

For DateTime that have 8 bytes value:
    *(llong*)f1.DataPtr() = *(llong*)f2.DataPtr();


And of course you need before that check IsNull()

    if( f2.IsNull() )
    {
        f1.putIsNull( true );
    }
    else
    {
        *(long*)f1.DataPtr() = *(long*)f2.DataPtr();
    }


FYI: in 2.0 we change many things.
     for example, we have add new interface I_Value.
     and you task in 2.0 API will be as simple as one line of code:

      f1->put_Value( f2->get_Value() );


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list