[Zope-Checkins] CVS: Products/DCOracle2/DCOracle2 - DCOracle2.py:1.81.4.1
Matthew T. Kromer
matt@zope.com
Tue, 12 Feb 2002 10:29:50 -0500
Update of /cvs-repository/Products/DCOracle2/DCOracle2
In directory cvs.zope.org:/tmp/cvs-serv29837/DCOracle2
Modified Files:
Tag: dco2-object-branch
DCOracle2.py
Log Message:
Fix some TABLE OF problems for Origin systems
=== Products/DCOracle2/DCOracle2/DCOracle2.py 1.81 => 1.81.4.1 ===
114: 'FLOB',
155: 'STRING', # Really STRING
- 156: 'DATE'
+ 156: 'DATE',
+ 250: 'RECORD', # strange documentation...
+ 251: 'TABLE', # from the net points out...
+ 252: 'BOOLEAN' # these typecodes (not official!)
}
if type(n) == types.StringType:
@@ -426,6 +429,9 @@
answer.append((dtype, size, precision, scale, isnull, inout))
+ if dtype == 251: # Table of
+ answer[-1] = answer[-1] + ( self.collapsedesc(args[0]) ,)
+
if type == "table" or type == "view":
columns = desc['OCI_ATTR_LIST_COLUMNS']
contains = []
@@ -490,9 +496,9 @@
rtype = Type(args[0]['OCI_ATTR_DATA_TYPE'])
if rtype == "NUMBER" and scale != 0:
rtype = "%s(%s,%s)" % (rtype, precision, scale)
- elif rtype == "NUMBER" and precision != 38 and precision != 0:
- rtype = "%s(%s)" % (rtype, precision)
- elif precision != 0:
+ elif rtype == "NUMBER" and precision == 38 or precision == 0:
+ pass
+ elif precision != 0 :
rtype = "%s(%s)" % (rtype, precision)
returns = "returns %s " % rtype
else: returns = ""
@@ -527,6 +533,7 @@
dtype = "%s(%s,%s)" % (dtype, precision, scale)
elif precision != 38 and precision != 0:
dtype = "%s(%s)" % (dtype, precision)
+ elif dtype == "TABLE": dtype = 'TABLE OF'
elif dtype == "REF CURSOR": pass
elif precision != 0:
dtype = "%s(%s)" % (dtype, precision)
@@ -544,6 +551,11 @@
for i in range(0, len(columns)):
answer = "%s\n%s%s" % (answer, "\t" * indent,
self.decodedesc(columns[i],indent+1))
+ elif dtype == 'TABLE OF':
+ columns = desc['OCI_ATTR_LIST_ARGUMENTS']
+ for i in range(0, len(columns)):
+ answer = "%s %s" % (answer,
+ join(split(self.decodedesc(columns[i],indent+1))[3:]))
return answer
@@ -577,7 +589,11 @@
elif etype == "argument":
if name is not None:
answer = "%s%s " % (answer, name)
- (dtype, size, precision, scale, isnull, inout) = sdesc
+ if len(sdesc) > 6:
+ (dtype, size, precision, scale, isnull, inout, tabof) = sdesc
+ else:
+ (dtype, size, precision, scale, isnull, inout) = sdesc
+ tabof = ()
dtype = Type(dtype)
if dtype == "NUMBER":
if scale != 0:
@@ -585,6 +601,8 @@
elif precision != 38 and precision != 0:
dtype = "%s(%s)" % (dtype, precision)
elif dtype == "REF CURSOR": pass
+ elif dtype == "TABLE":
+ dtype = "TABLE OF %s" % self.decodecdesc(tabof)[2:]
elif precision != 0:
dtype = "%s(%s)" % (dtype, precision)
answer = "%s%s %s\n" % (answer, join(inout), dtype)
@@ -914,9 +932,10 @@
# XXX XXX
# XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
- baoa[c].setStatic(1) # Mark this as a static binding
+ #baoa[c].setStatic(1) # Mark this as a static binding
- self._cursor.bindbypos(c + 1, baoa[c])
+ # ERROR -- this is too early for a normal binding array bind
+ #self._cursor.bindbypos(c + 1, baoa[c])
# now populate the binding array by our batch size
for i in xrange((rows + BATCHSZ -1) / BATCHSZ):
@@ -933,6 +952,9 @@
baoa[c][br] = p.value
else:
baoa[c][br] = p
+ for c in xrange(columns):
+ # (re-)bind the binding array so it has the proper length
+ self._cursor.bindbypos(c + 1, baoa[c])
# Execute the batch
result = self._cursor.execute(batchend-batchstart)
@@ -1143,19 +1165,21 @@
v = d[1]
# Now, if this is an IN parameter?
#print d
- if 'IN' in d[3][5]:
+ mode = d[3][5]
+
+ if 'IN' in mode:
if keymap.has_key(v):
- argmap.append([keymap[v], d[3][5], d[3]])
+ argmap.append([keymap[v], mode, d[3]])
#print "Binding argument %s= %s" % (v, keymap[v])
else:
if len(args) <= argsused:
raise ValueError, "Not enough arguments"
- argmap.append([args[argsused], d[3][5], d[3]])
+ argmap.append([args[argsused], mode, d[3]])
#print "Binding argument %s= %s" % (v, args[argsused])
argsused = argsused + 1
# Otherwise, it's an OUT parameter, and we pass in NULL for those
else:
- argmap.append([None, d[3][5], d[3]])
+ argmap.append([None, mode, d[3]])
argconvert.append(None)
arglist.append(str(i+1))