GetField returns different value from GetRecordAsPropList

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Jun 23 08:38:54 CDT 2006


On 6/23/06 1:41 AM, "Pierre Rossel" <prossel2 at myrealbox.com> wrote:

> Hello,
> 
> Another strange behavior (V4MD 1.11, Win).
> 
> This code is ran on a record with a NULL value in mediaData field:
> 
>   curItem = MyQuery("SELECT * FROM MediaItem WHERE RecID=" & p_iMediaItemId)
>   p_lstData = curItem.GetRecordAsPropList()
> 
>   put p_lstData[#mediaData]
> -- <Null>
>   put curItem.GetField("mediaData")
> -- ""
> 
> Why is GetRecordAsPropList() returning (this still strange value)
> <Null> while GetField returns an empty string ?


I have look in sources of V4MD 1.x

        for( ushort i = 1; i <= fldCount; i++ )
        {
            VDK_Field* pField = pCursor->GetField( (ushort) i);
            
            MoaMmValue fldValue = {0};

            Cursor_GetField_aux( This, pField, &fldValue );
            bool isNull = pField->IsNull();
            if( isNull )
            {
                pMmValue->ValueRelease( &fldValue );
            }

            MoaMmSymbol    symName;
            MoaMmValue     valueName;
            pMmValue->StringToSymbol( pField->GetName(), &symName );
            pMmValue->SymbolToValue( symName, &valueName );
            
            pMmList->AppendValueToPropList( pList, &valueName, &fldValue );
            pMmValue->ValueRelease( &valueName );

            if( !isNull )
                pMmValue->ValueRelease( &fldValue );
        }


If field value is Null, then we simply make empty fldValue.
I.e. We DO NOT put string <Null> there.
I think this is Director issue.

But note!

Assume you have in table f1 which is nullable.
Assume first record has NULL there.

The correct code to extract value from this field is:

    
   curItem = MyQuery(
        "SELECT * FROM MediaItem WHERE RecID=" & p_iMediaItemId)

    isNull = curItem.GetFieldIsNull("mediaData")
 
    if( not isNull )
       value = curItem.GetField("mediaData")


You cannot just extract value. If you do this, you will get ZERO for numeric
fields, and empty string for STRING/VARCHAR/TEXT.


** Function GetRecordAsPropList() do this code self. It check if field us
null, and put values into list...Why Director show you <Null> I don't know.
May be this is normal for VOID varaibale ?

Have you try e.g. 

    var = void

    put var 

?

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list