@@ -74,16 +74,14 @@ Fetching LOBs as Strings and Bytes
7474
7575CLOBs and BLOBs smaller than 1 GB can queried from the database directly as
7676strings and bytes. This can be much faster than streaming a :ref: `LOB Object
77- <lobobj>`. Support is enabled by setting the :ref: `Defaults Object
78- <defaults>`.
77+ <lobobj>`. Support is enabled by setting :attr: `oracledb.defaults.fetch_lobs
78+ <Defaults.fetch_lobs> `, or by setting the ``fetch_lobs `` parameter at statement
79+ execution:
7980
8081.. code-block :: python
8182
8283 import oracledb
8384
84- # returns strings or bytes instead of a locator
85- oracledb.defaults.fetch_lobs = False
86-
8785 . . .
8886
8987 id_val = 1
@@ -92,7 +90,7 @@ strings and bytes. This can be much faster than streaming a :ref:`LOB Object
9290 cursor.execute(" insert into lob_tbl (id, c, b) values (:1, :2, :3)" ,
9391 [id_val, text_data, binary_data])
9492
95- cursor.execute(" select c, b from lob_tbl where id = :1" , [id_val])
93+ cursor.execute(" select c, b from lob_tbl where id = :1" , [id_val], fetch_lobs = False )
9694 clob_data, blob_data = cursor.fetchone()
9795 print (" CLOB length:" , len (clob_data))
9896 print (" CLOB data:" , clob_data)
@@ -106,8 +104,7 @@ This displays::
106104 BLOB length: 16
107105 BLOB data: b'Some binary data'
108106
109- An older alternative to using ``oracledb.defaults.fetch_lobs `` is to use a type
110- handler:
107+ An older alternative to using ``fetch_lobs `` is to use a type handler:
111108
112109.. code-block :: python
113110
@@ -124,8 +121,9 @@ handler:
124121 Streaming LOBs (Read)
125122=====================
126123
127- Without setting ``oracledb.defaults.fetch_lobs `` to False, or without using an
128- output type handler, the CLOB and BLOB values are fetched as :ref: `LOB
124+ Without setting :attr: `oracledb.defaults.fetch_lobs <Defaults.fetch_lobs> ` or
125+ equivalent execution parameter to *False *, or without using an output type
126+ handler, then the CLOB and BLOB values are fetched as :ref: `LOB
129127objects<lobobj>`. The size of the LOB object can be obtained by calling
130128:meth: `LOB.size() ` and the data can be read by calling :meth: `LOB.read() `:
131129
0 commit comments