🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.bugs
Article #10

help needed: dbkit and/or oracle adaptor bug

#10
From: Mike Bray
Date: Thu, 31 Dec 1992 19:23
62 lines
3363 bytes
DBKit - Oracle Adapter Bug

There are two, possibly related, problems with the DBDatabase delegate 
"db:notificationFrom:message:code".  I am in great need of a work around for 
problem #1.

1.  When doing a fetch, and Oracle discovers an error during the parse phase, 
db:notificationFrom:message:code generally returns the proper error code (see 
#2 below for a time when it doesn't).  If an error occurs during the fetch 
phase, no notificationFrom: message is generated, and the "db:log:" delegate 
prints the message "selectData:  succeeded".  However, no data is available, 
and dependent display objects show blanks.  This is very bad, because I need 
access to Oracle's error number.

Here's an example that works properly:

From SQL*DBA, "select garbage_column_name from dual" correctly returns:
ORA-00904:  invalid column name

Creating a DBExpression with the string "garbage_column_name" and then 
fetching it causes the notificationFrom delegate to be called, yielding the 
proper error code number, -904.

Now for the example that doesn't work right:

From SQL*DBA, "select to_date('asdf') from dual" returns:

TO_DATE('
---------
ORA-01858:  a letter was found in a date where a number was expected

This is proper behavior.  Notice that a column heading was printed, 
"TO_DATE('",
indicating that the statement parsed ok, but Oracle found an error during the 
evaluation of the statement.  This differs from the first example, where no 
column heading is printed, since it doesn't get as far through the 
parse/evaluation process.

Creating a DBExpression with the string "to_date('asdf')" and then fetching it 
DOES NOT generate a notificationFrom: event.  This is a major problem.  
Watching the results of "db:log:", a "selectData:  succeeded" message goes by, 
but the number of records fetched is zero.  Checking for zero is the only 
indication we have that an error occurred.  

How can I get the error message from Oracle?  I'm assuming that this bug is 
some problem in interpreting the error codes returned by Oracle OCI.  I really 
need some sort of work around for this problem.


2.  When attempting to insert a duplicate value into an index defined as 
unique, 
oracle version 6 generates "ORA-00001:  duplicate key in index", which is the 
proper code.  When attempted through DBKit, the notificationFrom: code is 9, 
which is not a valid V6 error number.  However, consulting the Oracle OCI 
manual, the value 9 is the value returned by Oracle Version 2!  It is still 
provided for backward compatibility in the OCI cursor data area, called the V2 
Return Code.  Is this somehow being accessed by mistake?  I can work around 
this problem, since it consistently returns the same value, but it seems that 
this might be a problem related to #1 above.

Thanks,
Mike Bray  307-332-6973 x279
Technical Details
Message-ID: <1992Dec31.192359.22612@wuecl.wustl.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wupost!eclnews!usenet

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.bugs,comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wupost!eclnews!usenet
From: mrb@earth.wustl.edu (Mike Bray)
Subject: help needed:  dbkit and/or oracle adaptor bug
Message-ID: <1992Dec31.192359.22612@wuecl.wustl.edu>
Sender: usenet@wuecl.wustl.edu (News Administrator)
Nntp-Posting-Host: earth
Organization: Washington University, St. Louis MO
Date: Thu, 31 Dec 1992 19:23:59 GMT
Lines: 62