updateBlobFile

Support for this function is limited. See the Feature Comparison Matrix

Syntax
mixed updateBlobFile(
    string $tableName,
    string $columnName,
    string $fileName,
    string $whereStatement,
    optional string $type='BLOB'
)

Description

The function updateBlobFile() updates a column specified by $columnName in an row of a table, specified by $tableName directly from a file on disk with a path specified by $fileName. For BLOB files, the file is encoded in an appropriate manner before storage. No additional action is required.

The physical file must be resident on the server from which the script is run, not the workstation.

$table

The table where the LOB is to be stored

$column

The column where the LOB is to be stored. The column should be of an appropriate type to store the data format required (see below)

$where

The $where statement should match a unique row in the table.

$type

The only acceptable values for $type are BLOB or CLOB


Usage

/*
 * Connection assumed
 */
$tableName = 'images';
$columnName = 'image_data';
 
$fileName = '/temp/image.jpg';
$db->updateBlob($tableName,$columnName,$fileName,"ID=140")

Column Support For BLOB and CLOB

Database CLOB BLOB
MetaType X B
MySQL LONGTEXT LONGBLOB
IBM DB2 CLOB BLOB(100M)
Oracle CLOB BLOB
SQL Server TEXT VARBINARY(MAX)
PostgreSQL TEXT BYTEA
SQLite TEXT BLOB