How to handle the null value
Ruslan Zasukhin
sunshine at public.kherson.ua
Thu Jun 22 23:33:06 CDT 2006
On 6/22/06 11:22 PM, "Pierre Rossel" <prossel2 at myrealbox.com> wrote:
Hi Pierre,
> I wonder where the <Null> value is documented in Director Help and how to
> handle it.
>
> Here is an example:
>
> I'm creating a record using this code:
>
> Using V4MD 1.11 on XP and OS X. I use the following code to add a record.
> The #mediaData field value is not provided. It is a #Text field (not
> nullable, indexed by words, ASCII, segment 128).
>
> curMediaItems = db.Query("SELECT RecID, * FROM MediaItem WHERE RecID=0",
> [#LockType: #ReadWrite, #Direction: #Random])
> bRet = curMediaItems.AddRecord([#MediaFolderPtr: iMediaFolderId, #name:
> sName, #mediaType: 1])
>
> Later, this code is used to load the data. The result of the put commands
> are merged under the commands.
>
> curItem = db.Query("SELECT * FROM MediaItem WHERE RecID=" &
> p_iMediaItemId)
> p_lstData = curItem.GetRecordAsPropList()
>
> put p_lstData[#mediaData]
> -- <Null>
>
> put p_lstData[#mediaData] = void
> -- 1
>
> put voidP(p_lstData[#mediaData])
> -- 0
>
> The <Null> value is something I have never seen documented. Is it the same
> as void ? Seems not since the voidP() call return false. Usually the test
> value = void should be avoided and the voidP() function used instead. In
> this situation, it is just the opposite.
>
> I am a bit confused.
Well, I believe that V4MD returns VOID type when some field value
has NULL of SQL
Director has the following types:
enum
{
kMoaMmValueType_Void,
kMoaMmValueType_Integer,
kMoaMmValueType_Symbol,
kMoaMmValueType_String,
kMoaMmValueType_Object,
kMoaMmValueType_Picture,
kMoaMmValueType_Float,
kMoaMmValueType_List,
kMoaMmValueType_Point,
kMoaMmValueType_Rect,
kMoaMmValueType_PropList,
kMoaMmValueType_Member,
kMoaMmValueType_CastLib,
kMoaMmValueType_Script,
kMoaMmValueType_Instance,
kMoaMmValueType_Xtra,
kMoaMmValueType_Sprite,
kMoaMmValueType_SoundSprite,
kMoaMmValueType_Color,
kMoaMmValueType_Date,
kMoaMmValueType_Media,
kMoaMmValueType_Other,
kMoaMmValueType_3dVector,
kMoaMmValueType_3dTransform,
};
And we use VOID to get/set the NULL value.
Also note, exist VField_IsNull() method, which allow test field
value on NULL.
--
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