Syntax for updating blob fields in C++ VSDK

Matthew Jew mjew at icnc.com
Thu Oct 12 13:34:59 CDT 2006


On Oct 12, 2006, at 1:08 PM, Ruslan Zasukhin wrote:

> On 10/12/06 10:07 PM, "Matthew Jew" <mjew at icnc.com> wrote:
>
>> Hello,
>>
>> I am having difficulty figuring out the syntax for doing an update in
>> a blob field using the C++ API VSDK.
>>
>> I can do this:
>>
>> I_FldBlob_Ptr pBlobField = dynamic_cast< I_FldBlob* >
>> (aHTMLTemplateTable->valueText.get());
>
>
>> pBlobField->WriteData( (const char*) templateBodyC,
>> templateBodyLength );
>
>> and it compiles, but at runtime, it complains:
>>
>> Error code        : 525582
>> Error description: Field "valueText": value was not prepared for
>> Update.
>
> Do you have after WriteData() call
>
>     aHTMLTemplateTable.UpdateRecord()
>
> ?
>

Am I supposed to have an aHTMLTemplateTable.UpdateRecord() or am I  
NOT supposed to have an aHTMLTemplateTable.UpdateRecord() call?

>
>> I am not sure where the ->get_Value( forUpdate ) goes.
>>
>> I have tried to place it in various positions, like I do for a normal
>> field update:
>>
>> aNewsgroupTable->articleTag->get_Value(forUpdate)->put_String
>> ( articleTag );
>>
>> but I can't get it to compile.
>>
>> What is the syntax for accomplishing this?
>
> I am sure we have example API_Way/... That work with BLOBs
>

This is the entire example API_Way/ related to BLOBs:

void Example( void )
{
	InitValentina( 4 * 1024 * 1024 );

	FBL::I_Database_Ptr pFblDb = MakeNewDatabase();

	// STEP: create database.
	CreateExampleDatabase( pFblDb );

	// STEP: create Person table.
	I_Table_Ptr	pTable = pFblDb->CreateTable( "Person" );

	// STEP: create BLOB field.
	I_Field_Ptr pFld = CreateBLOBField( pTable, "fld_BLOB" );
	I_FldBlob_Ptr pf1 = dynamic_cast< I_FldBlob* >(pFld.get());

	// STEP: add record from file
	I_Disk_Location_Ptr pLocation = CreateDiskLocation( "test.jpg" );	
	pf1->FromFile( pLocation );
	pTable->AddRecord();

	// STEP: get record to file
	I_Disk_Location_Ptr pLocNew = CreateDiskLocation( "new.jpg" );	
	pf1->ToFile( pLocNew );

	// STEP: close database.
	pFblDb->Close();

	ShutdownValentina();
}

- Matthew



More information about the Valentina mailing list