Re: oraperl problem with &ora_do(..)

From: C.J.Jardine <cj10_at_ucs.cam.ac.uk>
Date: Thu, 1 Sep 1994 15:54:36
Message-ID: <cj10.18.000FE96C_at_ucs.cam.ac.uk>


In article <1994Aug27.011351.23549_at_ml.csiro.au> jstander_at_ml.csiro.au (Jeff Stander) writes:

>The following oraperl script goes off into never-never land while executing
>the &ora_do statement and has to be killed.  However, THE TABLE IS CREATED BY
>THIS STATEMENT!  Have any of you oraperl hackers seen this problem or know
>what to do about it?  I am working on a Sun 10 under SunOS with patch 3 of
>oraperl and perl 4.0 patchlevel 35.


>#!/usr/local/bin/oraperl  

>$|=1;
>$lda=&ora_login("","","");
>print "creating.";
>print &ora_do($lda,"create table junk (test varchar2(20))");
>print "\n";
 

>Thanks,  

>Jeff

I have just walked into this too.

Some time ago I posted a warning about a bug affecting oraperl's processing of SELECT statements yeilding more than 16 columns. The cause was a bug in the OCI routine odsc. The bug only struck if the OCI program was linked in deferred mode (the default). I recommended that people re-link oraperl in non-deferred mode, and posted a suitable make file.

