The call to cursor.setinputsizes() is not needed for cx_Oracle 6 and higher.

This commit is contained in:
Anthony Tuininga 2019-02-04 15:29:50 -07:00
parent c11c24fb0d
commit 2f9c01a877

View File

@ -41,10 +41,12 @@ longString = ""
for i in range(10): for i in range(10):
char = chr(ord('A') + i) char = chr(ord('A') + i)
longString += char * 25000 longString += char * 25000
cursor.setinputsizes(None, cx_Oracle.LONG_STRING) # uncomment the line below for cx_Oracle 5.3 and earlier
# cursor.setinputsizes(None, cx_Oracle.LONG_STRING)
cursor.execute("insert into TestClobs values (:1, :2)", cursor.execute("insert into TestClobs values (:1, :2)",
(i + 1, "STRING " + longString)) (i + 1, "STRING " + longString))
cursor.setinputsizes(None, cx_Oracle.LONG_BINARY) # uncomment the line below for cx_Oracle 5.3 and earlier
# cursor.setinputsizes(None, cx_Oracle.LONG_BINARY)
cursor.execute("insert into TestBlobs values (:1, :2)", cursor.execute("insert into TestBlobs values (:1, :2)",
(i + 1, longString.encode("ascii"))) (i + 1, longString.encode("ascii")))
connection.commit() connection.commit()