• « PDO::pgsqlLOBOpen
  • SQLite (PDO) »
  • Bejson.com
  • PHP Manual
  • PostgreSQL (PDO)
  • Deletes the large object

PDO::pgsqlLOBUnlink

(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL pdo_pgsql >= 1.0.2)

PDO::pgsqlLOBUnlink — Deletes the large object

说明

public PDO::pgsqlLOBUnlink(string $oid): bool

Deletes a large object from the database identified by OID.

注意: This function must be called within a transaction.

参数

oid

A large object identifier

返回值

成功时返回 true, 或者在失败时返回 false。

范例

示例 #1 A PDO::pgsqlLOBUnlink() example

This example unlinks a large object from the database prior to deleting the row that references it from the blobs table we've been using in our PDO::pgsqlLOBCreate() and PDO::pgsqlLOBOpen() examples.

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

参见

  • PDO::pgsqlLOBOpen() - Opens an existing large object stream
  • PDO::pgsqlLOBCreate() - Creates a new large object