Large Objects (LOBs)

At some point in your application, you might find that you need to store
"large" data in your database. Large typically means "around 4kb or
more", although some databases can happily handle up to 32kb before data becomes
"large". Large objects can be either textual or binary in nature. PDO
allows you to work with this large data type by using the
PDO::PARAM_LOB
type code in your PDOStatement::bindParam() or
PDOStatement::bindColumn() calls.
PDO::PARAM_LOB tells
PDO to map the data as a stream, so that you can manipulate it using the
PHP Streams API.

Oracle requires a slightly different syntax for inserting a lob from a
file. It's also essential that you perform the insert under a
transaction, otherwise your newly inserted LOB will be committed with a
zero-length as part of the implicit commit that happens when the query
is executed:

User Contributed Notes 6 notes

There seems to be a bug that affects example 1 above. PDO::PARAM_LOB when used with pdo::bindColumn() is supposed to return a stream but it returns a string. Passing this string to fpassthru() then triggers an error with the message 'supplied argument is not a valid stream resource'. This has been reported in bug #40913. The work around is to do the following: