Name

LongReadLen (unsigned integer, inherited)

Synopsis

This attribute may be used to control the maximum length of long fields (“blob,” “memo,” etc.), which the driver will read from the database automatically when it fetches each row of data. The LongReadLen attribute relates only to fetching and reading long values; it is not involved in inserting or updating them.

A value of 0 means not to automatically fetch any long data. (fetch should return undef for long fields when LongReadLen is 0.)

The default is typically 0 (zero) bytes but may vary between drivers. Applications fetching long fields should set this value to slightly larger than the longest long field value to be fetched.

Some databases return some long types encoded as pairs of hex digits. For these types, LongReadLen relates to the underlying data length and not the doubled-up length of the encoded string.

Changing the value of LongReadLen for a statement handle after it has been prepare‘d will typically have no effect, so it’s common to set LongReadLen on the $dbh before calling prepare.

Note that the value used here has a direct effect on the memory used by the application, so don’t be too generous.

See LongTruncOk for more information on truncation behavior.

Get Programming the Perl DBI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.