How can I use LONG or LONG RAW data?
LONG
Inserting and updating a LONG column
You have no need to do special thing. Just insert and update a value as a String.
note: The maximum length is 65535 on 0.1.15 or earlier. It is 2G on 0.1.16 or later.
Fetching a LONG column
The maximum length is 65535 on 0.1.15 or eariler. As for 0.0.16 and 1.0.x use OCI8#long_read_len to change the maximum length.
# set the maximum data length conn.long_read_len = 1024 * 1024 * 2
The maximum length is 2G on 2.0.x. It doesn't depend on long_read_len, which is an internal buffer size to fetch a LONG data.
LONG RAW
Inserting and updating a LONG RAW column
Explicitly bind the value as RAW.
filename = 'SagradaFamilia.gif'
image = open(filename, "rb").read()
cursor = conn.parse('insert into photos values(:1,:2)')
cursor.bind_param(1, filename))
# bind image as RAW
cursor.bind_param(2, image, OCI8::RAW)
cursor.exec
Fetching a LONG RAW column
Just fetch a column. The maximum length limit is same with a LONG column.
Keyword(s):
References:[FAQ] [OCI8]