Subject: Oraperl change needed for V7 CHAR/VARCHAR2 DDL
From: [email-masked] (Michael Nolan)
Date: Wed, 13 Oct 1993 16:37:49 GMT
Newsgroups: comp.databases.oracle

I've discovered at least one change that needs to be made to oraperl 
in order to produce the expected results on an Oracle 7 database.

The change deals with DDL involving the CHAR and VARCHAR2 fields.  
In V7, CHAR is an ANSI-compliant fixed length field, VARCHAR2 is
now used for variable length fields which were CHAR in V6.

As a result, tables defined in oraperl using CHAR fields will come
out as VARCHAR2 unless a change is made to the orafns.c module.

I haven't set this up as a full patch, in part because there may
be additional changes.  (Also, I'm not quite prepared to assume
the task of maintaining oraperl.)  Ideally this should be a
configurable parameter, or maybe more than one parameter, to
select V7 functionality and options.

In the section dealing with the ora_open function in orafns.c, 
around line 242, locate the following:

	    || (osql3(csr->csr, stmt, -1) != 0)

I changed it to the following:

	    || (oparse(csr->csr, stmt, -1, 1, 2) != 0)
                                              ^
The indicated parameter determines whether you get Version 6 or
Version 7 behavior.  From page 4-70 of the Programmers Guide to 
the OCI's for V7:
0 - Version 6 behavior (CHAR becomes VARCHAR2)
1 - Version 6 or 7 behavior, depending on what you're connected to
2 - Version 7 behavior (will fail if used while connected to V6.)

The oparse call replaces the osql3 call in V7, this appears to be 
the only time it is referenced in oraperl.  The '1' parameter
deals with applications linked in deferred mode.  (See page 4-69
for explanation, it's still greek to me.)

I've not tested this with a V6 database yet (I'm running V7, which
is why I used the value of 2 above), and I'm not sure whether
there are other areas of oraperl that will need to be similarly
modified to deal with the differences betweeh CHAR and VARCHAR2.  
I'm also not sure whether '1' or '2' is the better choice in general.
---
Michael Nolan, Tailored Software Services, Inc.
Lincoln, Nebraska
Sysop for the GEnie DBMS RoundTable
[email-masked], [email-masked]