做网站合同,wap网站和internet网站,南通网站建设推广专家,徐州手机网站建设公司我正在尝试使用cx_oracle 6.3在oracle 12中插入许多blob(每个2到20 MB)。经过大量的搜索和实验,我得到了以下代码工作。我是python新手,想知道:这种方法有效吗?有更快的方法吗?#!/usr/local/bin/python3import ioimport osimport cx_Oraclepdf open(hello.pdf, rb)mem_file …我正在尝试使用cx_oracle 6.3在oracle 12中插入许多blob(每个2到20 MB)。经过大量的搜索和实验,我得到了以下代码工作。我是python新手,想知道:这种方法有效吗?有更快的方法吗?#!/usr/local/bin/python3import ioimport osimport cx_Oraclepdf open(hello.pdf, rb)mem_file io.BytesIO(pdf.read())mem_file.seek(0, os.SEEK_END)file_size mem_file.tell()con cx_Oracle.connect(user, ***, localhost:1512/ORCLPDB1, encodingUTF-8)# create table for this examplecon.cursor().execute(CREATE TABLE t (id NUMBER, b BLOB) LOB(b) STORE AS SECUREFILE(COMPRESS));# prepare cursorcursor con.cursor()my_blob cursor.var(cx_Oracle.BLOB, file_size)my_blob.setvalue(0, mem_file.getvalue())# execute insertcursor.execute(INSERT INTO t(id, b) VALUES (:my_id, :my_blob), (1, my_blob))con.commit()con.close()插入一个EMPTY_BLOB()做一个UPDATE以后呢?在插入之前计算blob的大小有必要/有益吗?