home *** CD-ROM | disk | FTP | other *** search
- diff -c /user/mis/kstock/tmp/CHANGES ./CHANGES
- *** /user/mis/kstock/tmp/CHANGES Fri Aug 23 08:50:45 1991
- --- ./CHANGES Fri Aug 23 09:10:27 1991
- ***************
- *** 8,10 ****
- --- 8,16 ----
- Added network addresses to the manual pages
- Added a PATCHLEVEL file
- No functional changes
- +
- + Patch 02
- + ========
- + Added support for dynamically modifiable SQL statements
- + Added a Hints file
- + Corrected an error in the quick-reference sheet
- diff -c /user/mis/kstock/tmp/Makefile ./Makefile
- *** /user/mis/kstock/tmp/Makefile Fri Aug 23 08:50:56 1991
- --- ./Makefile Mon Aug 5 11:01:38 1991
- ***************
- *** 3,9 ****
- # Change these to your ORACLE installation directory and Perl source directory
-
- ORACLE_HOME = /usr/soft/oracle
- ! SRC = /usr/soft/public/perl_4.0.09
-
- # Oracle Definitions, taken from proc.mk
-
- --- 3,9 ----
- # Change these to your ORACLE installation directory and Perl source directory
-
- ORACLE_HOME = /usr/soft/oracle
- ! SRC = /usr/soft/public/perl_4.0.10
-
- # Oracle Definitions, taken from proc.mk
-
- ***************
- *** 27,48 ****
- DEBUG = -DPERL_DEBUGGING
- CFLAGS = $(DEBUG) -I$(SRC) $(GLOBINCS) -O
-
- ! oraperl: $(SRC)/uperl.o usersub.o oracle.o orafns.o getcursor.o
- ! cc -o oraperl $(SRC)/uperl.o usersub.o oracle.o orafns.o getcursor.o \
- ! -lm $(OCILIB) $(NETLIBS) $(ORALIBS) $(CLIBS) $(LIBS)
-
- oracle.c: $(SRC)/usub/mus oracle.mus
- - chmod +x $(SRC)/usub/mus
- $(SRC)/usub/mus oracle.mus >oracle.c
-
- ! usersub.o oracle.o orafns.o getcursor.o: orafns.h
- !
- ! print: Makefile orafns.h orafns.c oracle.mus usersub.c getcursor.c
- ! pr -fn Makefile orafns.h getcursor.c orafns.c oracle.mus usersub.c | \
- ! pr -fto4 -e > Print
- !
- ! man: oraperl.1
- ! nroff -man oraperl.1 >oraperl.man
-
- clean:
- rm -f nohup.out oraperl *.o oracle.c oraperl.man Print tags out core
- --- 27,44 ----
- DEBUG = -DPERL_DEBUGGING
- CFLAGS = $(DEBUG) -I$(SRC) $(GLOBINCS) -O
-
- ! SRCS = usersub.c oracle.c orafns.c getcursor.c colons.c
- ! OBJS = usersub.o oracle.o orafns.o getcursor.o colons.o
- ! HDRS = orafns.h
- !
- ! oraperl: $(SRC)/uperl.o $(OBJS)
- ! cc -o oraperl $(SRC)/uperl.o $(OBJS) \
- ! -lm $(OCILIB) $(NETLIBS) $(ORALIBS) $(CLIBS) $(LIBS)
-
- oracle.c: $(SRC)/usub/mus oracle.mus
- $(SRC)/usub/mus oracle.mus >oracle.c
-
- ! $(OBJS): $(HDRS)
-
- clean:
- rm -f nohup.out oraperl *.o oracle.c oraperl.man Print tags out core
- diff -c /user/mis/kstock/tmp/Oracle-v5 ./Oracle-v5
- *** /user/mis/kstock/tmp/Oracle-v5 Fri Aug 23 08:50:46 1991
- --- ./Oracle-v5 Wed Aug 7 09:24:00 1991
- ***************
- *** 20,28 ****
- >
- > LDFLAGS = -L$(ORACLE_HOME)/c/libs -L$(ORACLE_HOME)/rdbms/libs
- >
- ! > oraperl: $(SRC)/uperl.o usersub.o oracle.o orafns.o getcursor.o
- ! > $(CC) -o oraperl $(LDFLAGS) $(SRC)/uperl.o usersub.o oracle.o orafns.o \
- ! > getcursor.o $(ORALIBS) $(LIBS)
-
- Second method - much simpler. Only seems to require the first two libraries
- (libocic and liboracle) of the previous method, but this time they live under
- --- 20,27 ----
- >
- > LDFLAGS = -L$(ORACLE_HOME)/c/libs -L$(ORACLE_HOME)/rdbms/libs
- >
- ! > oraperl: $(SRC)/uperl.o $(OBJS)
- ! > $(CC) -o oraperl $(LDFLAGS) $(SRC)/uperl.o $(OBJS) $(ORALIBS) $(LIBS)
-
- Second method - much simpler. Only seems to require the first two libraries
- (libocic and liboracle) of the previous method, but this time they live under
- diff -c /user/mis/kstock/tmp/PATCHLEVEL ./PATCHLEVEL
- *** /user/mis/kstock/tmp/PATCHLEVEL Fri Aug 23 08:50:47 1991
- --- ./PATCHLEVEL Mon Aug 5 11:01:39 1991
- ***************
- *** 1 ****
- ! 1
- --- 1 ----
- ! 2
- diff -c /user/mis/kstock/tmp/README ./README
- *** /user/mis/kstock/tmp/README Fri Aug 23 08:50:56 1991
- --- ./README Fri Aug 23 08:53:04 1991
- ***************
- *** 24,30 ****
- be changed to str_2static() with the same arguments.
-
- I've only tested this on an Encore Multimax 520 running UMAX V (Sys Vr3.2),
- ! using Perl 3.0.34, 4.0.00 4.0.03 and 4.0.09 with Oracle version 6, as I don't
- have access to any other system with Pro*C. I'd appreciate any comments,
- bug-reports etc.
-
- --- 24,30 ----
- be changed to str_2static() with the same arguments.
-
- I've only tested this on an Encore Multimax 520 running UMAX V (Sys Vr3.2),
- ! using Perl 3.0.34, 4.0.00 4.0.03 and 4.0.10 with Oracle version 6, as I don't
- have access to any other system with Pro*C. I'd appreciate any comments,
- bug-reports etc.
-
- ***************
- *** 37,52 ****
- getcursor.c functions to deal with the cursor pool
- orafns.c actual functions to interact with oracle
- usersub.c initialisation routine
-
- ! Examples (taken from the manual page)
- debug-p tests to see if debugging is available
- ex.pl simple example of using the functions
-
- Documentation
- oraperl.doc explains some of the thinking behind Oraperl
- oraperl.ref quick reference (troff format)
- oraperl.1 manual page
- Oracle-v5 Hints for compiling Oraperl with Oracle v5
-
- Many thanks to Larry for Perl. Now if only we could get the Camel book
- into France! Hmm. Any plans for "Le Livre Chameau"?
- --- 37,59 ----
- getcursor.c functions to deal with the cursor pool
- orafns.c actual functions to interact with oracle
- usersub.c initialisation routine
- + colons.c counts substitution variables in a statement
-
- ! Examples
- debug-p tests to see if debugging is available
- ex.pl simple example of using the functions
- + mkdb.pl more extensive example, showing the use of ora_bind()
-
- Documentation
- oraperl.doc explains some of the thinking behind Oraperl
- oraperl.ref quick reference (troff format)
- oraperl.1 manual page
- + Hints notes on using oraperl
- Oracle-v5 Hints for compiling Oraperl with Oracle v5
- +
- + Miscellaneous
- + CHANGES Summary of changes to Oraperl
- + PATCHLEVEL current patchlevel (2)
-
- Many thanks to Larry for Perl. Now if only we could get the Camel book
- into France! Hmm. Any plans for "Le Livre Chameau"?
- diff -c /user/mis/kstock/tmp/getcursor.c ./getcursor.c
- *** /user/mis/kstock/tmp/getcursor.c Fri Aug 23 08:50:57 1991
- --- ./getcursor.c Mon Aug 5 11:01:39 1991
- ***************
- *** 269,275 ****
- {
- DEBUG(8, (fprintf(stderr, "check_csr(%#lx)\n", (long) csr)));
-
- ! if (ora_findcursor(csr) && (csr->hda == NULL) && (csr->data != NULL))
- {
- DEBUG(8, (fputs("check_csr: valid\n", stderr)));
- return (1);
- --- 269,275 ----
- {
- DEBUG(8, (fprintf(stderr, "check_csr(%#lx)\n", (long) csr)));
-
- ! if (ora_findcursor(csr) && (csr->hda == NULL))
- {
- DEBUG(8, (fputs("check_csr: valid\n", stderr)));
- return (1);
- diff -c /user/mis/kstock/tmp/oracle.mus ./oracle.mus
- *** /user/mis/kstock/tmp/oracle.mus Fri Aug 23 08:50:57 1991
- --- ./oracle.mus Mon Aug 5 11:01:39 1991
- ***************
- *** 25,30 ****
- --- 25,31 ----
- static enum usersubs {
- US_ora_login,
- US_ora_open,
- + US_ora_bind,
- US_ora_fetch,
- US_ora_close,
- US_ora_logoff,
- ***************
- *** 53,58 ****
- --- 54,60 ----
-
- make_usub("ora_login", US_ora_login, usersub, filename);
- make_usub("ora_open", US_ora_open, usersub, filename);
- + make_usub("ora_bind", US_ora_bind, usersub, filename);
- make_usub("ora_fetch", US_ora_fetch, usersub, filename);
- make_usub("ora_close", US_ora_close, usersub, filename);
- make_usub("ora_logoff", US_ora_logoff, usersub, filename);
- ***************
- *** 115,120 ****
- --- 117,148 ----
- }
- /* NOTREACHED */
-
- + case US_ora_bind:
- + if (items < 2)
- + fatal("Usage: &ora_bind($csr, $var ...)");
- + else {
- + char *csr = (char *) str_get(st[1]);
- + char **vars = (char **) malloc((items-1) * sizeof(char *));
- + int i, retval;
- +
- + if (vars == NULL)
- + {
- + ora_errno = ORAP_NOMEM;
- + retval = 0;
- + }
- + else
- + {
- + for (i = 0 ; i < items - 1 ; i++)
- + {
- + vars[i] = (char *) str_get(st[i+2]);
- + }
- + retval = ora_bind(csr, vars, items - 1);
- + }
- +
- + str_numset(st[0], (double) retval);
- + }
- + return sp;
- +
- CASE char * ora_close
- I char * csr
- END
- ***************
- *** 202,207 ****
- --- 230,243 ----
-
- case ORAP_NOSID:
- str_set(str, "couldn't set ORACLE_SID");
- + break;
- +
- + case ORAP_BADVAR:
- + str_set(str, "bad colon variable sequence");
- + break;
- +
- + case ORAP_NUMVARS:
- + str_set(str, "wrong number of variables");
- break;
-
- default:
- diff -c /user/mis/kstock/tmp/orafns.c ./orafns.c
- *** /user/mis/kstock/tmp/orafns.c Fri Aug 23 08:50:57 1991
- --- ./orafns.c Mon Aug 5 11:01:40 1991
- ***************
- *** 186,199 ****
- }
-
-
- ! /* ora_open(lda, query)
- *
- ! * sets and executes the specified sql query
- */
-
- ! char *ora_open(lda_s, query)
- char *lda_s;
- ! char *query;
- {
- int i;
- struct cursor *csr;
- --- 186,199 ----
- }
-
-
- ! /* ora_open(lda, stmt)
- *
- ! * sets and executes the specified sql statement
- */
-
- ! char *ora_open(lda_s, stmt)
- char *lda_s;
- ! char *stmt;
- {
- int i;
- struct cursor *csr;
- ***************
- *** 200,206 ****
- struct cursor *lda = (struct cursor *) strtol(lda_s, (char **) NULL, 0);
- short dbsize;
-
- ! DEBUG(8, (fprintf(stderr, "ora_open(%#lx, %s)\n", (long) lda, query)));
-
- if (check_lda(lda) == 0)
- {
- --- 200,206 ----
- struct cursor *lda = (struct cursor *) strtol(lda_s, (char **) NULL, 0);
- short dbsize;
-
- ! DEBUG(8, (fprintf(stderr, "ora_open(%#lx, %s)\n", (long) lda, stmt)));
-
- if (check_lda(lda) == 0)
- {
- ***************
- *** 216,224 ****
- return((char *) NULL);
- }
-
- if ((oopen(csr->csr, lda->csr, (char *)-1, -1, -1, (char *)-1, -1) != 0)
- ! || (osql3(csr->csr, query, -1) != 0)
- ! || (oexec(csr->csr) != 0))
- {
- ora_errno = csr->csr->csrrc;
- ora_dropcursor(csr);
- --- 216,238 ----
- return((char *) NULL);
- }
-
- + /* Check whether there are any substitution variables in the statement
- + * If there are, we don't execute the statement yet.
- + */
- + if ((csr->varfields = count_colons(stmt)) < 0)
- + {
- + DEBUG(8, (fputs("ora_open: invalid variable sequence\n",
- + stderr)));
- + ora_errno = ORAP_BADVAR;
- + return((char *) NULL);
- + }
- +
- + DEBUG(8, (fprintf(stderr,
- + "ora_open: statement contains %d colons\n", csr->varfields)));
- +
- if ((oopen(csr->csr, lda->csr, (char *)-1, -1, -1, (char *)-1, -1) != 0)
- ! || (osql3(csr->csr, stmt, -1) != 0)
- ! || ((csr->varfields == 0) && (oexec(csr->csr) != 0)))
- {
- ora_errno = csr->csr->csrrc;
- ora_dropcursor(csr);
- ***************
- *** 239,274 ****
-
- ora_errno = 0;
-
- ! if ((csr->data = (char **) malloc(i * sizeof(char *))) == NULL)
- ! {
- ! DEBUG(128, (fputs("ora_open: out of memory\n", stderr)));
- ! DEBUG(8, (fputs("ora_open: returning NOMEM\n", stderr)));
- ! ora_errno = ORAP_NOMEM;
- ! ora_dropcursor(csr);
- ! return(0);
- ! }
- ! DEBUG(128, (fprintf(stderr, "ora_open: got data at %#lx\n",csr->data)));
- ! csr->nfields = i;
- !
- ! for (i = 0 ; i < csr->nfields ; i++)
- {
- ! odsc(csr->csr, i + 1, &dbsize, (short *) 0, (short *) 0,
- ! (short *) 0, (char *) 0, (short *) 0, (short *) 0);
- !
- ! if ((csr->data[i] = (char *) malloc(dbsize + 1)) == NULL)
- {
- - csr->nfields = i;
- - ora_dropcursor(csr);
- -
- DEBUG(128, (fputs("ora_open: out of memory\n",stderr)));
- DEBUG(8, (fputs("ora_open: returning NOMEM\n",stderr)));
- ora_errno = ORAP_NOMEM;
- ! return((char *) NULL);
- }
- ! DEBUG(128, (fprintf(stderr, "ora_open: got field %d at %#lx\n",
- ! i, csr->data[i])));
- ! odefin(csr->csr, i + 1, csr->data[i], dbsize + 1, 5, 0,
- ! (short *) 0, (char *) 0, 0, 0, (short *) 0, (char *) 0);
- }
-
- sprintf(address, "%#lx", (long) csr);
- --- 253,300 ----
-
- ora_errno = 0;
-
- ! if (i > 0)
- {
- ! if ((csr->data = (char **) malloc(i * sizeof(char *))) == NULL)
- {
- DEBUG(128, (fputs("ora_open: out of memory\n",stderr)));
- DEBUG(8, (fputs("ora_open: returning NOMEM\n",stderr)));
- ora_errno = ORAP_NOMEM;
- ! ora_dropcursor(csr);
- ! return(0);
- ! }
- ! DEBUG(128, (fprintf(stderr,
- ! "ora_open: got data at %#lx\n",csr->data)));
- ! csr->nfields = i;
- !
- ! for (i = 0 ; i < csr->nfields ; i++)
- ! {
- ! odsc(csr->csr, i + 1, &dbsize, (short *) 0, (short *) 0,
- ! (short *) 0, (char *) 0, (short *) 0, (short *) 0);
- !
- ! if ((csr->data[i] = (char *) malloc(dbsize+1)) == NULL)
- ! {
- ! csr->nfields = i;
- ! ora_dropcursor(csr);
- ! DEBUG(128, (fputs("ora_open: out of memory\n",
- ! stderr)));
- ! DEBUG(8, (fputs("ora_open: returning NOMEM\n",
- ! stderr)));
- ! ora_errno = ORAP_NOMEM;
- ! return((char *) NULL);
- ! }
- ! DEBUG(128, (fprintf(stderr,
- ! "ora_open: got field %d at %#lx\n",
- ! i, csr->data[i])));
- ! odefin(csr->csr, i + 1, csr->data[i], dbsize + 1, 5, 0,
- ! (short *) 0, (char *) 0, 0, 0, (short *) 0,
- ! (char *) 0);
- }
- ! }
- ! else
- ! {
- ! DEBUG(128, (fputs("ora_open: no data to return\n", stderr)));
- ! csr->data = NULL;
- }
-
- sprintf(address, "%#lx", (long) csr);
- ***************
- *** 309,314 ****
- --- 335,397 ----
- ora_errno = 0;
- DEBUG(8, (fprintf(stderr,"ora_fetch: returning <%d>\n", csr->nfields)));
- return(csr->nfields);
- + }
- +
- +
- + /* ora_bind(csr_s, vars, nitems)
- + *
- + * binds actual values to the SQL statement associated with csr
- + */
- +
- + int ora_bind(csr_s, vars, nitems)
- + char *csr_s, **vars;
- + int nitems;
- + {
- + int i, ret;
- + struct cursor *csr = (struct cursor *) strtol(csr_s, (char **) NULL, 0);
- +
- + DEBUG(8, (fprintf(stderr, "ora_bind(%#lx, %#lx, %d)\n",
- + (long) csr, (long) vars, nitems)));
- +
- + if (check_csr(csr) == 0)
- + {
- + DEBUG(8, (fputs("ora_bind: returning 0\n", stderr)));
- + ora_errno = ORAP_INVCSR;
- + return(0);
- + }
- +
- + if (csr->varfields != nitems)
- + {
- + DEBUG(8, (fprintf("ora_bind: expected %d items, got %d\n",
- + csr->varfields, nitems)));
- + ora_errno = ORAP_NUMVARS;
- + return(0);
- + }
- +
- + for (i = 0 ; i < nitems ; i++)
- + {
- + if ((ret = obndrn(csr->csr, i+1, vars[i], strlen(vars[i])+1,
- + 5, -1, (short *) -1, (char *) -1, 0, 0)) != 0)
- + {
- + ora_errno = csr->csr->csrrc;
- + DEBUG(8, (fputs("ora_bind: returning 0\n", stderr)));
- + return(0);
- + }
- +
- + DEBUG(8, (fprintf(stderr, "ora_bind: obndrv %d %s OK\n",
- + i + 1, vars[i])));
- + }
- +
- + if (oexec(csr->csr) != 0)
- + {
- + ora_errno = csr->csr->csrrc;
- + DEBUG(8, (fputs("ora_bind: returning 0\n", stderr)));
- + return(0);
- + }
- +
- + DEBUG(8, (fputs("ora_bind: oexec successful\n", stderr)));
- + DEBUG(8, (fputs("ora_bind: returning 1\n", stderr)));
- + return(1);
- }
-
-
- diff -c /user/mis/kstock/tmp/orafns.h ./orafns.h
- *** /user/mis/kstock/tmp/orafns.h Fri Aug 23 08:50:57 1991
- --- ./orafns.h Mon Aug 5 11:01:40 1991
- ***************
- *** 17,23 ****
- *ora_close(),
- *ora_logoff();
-
- ! int ora_fetch();
-
-
- /* These functions are internal to the system, not for public consumption */
- --- 17,24 ----
- *ora_close(),
- *ora_logoff();
-
- ! int ora_bind(),
- ! ora_fetch();
-
-
- /* These functions are internal to the system, not for public consumption */
- ***************
- *** 66,72 ****
- struct csrdef *csr;
- char *hda, /* used if this cursor is an lda */
- **data; /* used to receive database contents */
- ! int nfields; /* number of fields to retrieve */
- struct cursor *next; /* list pointer */
- };
-
- --- 67,74 ----
- struct csrdef *csr;
- char *hda, /* used if this cursor is an lda */
- **data; /* used to receive database contents */
- ! int nfields, /* number of fields to retrieve */
- ! varfields; /* number of modifiable variables */
- struct cursor *next; /* list pointer */
- };
-
- ***************
- *** 73,78 ****
- --- 75,81 ----
-
- /* functions that we use */
-
- + int count_colons();
- long strtol();
- char *getenv(), *malloc();
-
- ***************
- *** 125,131 ****
-
- #define ORAP_ERRMIN 100000 /* lowest value allowed for an oraperl error */
-
- ! #define ORAP_NOMEM 100001 /* out of memory */
- ! #define ORAP_INVCSR 100002 /* invalid cursor supplied */
- ! #define ORAP_INVLDA 100003 /* invalid lda supplied */
- ! #define ORAP_NOSID 100004 /* couldn't set ORACLE_SID */
- --- 128,136 ----
-
- #define ORAP_ERRMIN 100000 /* lowest value allowed for an oraperl error */
-
- ! #define ORAP_NOMEM 100001 /* out of memory */
- ! #define ORAP_INVCSR 100002 /* invalid cursor supplied */
- ! #define ORAP_INVLDA 100003 /* invalid lda supplied */
- ! #define ORAP_NOSID 100004 /* couldn't set ORACLE_SID */
- ! #define ORAP_BADVAR 100005 /* bad colon variable sequence */
- ! #define ORAP_NUMVARS 100006 /* wrong number of colon variables */
- diff -c /user/mis/kstock/tmp/oraperl.1 ./oraperl.1
- *** /user/mis/kstock/tmp/oraperl.1 Fri Aug 23 08:50:58 1991
- --- ./oraperl.1 Mon Aug 5 11:01:41 1991
- ***************
- *** 8,13 ****
- --- 8,14 ----
- .nf
- $lda = &ora_login($database, $name, $password)
- $csr = &ora_open($lda, $stmt)
- + &ora_bind($csr, $var, ...)
- &ora_fetch($csr)
- &ora_close($csr)
- &ora_logoff($lda)
- ***************
- *** 26,33 ****
- using \fIora_login\fP.
- This is called with three parameters,
- the system ID of the \fIOracle\fP database to be used,
- - (which \fIOracle\fP products expect
- - in the \fBORACLE_SID\fP environment variable)
- and the \fIOracle\fP username and password.
- The return value is a login identifier
- (an \fIORACLE Login Data Area\fP).
- --- 27,32 ----
- ***************
- *** 40,45 ****
- --- 39,51 ----
- The return value is a statement identifier
- (an \fIORACLE cursor\fP).
-
- + If the SQL statement contains substitution variables
- + (see later)
- + \fIora_bind\fP is used to assign values to them.
- + This takes a statement identifier (obtained from \fIora_open\fP)
- + as its first parameter,
- + followed by as many parameters as are required by the statement.
- +
- To retrieve the data returned from an \fISQL\fP \fBSELECT\fP statement,
- the program should make successive calls to \fIora_fetch\fP.
- This function takes a single parameter,
- ***************
- *** 71,76 ****
- --- 77,106 ----
- from the last function call, and
- \fIora_errstr\fP contains the \fIOracle\fP error message
- corresponding to the current value of \fIora_errno\fP.
- + .SH SUBSTITUTION VARIABLES
- + \fIOraperl\fP allows an SQL statement to contain substitution variables.
- + These consist of a colon (\fB:\fP) followed by a number.
- + For example, a program which added records to a telephone list
- + might use the following call to \fIora_open\fP:
- +
- + .ti +.5i
- + \f(CW$csr = &ora_open($csr, "insert into phonelist values(:1, :2)");\fP
- +
- + The two names \fB:1\fP and \fB:2\fP are called substitution variables.
- + The function \fIora_bind\fP is used to assign values to these variables.
- + For example, the following statements would add two new people to the list:
- +
- + .ti +.5i
- + \f(CW&ora_bind($csr, "Annette", "472-8836");\fP
- + .ti +.5i
- + \f(CW&ora_bind($csr, "Brian", "937-1823");\fP
- +
- + Note that the substitution variables must be assigned consecutively
- + beginning from \fB1\fP for each SQL statement,
- + as \fBora_bind()\fP assigns its parameters in this order.
- + Named substitution variables
- + (for example, \fB:NAME\fP, \fB:TELNO\fP)
- + are not permitted.
- .ne 28
- .SH EXAMPLE
- .if t .ft C
- ***************
- *** 90,96 ****
-
- die ("You should use oraperl, not perl\n") unless defined &ora_login;
-
- ! $lda = &ora_login("t", "name", "password")
- || die $ora_errstr;
- $csr = &ora_open($lda, "select * from telno order by name")
- || die $ora_errstr;
- --- 120,126 ----
-
- die ("You should use oraperl, not perl\n") unless defined &ora_login;
-
- ! $lda = &ora_login("t", "kstock", "kstock")
- || die $ora_errstr;
- $csr = &ora_open($lda, "select * from telno order by name")
- || die $ora_errstr;
- ***************
- *** 151,157 ****
- \fIORACLE\fP by Oracle Corporation, California.
- .br
- \fIPerl\fP by Larry Wall, Netlabs
- ! (\f(CWlwall@netlabs.com\fP, \f(CWlwall@netlabs.com\fP).
- .br
- \fIOraperl\fP by Kevin Stock, Encore Computer SA, France
- (\f(CWkstock@gouldfr.encore.fr\fP).
- --- 181,187 ----
- \fIORACLE\fP by Oracle Corporation, California.
- .br
- \fIPerl\fP by Larry Wall, Netlabs
- ! (\f(CWlwall@netlabs.com\fP).
- .br
- \fIOraperl\fP by Kevin Stock, Encore Computer SA, France
- (\f(CWkstock@gouldfr.encore.fr\fP).
- diff -c /user/mis/kstock/tmp/oraperl.doc ./oraperl.doc
- *** /user/mis/kstock/tmp/oraperl.doc Fri Aug 23 08:50:23 1991
- --- ./oraperl.doc Mon Aug 5 11:01:41 1991
- ***************
- *** 27,33 ****
- because it requires fixed addresses to be specified for receipt of data.
- A new interface was therefore created for \fBOraperl\fP.
-
- ! The interface follows the idiom of the following five tasks:
-
- .in +5
- .ta .4i 4.4i
- --- 27,33 ----
- because it requires fixed addresses to be specified for receipt of data.
- A new interface was therefore created for \fBOraperl\fP.
-
- ! The interface follows the idiom of the following six tasks:
-
- .in +5
- .ta .4i 4.4i
- ***************
- *** 34,51 ****
- .nf
- \fBTask Interface\fP
-
- ! \fB1\fP log in to the database ora_login
- ! \fB2\fP open a stream for an SQL statement ora_open
- ! \fB3\fP get the data ora_fetch
- ! \fB4\fP close the stream ora_close
- ! \fB5\fP log off of the database ora_logoff
- .fi
- .in -5
-
- - Steps \fB2\fP and \fB3\fP are kept separate
- - because a single query may produce a large amount of data.
-
- -
- .ce 2
- \fBCursors\fP
- _______
- --- 34,49 ----
- .nf
- \fBTask Interface\fP
-
- ! \fB1\fP log in to the database \fIora_login\fP
- ! \fB2\fP open a stream for an SQL statement \fIora_open\fP
- ! \fB3\fP modify the statement \fIora_bind\fP
- ! \fB4\fP get the data \fIora_fetch\fP
- ! \fB5\fP close the stream \fIora_close\fP
- ! \fB6\fP log off of the database \fIora_logoff\fP
- .fi
- .in -5
-
-
- .ce 2
- \fBCursors\fP
- _______
- ***************
- *** 96,103 ****
-
- Requests a cursor (\fIcsr\fP)
- and calls \fBOCI\ oopen\fP to connect it the the specified \fIlda\fP.
- ! It then calls \fBOCI\ osql3\fP to attach the SQL statement
- ! and \fBOCI\ oexec\fP to instruct \fIOracle\fP to execute it.
-
- If these three steps succeed,
- \fBora_open\fP then makes successive calls to \fBOCI\ odsc\fP
- --- 94,102 ----
-
- Requests a cursor (\fIcsr\fP)
- and calls \fBOCI\ oopen\fP to connect it the the specified \fIlda\fP.
- ! It then calls \fBOCI\ osql3\fP to attach the SQL statement.
- ! If the statement does not contain any substitution variables,
- ! \fIora_open\fP calls \fBOCI\ oexec\fP to instruct \fIOracle\fP to execute it.
-
- If these three steps succeed,
- \fBora_open\fP then makes successive calls to \fBOCI\ odsc\fP
- ***************
- *** 105,110 ****
- --- 104,118 ----
- It allocates memory for these fields within \fIcsr\fP
- and attaches them to the cursor using \fBOCI\ odefin\fP.
- It returns the address of the \fIcsr\fP.
- +
- +
- + \fBora_bind(csr, var, ...)\fP
- +
- + Binds the specified \fIvar\fPs to the substitution variables
- + in the SQL statement identified by \fIcsr\fP
- + and calls \fBOCI\ oexec\fP to execute the resulting statement.
- + Assumes that the substitution variables are \fB:1\fP, \fB:2\fP, \fB:3\fP, etc
- + in the order that they appear in the \fBora_bind\fP call.
-
-
- \fBora_fetch(csr)\fP
- diff -c /user/mis/kstock/tmp/oraperl.ref ./oraperl.ref
- *** /user/mis/kstock/tmp/oraperl.ref Fri Aug 23 08:50:24 1991
- --- ./oraperl.ref Mon Aug 5 11:01:41 1991
- ***************
- *** 17,25 ****
- Returns an \fIlda\fP for use with \fIora_open()\fP.
- .sp
- .ti -2m
- ! \fB$csr = &ora_login($lda, $statement)\fP
- ! Executes the given SQL statement in the database identified by $lda.
- Returns a \fIcsr\fP for use with \fIora_fetch()\fP.
- .sp
- .ti -2m
- \fB$n = &ora_fetch($csr)\fP
- --- 17,31 ----
- Returns an \fIlda\fP for use with \fIora_open()\fP.
- .sp
- .ti -2m
- ! \fB$csr = &ora_open($lda, $statement)\fP
- ! Associates the given SQL statement in the database identified by $lda.
- ! Executes it if it contains no substitution variables.
- Returns a \fIcsr\fP for use with \fIora_fetch()\fP.
- + .sp
- + .ti -2m
- + \fB&ora_bind($csr, $var, ...)\fP
- + Binds the given values to the substition variables in the SQL statement
- + associated with $csr, and executes the resulting statement.
- .sp
- .ti -2m
- \fB$n = &ora_fetch($csr)\fP
-