[Zope-DB] DCO2 and nulls again

Matthew T. Kromer matt@zope.com
Wed, 19 Dec 2001 13:29:36 -0500


Fredrik Svensson wrote:

>Hi,
>
>I haven't done the trace thing that Matt told me yet (I'll leave the tracing
>thingy to Dario ;-) but I just noticed something. We did not have this
>problem when we were running on solaris. We changed to RedHat 7.2 a few
>weeks ago since we experienced performance problems on solaris. I've tested
>the same queries on both installations and only the RedHat one generates bad
>null values. The DCO2 we are running on the solaris installation is a bit
>older though. It was checked out from CVS on october 28:th.
>
>Is anyone else running DCO2 on RedHat 7.2 successfully??
>
>/Fredrik
>
>>>The version of DCO2 we are using was checked out of CVS on december the
>>>
>4:th
>
>>>and compiled on a RedHat 7.2 with Oracle client 8.1.7.1
>>>

Note that under Oracle 8.1.5 (which is what I have at work, I have 
various other installs scattered around elsewhere with different 
versions of Oracle) I get strange NULL values when doing inserts of 
non-NULL data in batches when using OCI dynamic binding.

DCOracle2 uses a BindingArray object to bind arrays of objects, and this 
has a setStatic method to bind it statically rather than the default of 
dynamically (changing from OCI_DATA_AT_EXEC  mode).  Sometimes, however, 
Oracle *skips* the callback for data, in an apparently random fashion. 
 This is why there's a block inside the DCOracle2.py with a big warning 
around it that sets the static binding on.  There are some stupid-isms 
as well with the way DCOracle2 interprets bindings  from "here are the 
arrays to iterate over, one at a time" vs "here is the table to insert 
into PL/SQL" which currently inspect that static flag on the binding 
array to guess which mode it is supposed to operate in (sounds 
confusing, doesn't it?).

Technically I should probably look at the statement type (which is 
already known from the prepare stage); if you arent doing PL/SQL you 
can't be passing in an array/table.

BTW, since I'm rambling about DOracle2 (and not answering your question) 
here's another debugging tip:

import DCOracle2
db = DCOracle2.connect('scott/tiger') # or whatever
print db.Version()    # gives you a dictionary of version strings that 
can be useful to look at

e.g.
 >>> print db.Version()
{'PL/SQL ': '8.1.5.0.0 (Production)', 'NLSRTL ': '3.4.0.0.0 
(Production)', 'CORE ': '8.1.3.0.0 (Production)', 'Oracle8i Enterprise 
Edition ': '8.1.5.0.2 (Production)', 'DCOracle2': '1.78 (dco2: 1.97 
-DORACLE8i -Dlinux )', 'TNS for Linux: ': '8.1.5.0.0 (Production)'}

Yes, the method name is crappy -- Version vs VersionDict or something. 
 Sue me.

Now on to answering your question.

Downstairs on one of our test machines, I am running Oracle 9i with 
Redhat 7.2.  I've got an enormous Data.fs in it from one of our clients 
using DCOracleStorage.  So I am using Redhat 7.2 yes, but not with 8.1.7.1.