UPDATEBLOB

Description

Updates the rows in TableName in BlobColumn.

Syntax

UPDATEBLOB TableName 
	SET BlobColumn = BlobVariable
	RestOfUpdateStatement {USING TransactionObject} ;

Parameter

Description

TableName

The name of the table you want to update.

BlobColumn

The name of the column you want to update in TableName. The datatype of this column must be blob.

BlobVariable

A PowerScript variable of the datatype blob.

RestOfUpdateStatement

The rest of the UPDATE statement (the WHERE clause).

TransactionObject

The name of the transaction object that identifies the database containing the table. This clause is required only for transaction objects other than the default (SQLCA).

Usage

NoteError handling It is good practice to test the success/failure code after executing an UPDATEBLOB statement. To make sure the update affected at least one row, check the SQLNRows property of SQLCA or the transaction object. The SQLCode or SQLDBCode property will not indicate the success or failure of the UPDATEBLOB statement.

NoteDatabase information Sybase ASE and Microsoft SQL Server users must set the AutoCommit property of the transaction object to True before calling the UPDATEBLOB function. For information about the AutoCommit property, see Connecting to Your Database.

Examples

Example 1

These statements update the blob column emp_pic in the Employee table, where emp_num is 100:

int  fh

blob Emp_id_pic

fh = FileOpen("c:\emp_100.bmp", StreamMode!)

IF fh <> -1 THEN

		FileRead(fh, emp_id_pic)

		FileClose(fh)

		UPDATEBLOB Employee SET emp_pic = :Emp_id_pic

		WHERE Emp_num = 100

		USING Emp_tran ;

END IF


IF Emptran.SQLNRows > 0 THEN

		COMMIT USING Emp_tran ;

END IF

The blob Emp_id_pic requires a colon to indicate it is a host (PowerScript) variable in the UPDATEBLOB statement.