Defining/Binding Blob Values
Ruslan Zasukhin
sunshine at public.kherson.ua
Tue Aug 19 07:20:49 CDT 2008
On 8/19/08 2:43 PM, "Thomas.DellAnno at swisstopo.ch"
<Thomas.DellAnno at swisstopo.ch> wrote:
> Many thanks for your support.
>
> After a lot of try and error and having a look over the examples you have
> sent to me, I finally found a solution that works:
>
> --------- begin C++ snippet ----------------------------------------
>
> // ... valentina init ...
>
> ArrayOfValues_Ptr pBinds = new ArrayOfValues();
>
> String value = "This is the blob data";
> int len = value.length();
>
> I_Value_Ptr valBlob = CreateValueVarBinary (true, &len, value);
^^^^^^^^^
see below, param2 is not used.
> I_ValueBinary_Ptr pBlob = fbl_dynamic_cast<I_ValueBinary>(valBlob);
> pBlob->put_Data ((uchar*)value, len);
> pBinds->AddItem (valBlob);
>
> // ... query execution
>
> --------- end C++ snippet ----------------------------------------
>
> Using the Function "CreateValueVarBinary()" instead of "CreateValue()" does
> the job.
Hmm, strange.
CreateValue() is just dispatcher
-----------------------------------------------------------------------
I_Value* CreateValue(
VALUE_TYPE inType,
ushort inFlags,
void* inParam1,
void* inParam2,
bool inIsRemote )
{
TVALUE_FACTORY::iterator p = gValueFactory.find( inType );
if( p == gValueFactory.end() )
return NULL;
MAKE_VALUE_FUNC_PTR pFactory = (*p).second;
bool Nullable = bool(inFlags & fNullable);
I_Value* pValue = pFactory( Nullable, inParam1, inParam2 );
// on default value has inIsRemote = false,
// so we need to assign it only if it is really remote.
if( inIsRemote )
pValue->put_IsRemote( inIsRemote );
return pValue;
}
-----------------------------------------------------------------------
It calls the same CreateValueVarBinary() if you call
CreateValue( kTypeVarBinary, fNullable, )
-----------------------------------------------------------------------
I_Value* CreateValueVarBinary( bool inNullable, void* inParam1, void*
inParam2 )
{
argused1( inParam2 );
FBL_CHECK(inParam1);
ulong MaxLen = *reinterpret_cast<ulong*>(inParam1);
if( inNullable )
return new Value_varbinary_null( MaxLen, 0 );
else
return new Value_varbinary( MaxLen, 0 );
}
-----------------------------------------------------------------------
--
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