I have analysed the bug mentioned above. It is caused by a different bug in odsc! Moreover, this new bug only strikes if oraperl is linked in non-deferred mode:-(

The new bug is that odsc is giving rc=0 when it should give rc=1007 when it is asked to describe a column returned by a DDL statement. I am fairly sure it was introduced in 7.0.16. I have reported it to Oracle UK. The problem log number is 405032.

The old 16-column bug is fixed in 7.0.16.

I therefore recommend that thos of you with 7.0.16 re-link oraperl in deferred mode. I append the makefile I used.

Charles Jardine, University of Cambridge (UK) Computing Service



# Makefile for Oraperl and Coraperl

# Change these to your ORACLE installation directory and Perl source directory
#

ORACLE_HOME     = /jackdaw/oracle
SRC             = /jackdaw/perl/perl-4.036


# The following lines are extracted from $ORACLE_HOME/rdbms/lib/oracle.mk
# They must be checked whenever a new version of Oracle is installed,
# as the contents of oracle.mk may change.

LIBHOME=$(ORACLE_HOME)/lib

CC=/usr/5bin/cc

LDFLAGS=-Bdynamic -L$(LIBHOME)

LIBCORE=$(LIBHOME)/libcore.a

LIBCV6=$(LIBHOME)/libcv6.a

LLIBCORE=-lcore

LLIBCV6=-lcv6

LLIBNLSRTL=-lnlsrtl

LLIBORA=-lora

OSNTAB= $(LIBHOME)/osntab.o

LIBOCIC=$(LIBHOME)/libocic.a

OTHERLIBS=`cat $(ORACLE_HOME)/rdbms/lib/sysliblist` $(MLSLIBS)

LIBSQLNET=$(LIBHOME)/libsqlnet.a
LLIBSQLNET=-lsqlnet

FORMS30GUILIBS= CORELIBS=$(LLIBNLSRTL) $(LLIBCV6) $(LLIBCORE) $(LLIBNLSRTL) $(LLIBCV6) \     $(LLIBCORE) NETLIBS=$(OSNTAB) $(LLIBSQLNET) CLIBS=$(OTHERLIBS) TTLIBS= $(NETLIBS) $(LLIBORA) $(LIBPLSHACK) $(LLIBSQLNET) $(CORELIBS)\     $(FORMS30GUILIBS) $(CLIBS) NDFOPT= $(ORACLE_HOME)/rdbms/lib/kpundf.o

OCILDLIBS= $(LIBOCIC) $(TTLIBS) $(LLIBCORE)
# end of extract from oracle.mk

ALL_ORA_LDFLAGS = $(LDFLAGS)
# Note the inclusion of NDFOPT in the following. It causes oraperl to
# be linked in non-deferred mode. This is a workround for a bug present
# in both 7.0.12 and 7.0.13. The symptom of this bug is that when oraperl
# processes a select yielding more than 16 columns, the first column
# is processed incorrectly.

# Despite the above comment, NDFOPT is now removed. in version
# 7.0.16, the above mentioned bug is fixed, but a new bug is introduced.
# This bug causes oraperl to loop when processing DDL statements if
# it is linked in non-deferred mode.

# ALL_ORA_LIBS = $(NDFOPT) $(OCILDLIBS) $(CLIBS)
ALL_ORA_LIBS = $(OCILDLIBS) $(CLIBS)
# Perl Definitions, taken from $SRC/usub/Makefile
# Don't include the curses libraries here - they go in CURSELIB
#

GLOBINCS        = 
LOCINCS         = 
LIBS            = `. $(SRC)/config.sh; echo $$libs`

# Oraperl Definitions

# Set DEBUG to -DDEBUGGING, -DPERL_DEBUGGING or leave blank (see orafns.h)
# If it is not blank, uncomment the definition of DBUG_O
#

DEBUG           = -DDEBUGGING
DBUG_O          = dbug/dbug.o

# Curses libraries, only required if you want to build Coraperl
# You may also need -ltermlib or -ltermcap
#

CURSELIB = -lcurses

# Row cache size for SELECT statements.
# If you want to change the default, uncomment this and set the value you want
#
#CACHE = -DCACHE_SIZE=5

# Bind variable padding.
# If you want binding an empty string to provoke an error, uncomment this line.
#
#BIND = -DNO_BIND_PADDING

# Some system-specific things
#
# If your system library does not include strtoul, uncomment the next line
STRTOUL = strtoul.o
#
# If your malloc() returns anything other than a char *, set the appropriate
# type here (don't include the *)

MALLOC_PTR_TYPE=void
#
# If you are using Perl v3 instead of v4, uncomment the next line
# STR_2MORTAL = -Dstr_2mortal=str_2static

# Database, username and password to use for testing
#

TESTDATA = t scott tiger

#
# Leave these blank lines so that patches to what is below
# won't be upset by your changes to the setups above.
#

# From here on, you shouldn't need to change anything. If you do, let me know.

SRCS            = oracle.mus orafns.c getcursor.c colons.c usersub.c \
                  debug.c strtoul.c
OBJS            = oracle.o orafns.o getcursor.o colons.o debug.o $(STRTOUL)
OOBJS           = $(OBJS) usersub.o $(DBUG_O)
COBJS           = $(OBJS) cusersub.o $(DBUG_O)
HDRS            = patchlevel.h orafns.h
DEFS            = $(STRTOL) $(PUTENV) $(STR_2MORTAL) $(DEBUG) $(CACHE) $(BIND)

CFLAGS          = -Idbug -I$(SRC) $(GLOBINCS) $(LOCINCS) $(DEFS)

oraperl: $(SRC)/uperl.o $(OOBJS)
        $(CC) $(ALL_ORA_LDFLAGS) -o oraperl $(SRC)/uperl.o $(OOBJS)            \
              -lm $(ALL_ORA_LIBS) $(LIBS)

coraperl: $(SRC)/uperl.o $(COBJS) $(SRC)/usub/curses.o
        $(CC) $(ALL_ORA_LDFLAGS) -o coraperl $(SRC)/uperl.o $(COBJS) \
                $(SRC)/usub/curses.o    \
              -lm $(ALL_ORA_LIBS) $(LIBS) $(CURSELIB)

all: oraperl coraperl

test: oraperl

        _at_oraperl -e '&ora_version'
        _at_(cd testdir ;                                                        \
          rm -f My-Results ;                                                  \
          echo "Testing oraperl, please wait ..." ;                           \
          for i in *.pl ; do ../oraperl $$i $(TESTDATA) ; done > My-Results ; \
          if cmp -s Standard-Results My-Results ;                             \
          then echo "Test successful" ;                                       \
          else echo "Test failed - compare My-Results with Standard-Results" ;\
          fi; echo)

# We use oraperl although perl would suffice, because we know where it is!

install:        oraperl install.pl
        _at_./oraperl ./install.pl ${SRC}

cusersub.c:     usersub.c
        _at_rm -f cusersub.c
        ln usersub.c cusersub.c

cusersub.o:     cusersub.c
        $(CC) -c $(CFLAGS) -DCURSES cusersub.c

oracle.c: $(SRC)/usub/mus oracle.mus
        perl $(SRC)/usub/mus oracle.mus >oracle.c

$(OOBJS) $(COBJS):      $(HDRS)

dbug/dbug.o:
        (cd dbug ; $(MAKE) dbug.o)
        _at_echo " (back to main directory)"

clean:
        (cd dbug ; $(MAKE) clean)
        _at_echo " (back to main directory)"
        rm -f nohup.out *.o oracle.c cusersub.c
        rm -f testdir/My-Results listing tags core

realclean clobber:      clean
        (cd dbug ; $(MAKE) clobber)
        (cd doc ; $(MAKE) clobber)
        _at_echo " (back to main directory)"
        rm -f oraperl coraperl

listing:
        pr -fn Makefile $(HDRS) $(SRCS) >listing

docs:
        (cd doc ; $(MAKE) docs)
        _at_echo " (back to main directory)"

shar:   clean
        shar -n oraperl-v2 -a -s kstock_at_encore.com -F -o :Part -l 64    \
                Readme [C-Q]* Row* [S-z]*
Received on Thu Sep 01 1994 - 15:54:36 CEST

Original text of this message