php8.5
Home/ Manual/ pdo / pgsql/ Pdo\Pgsql::lobUnlink

Pdo\Pgsql::lobUnlink

PHP function Edit on GitHub ✎

(PHP 8 >= 8.4.0)

Deletes the large object

Description

Pdo\Pgsql::lobUnlink(string $oid): bool

Deletes a large object from the database identified by OID.

Parameters

oid

A large object identifier.

Return Values

Success

Examples

Pdo\Pgsql::lobUnlink example

This example unlinks a large object from the database before deleting the row that references it. It uses the blobs table from the Pdo\Pgsql::lobCreate and Pdo\Pgsql::lobOpen examples.

php
<?php
$db = new Pdo\Pgsql('pgsql:dbname=test host=localhost', $user, $pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->beginTransaction();
$db->lobUnlink($oid);
$stmt = $db->prepare("DELETE FROM BLOBS where ident = ?");
$stmt->execute([$some_id]);
$db->commit();
?>

See Also

Source: reference/pdo_pgsql/pdo/pgsql/lobunlink.xml · from the official PHP manual (php/doc-en)