DateTimes, LLongs and other 8-byte fields.

Ed Kleban Ed at Kleban.com
Thu Nov 17 03:17:22 CST 2005




On 11/17/05 2:26 AM, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:

> On 11/17/05 9:28 AM, "Ed Kleban" <Ed at Kleban.com> wrote:
> 
> Hi Ed,
>  
>> I see that there are casting functions for the VCursor class, which I
>> understand are for moving values between a Cursor and a Table's Vfields.
> 
> Mmmmm actually this is to write one line of code instead of 2
> 
>     fldLong = curs.Longfield( I )
> 
> vs
> 
>     fld = curs.field( I )
>     fldLong = Vlong( fld )
> 

Ah. Makes sense.  I hadn't thought it through but presumed it was for
something like that.  This would be a good statement to add to the manual.
 
>> But what I don't find are any functions to assist with getting 8-byte values
>> into and out of RB variables.
> 
> Moment. FYI.
> 
> REALbasic send/get to plugin always int = 4 bytes
>  
> IF you put this into Valentina's Vbyte field, then on disk will be use ONE
> byte only
> 

Yes, exactly what I expected.  That's fine.
  
>> How about some numeric accessor methods for VFields in general, or at least
>> the 8-byte fields specifically:
>  
>>  rbIntVar = aVULongField.highLong
>>  rbIntVar = aVULongField.lowLong
>>  rbIntVar = aVLongField.hightLong
>>  rbIntVar = aVLongField.lowLong
> 
> Not agree.
> 
> We give you 8 bytes, which we have extract from Table.
> 
> You self can get any bit as you want using YOUR language.
> If REALbasic is not able do this, I think exists plugins which can.
> 
> IT is not Valentina task split to bits
>  

Fair enough, especially since I expect there's some simple way to do this
that's not apparent to me.  Possibly by mapping a Memory block pointer to
the VField or something.  I'll run this by Thomas Templeton or the NUG list
on RB.  Or I see Charles Yeoman is on this list.  He'll likely know.

>> Admittedly, most or all of these will be moving an unsigned 32-bit value
>> into what RB would treat as a signed integer, but at least we could rapidly
>> read and then "do the math" on binary values without having to go through
>> strings.
>> 
>> And who knows...  considering all the database announcements coming out of
>> REALsoftware, someday they might eventually implement size and
>> representation specific variables such as Int8, Int16, Int32, UInt8, UInt16,
>> and UInt32, and Byte;  then you wouldn't even have to do messy math.
>> 
>> Heck, they may even implement Int64 and UInt64 someday in which case you
>> could read, use, compare, and write the whole sucker directly.
>> 
>> Also, for dates and times:
>> 
>>  rbDateVar = aVDateTimeField.rbDateValue
>>  aVDateTimeField.setFromRbDateValue( rbDateValue )
> 
> Yes we going add support of RB Date
> 
>> By the way... If it should happen that in some distant year in the future
>> that the REALfolk did indeed implement variables such as Int8, Int16, Int32,
>> UInt8, UInt16, and UInt32, Byte, Int64 and UInt64 in the language, what
>> other advantages could Valentina make of such an addition?
> 
> Just we will return you this types :-)
> 
> Although you right now can use UNSIGNED fields.
> Problem is that YOU in RB cannot reach top bit to get correct range

Uh, sure you can.  The top bit is there, but since RB treats all ints as
signed you have to be cleaver about interpreting what it is.  i.e. if the
number is negative, the top bit is set and you can do some 1's compliment
arithmetic if needed. That's what I meant above by "do the math".  But
provision of the typed Integers would solve that problem in theory someday.






More information about the Valentina mailing list