[cx-oracle-users] set{input,output}sizes() (changed subject)
Brought to you by:
atuining
From: Guido v. R. <gu...@el...> - 2005-05-17 19:38:56
|
> setinputsizes() is used to define what type (and size) of data is > being bound to the cursor. In most cases cx_Oracle (and other database > access modules) can guess the type from the type of the Python value > that is bound but the Python None value (representing null in database > terms) doesn't have any type that corresponds to any database type. > Thus, if you want to bind a NULL or anything else (like CLOB/BLOB) > where the database type and size cannot be implied from the Python > type and size you want to use setinputsizes(). >=20 > setoutputsizes() is for defining the size of data that is being > fetched from the database. In particular it is used for variable > length data (like long and long raw in Oracle) where the size cannot > be known by retrieving the information from the database. If you never > use long or long raw (and Oracle recommends that you use CLOB and BLOB > instead) then you never need to know about this function. >=20 > Does that help?? How many bonus points do I get?? :-) Sortof. I'm surprised that NULL (which is supported in SQL) is unknown at this level, which makes me wonder if I understand any of the rest! I guess I'm so comfortable with the abstractions that SQL and Python provide that I have a hard time understanding the precise nature of the hoops that you have to jump through to tie the two together; for example, when inserting a 100K-long string into a table column whose type is CLOB, why would I have to say that it's a CLOB again? --Guido van Rossum (home page: http://www.python.org/~guido) |