home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume38 / oraperl-v2 / patch04 next >
Text File  |  1993-07-15  |  64KB  |  2,202 lines

  1. Newsgroups: comp.sources.misc
  2. From: Kevin Stock <kstock@encore.com>
  3. Subject: REPOST: v38i009:  oraperl-v2 - Extensions to Perl to access Oracle database, Patch04
  4. Message-ID: <1993Jul15.164736.15400@sparky.sterling.com>
  5. X-Md4-Signature: 64905c384350d0e22b046507f4b6ed58
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Thu, 15 Jul 1993 16:47:36 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: Kevin Stock <kstock@encore.com>
  12. Posting-number: Volume 38, Issue 9
  13. Archive-name: oraperl-v2/patch04
  14. Environment: Perl, Oracle with OCI, optionally Curses
  15. Patch-To: oraperl-v2: Volume 30, Issue 87-91
  16.  
  17. [ This is being reposted due to a problem with propagation.  -Kent+ ]
  18.  
  19. This is patch 4 to version 2 of Oraperl, a set of usersubs which allow
  20. Perl to access Oracle databases. You need Perl (v3.0.27 or better) and
  21. Oracle (including the Oracle Call Interface) to build Oraperl. If you
  22. can build Larry's Curseperl, then you can also build Coraperl, which is
  23. Oraperl with Curses.
  24.  
  25. Oraperl version 2 appeared in the comp.sources.misc newsgroup as
  26. follows:
  27.  
  28.     v30i087-091    Part 01-05    29th June 1992
  29.     v30i099        Patch 01    6th July 1992
  30.     v32i093        Patch 02    4th October 1992
  31.     v34i021        Patch 03    12th December 1992
  32.  
  33. Oraperl should be available at any comp.sources.misc archive site,
  34. for example wuarchive.wustl.edu [128.252.135.4] (in the USA) or
  35. src.doc.uc.ac.uk (in the UK). On these two sites, look in the
  36. directory /usenet/comp.sources.misc/volume30/oraperl-v2.
  37.  
  38. I didn't intend to release this patch. Work on DBperl (a standard for
  39. database access from Perl) is well underway, and the next release of
  40. Oraperl should have been version 3, which would have been DBperl
  41. compliant.
  42.  
  43. However, I have been laid off as part of a cost cutting exercise here,
  44. and I don't know when I'll be able to get net access again. So, this
  45. patch tidies up a few outstanding issues.
  46.  
  47. As I no longer have access to the net, please do not try to send me
  48. mail. If you really want, you can write to me at the address below, but
  49. please enclose an International Reply Coupon if you want a reply. I
  50. won't have access to a system running Oracle, so I probably won't be
  51. able to give you much help.
  52.  
  53.   Changes
  54.   -------
  55. &ora_open() and &ora_do() now ignore colons which are not followed by a
  56. digit. This avoids problems with PL/SQL which uses := for an assignment
  57. operator, and :NAME for trigger names.
  58.  
  59. $ora_errstr now looks up the error message using oerhms() if possible,
  60. as the manual says it should.
  61.  
  62. If the first parameter to &ora_login() (the database ID) contains a
  63. colon, then it will be assigned to TWO_TASK, instead of ORACLE_SID.
  64. Note that if you also have a value set in ORACLE_SID, Oracle gets to
  65. use whichever it wants.
  66.  
  67. The sample script sql no longer requires a value for $ORACLE_SID, since
  68. the application may be using TWO_TASK. Also, if the sql statement is not
  69. specified on the command line, it will be read in from standard input.
  70.  
  71.  
  72. To apply the patch, unshar this file in your Oraperl source directory.
  73. Then:
  74.  
  75.     patch -p1 <patch04
  76.     make test
  77.  
  78. My thanks to those who suggested some of these modifications, including
  79. Scott Grosch, Viet Hoang and Charles Jardine.
  80.  
  81.  
  82.     Kevin Stock
  83.  
  84.     5 rue de la Liberation
  85.     78660 ABLIS
  86.     France
  87.  
  88. ==========================
  89. #! /bin/sh
  90. # This is a shell archive.  Remove anything before this line, then feed it
  91. # into a shell via "sh file" or similar.  To overwrite existing files,
  92. # type "sh file -c".
  93. # Contents:  FAQ patch4
  94. # Wrapped by kent@sparky on Thu Jun 17 14:11:42 1993
  95. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  96. echo If this archive is complete, you will see the following message:
  97. echo '          "shar: End of archive 1 (of 1)."'
  98. if test -f 'FAQ' -a "${1}" != "-c" ; then 
  99.   echo shar: Will not clobber existing file \"'FAQ'\"
  100. else
  101.   echo shar: Extracting \"'FAQ'\" \(5279 characters\)
  102.   sed "s/^X//" >'FAQ' <<'END_OF_FILE'
  103. X
  104. X        Frequently Asked Questions for Oraperl
  105. X        ______________________________________
  106. X
  107. X
  108. XWhat is Oraperl?
  109. X----------------
  110. XAccording to Buzz Moschetti, "Oraperl sounds like a denture cleaner".
  111. XFor the rest of us, it's a version of Perl which has been extended to
  112. Xmanipulate Oracle databases.
  113. X
  114. X
  115. XIs Oraperl public domain, shareware, or what?
  116. X---------------------------------------------
  117. XOraperl is Freeware; that is, it's author retains copyright (so it isn't
  118. Xpublic domain) but allows free distribution, under the same terms as
  119. XPerl. It isn't shareware, because you don't have to pay to use it.
  120. X
  121. X
  122. XHow can I contact the author?
  123. X-----------------------------
  124. XUnfortunately, I do not have access to the net at present. If you have
  125. Xproblems with Oraperl, your best bet is to send a message to either
  126. Xcomp.lang.perl or comp.databases.oracle, depending on whether the
  127. Xproblem seems to relate to Perl or to Oracle. A number of Oraperl users
  128. Xhang out on both groups, so you may be able to get an answer there.
  129. X
  130. XIf you really need to contact me, you can write to me at the address
  131. Xbelow. I don't have access to a system running Oracle at present, so I
  132. Xwill only be able to give limited. Please include an International Reply
  133. XCoupon if you want a reply.
  134. X
  135. X    Kevin Stock
  136. X    5 rue de la Liberation
  137. X    78660 ABLIS
  138. X    France
  139. X
  140. X
  141. XWill Oraperl run on my system?
  142. X------------------------------
  143. XAt present, Oraperl is known to run on the following systems:
  144. X
  145. X    Amdhal UTS
  146. X    Convex
  147. X    Encore Multimax, Oracle v6.0.27, Perl 3.0.27 - 4.0.36
  148. X    NeXT
  149. X    Prime EXL MBX Sys V.3.1, Oracle 6.0.26
  150. X    Pyramid (ATT Universe),
  151. X    MIPS (SysVr4)
  152. X    Sparcstation
  153. X    Sperry 500/80 Sys V.3.1, Oracle v5.1, Perl 4.0.3
  154. X    Sun 4/280, Oracle 6.0.30
  155. X    SunOS 4.1.1
  156. X    Ultrix, Oracle v5
  157. X
  158. Xbut if you can build Perl, you can almost certainly build Oraperl.
  159. X
  160. XOraperl is distributed as source, so you build it yourself (or get a
  161. Xfriendly system administrator to do it). You need the following on your
  162. Xsystem to build it:
  163. X
  164. X    C compiler
  165. X    Perl source
  166. X    Oracle Call Interface (part of the Pro*C package)
  167. X
  168. X
  169. XWill Oraperl work with {Dbase, Informix, Ingres, Interbase, Sybase, ...}
  170. X------------------------------------------------------------------------
  171. XNo. Versions of Perl do exist for some of these databases; ask in
  172. Xcomp.databases or comp.lang.perl for help. A project is under way to
  173. Xcreate a unified programming interface for all SQL databases, but
  174. Xthere's a lot of work to do before it is available.
  175. X
  176. X
  177. XWhere can I get Oraperl?
  178. X------------------------
  179. XOraperl version 2 appeared in the comp.sources.misc newsgroup as
  180. Xfollows:
  181. X
  182. X    v30i087-091    Part 01-05    29th June 1992
  183. X    v30i099        Patch 01    6th July 1992
  184. X    v32i093        Patch 02    4th October 1992
  185. X    v34i021        Patch 03    12th December 1992
  186. X
  187. XYou should be able to find it at any comp.sources.misc archive site.
  188. XOne such site in the US is wuarchive.wustl.edu [128.252.135.4]. Look in
  189. Xthe directory /usenet/comp.sources.misc/volume30/oraperl-v2.
  190. X
  191. XYou also need the Perl sources. These are also in the comp.sources.misc
  192. Xarchives. Contact Larry Wall <lwall@netlabs.com> if you need help
  193. Xfinding them.
  194. X
  195. X
  196. XI tried building Oraperl, but cc says "Redeclaration of sprintf in perl.h"
  197. XOraperl compiled OK, but the tests dump core
  198. XOraperl compiled and seems to run OK, but I don't get any output
  199. XOraperl compiled OK, but {something weird} happens
  200. X--------------------------------------------------------------------------
  201. XYou are probably running a dual universe ATT/BSD system and you
  202. Xconfigured Perl under BSD. Oracle programs have to be built under the
  203. XATT universe, so you will have to create an ATT version of uperl.o to
  204. Xlink to Oraperl.  Copy the Perl sources to a different directory and
  205. Xbuild uperl.o there.
  206. X
  207. X
  208. XI tried building Oraperl, but cc says "Undefined: _my_setenv"
  209. X-------------------------------------------------------------
  210. XYou are running an old version of Perl, which doesn't have my_setenv().
  211. XIf possible, you should upgrade to the latest version. If you can't do
  212. Xso, you could try adding one of the following to the start of orafns.c:
  213. X
  214. XIf your system uses  setenv(var, value) :
  215. X
  216. X    #define    my_setenv(var, value)    set_env(var, value)
  217. X
  218. XIf your system uses  putenv(envstring) :
  219. X
  220. X    void my_setenv(var, value)
  221. X    char *var, *value;
  222. X    {
  223. X        static char *envstr = NULL;
  224. X
  225. X        if (envstr == NULL)
  226. X        {
  227. X            if ((envstr = (char *) malloc(1024)) == NULL)
  228. X            {
  229. X                return;
  230. X            }
  231. X            else
  232. X            {
  233. X                sprintf(envstr, "%s=%s", var, value);
  234. X                putenv(envstr);
  235. X            }
  236. X        }
  237. X        else
  238. X        {
  239. X            sprintf(envstr, "%s=%s", var, value);
  240. X        }
  241. X    }
  242. X
  243. X
  244. XWhen I try to build Coraperl, I get messages about undefined functions
  245. X----------------------------------------------------------------------
  246. XYou are probably trying to link Oraperl with the BSD curses routines.
  247. XIf you are on a dual universe system, you should use the ATT routines.
  248. X
  249. XIf you are on a BSD-only system, then you need to modify the file
  250. Xbsdcurses.mus in $(SRC)/usub. You should  #ifdef  out the references to
  251. Xtestcallback .
  252. X
  253. X
  254. XWhenever I try to fetch a DATE or ROWID field, I get a truncation error
  255. X-----------------------------------------------------------------------
  256. XThis is due to a bug in early versions of Oraperl. You should upgrade to
  257. Xthe latest version.
  258. X
  259. XIf you cannot upgrade, you may be able to work round the problem with
  260. XDATE fields by calling the SQL function TO_CHAR() in your SELECT
  261. Xstatement.
  262. END_OF_FILE
  263.   if test 5279 -ne `wc -c <'FAQ'`; then
  264.     echo shar: \"'FAQ'\" unpacked with wrong size!
  265.   fi
  266.   # end of 'FAQ'
  267. fi
  268. if test -f 'patch4' -a "${1}" != "-c" ; then 
  269.   echo shar: Will not clobber existing file \"'patch4'\"
  270. else
  271.   echo shar: Extracting \"'patch4'\" \(51655 characters\)
  272.   sed "s/^X//" >'patch4' <<'END_OF_FILE'
  273. Xdiff -cr oraperl-v2/patchlevel.h oraperl-v2.4/patchlevel.h
  274. X*** oraperl-v2/patchlevel.h    Wed Jun  9 12:33:40 1993
  275. X--- oraperl-v2.4/patchlevel.h    Tue May 25 16:48:33 1993
  276. X***************
  277. X*** 1,4 ****
  278. X  /* patchlevel.h */
  279. X  
  280. X  #define    VERSION        2
  281. X! #define    PATCHLEVEL    3
  282. X--- 1,4 ----
  283. X  /* patchlevel.h */
  284. X  
  285. X  #define    VERSION        2
  286. X! #define    PATCHLEVEL    4
  287. Xdiff -cr oraperl-v2/Changes oraperl-v2.4/Changes
  288. X*** oraperl-v2/Changes    Wed Jun  9 12:33:40 1993
  289. X--- oraperl-v2.4/Changes    Wed Jun  9 12:09:14 1993
  290. X***************
  291. X*** 4,9 ****
  292. X--- 4,17 ----
  293. X  Version 2
  294. X  =========
  295. X  
  296. X+ Patch 04
  297. X+ ========
  298. X+ Now uses oerhms() to get the error text if possible
  299. X+ count_colons() ignores colons which are not followed by a digit (for PL/SQL)
  300. X+ Fixed a few typos in the documentation
  301. X+ &ora_login() uses TWO_TASK instead of ORACLE_SID if the sid contains a colon
  302. X+ sql now reads a script from stdin if it isn't on the command line
  303. X+ 
  304. X  Patch 03
  305. X  ========
  306. X  Modify &ora_bind() and &ora_do() to return the row count
  307. Xdiff -cr oraperl-v2/Debugging oraperl-v2.4/Debugging
  308. X*** oraperl-v2/Debugging    Wed Jun  9 12:31:54 1993
  309. X--- oraperl-v2.4/Debugging    Wed Jun  9 14:23:41 1993
  310. X***************
  311. X*** 47,53 ****
  312. X  output lines.
  313. X  
  314. X  If your uperl.o was built with -DDEBUGGING, you can define PERL_DEBUGGING
  315. X! at compilation and the oraperl debugging will be initialiased from the -D
  316. X  flag. If not, you can still define DEBUGGING, but you will have to set
  317. X  ora_debug from within your program.
  318. X  
  319. X--- 47,53 ----
  320. X  output lines.
  321. X  
  322. X  If your uperl.o was built with -DDEBUGGING, you can define PERL_DEBUGGING
  323. X! at compilation and the oraperl debugging will be initialised from the -D
  324. X  flag. If not, you can still define DEBUGGING, but you will have to set
  325. X  ora_debug from within your program.
  326. X  
  327. X***************
  328. X*** 56,62 ****
  329. X  DBUG package recommends -# (and so the routines will remove a leading -#
  330. X  from the control string if there is one). For example, I use this line:
  331. X  
  332. X!     $ora_debug = shift if $ARGV[0] =~ /-#/;
  333. X  
  334. X  If you want to trace something else, you can add your own DBUG_PRINT
  335. X  statements to the code wherever you want. I would recommend that you use
  336. X--- 56,62 ----
  337. X  DBUG package recommends -# (and so the routines will remove a leading -#
  338. X  from the control string if there is one). For example, I use this line:
  339. X  
  340. X!     $ora_debug = shift if $ARGV[0] =~ /^-#/;
  341. X  
  342. X  If you want to trace something else, you can add your own DBUG_PRINT
  343. X  statements to the code wherever you want. I would recommend that you use
  344. Xdiff -cr oraperl-v2/Readme oraperl-v2.4/Readme
  345. X*** oraperl-v2/Readme    Wed Jun  9 12:33:41 1993
  346. X--- oraperl-v2.4/Readme    Wed Jun  9 14:33:21 1993
  347. X***************
  348. X*** 49,55 ****
  349. X  
  350. X  I've only tested this on an Encore Multimax 520 running UMAX V (Sys Vr3.2),
  351. X  using whichever version of Perl was current at the time that I completed
  352. X! each release (covers the range 3.0.34 to 4.0.35, excluding 4.0.33) with
  353. X  Oracle version 6, as I don't have access to any other system with Pro*C.
  354. X  However, other people have compiled and used it on a range of different
  355. X  systems including Amdahl, Convex, Cray, NeXT, Pyramid, Sun and Ultrix,
  356. X--- 49,55 ----
  357. X  
  358. X  I've only tested this on an Encore Multimax 520 running UMAX V (Sys Vr3.2),
  359. X  using whichever version of Perl was current at the time that I completed
  360. X! each release (covers the range 3.0.34 to 4.0.36, excluding 4.0.33) with
  361. X  Oracle version 6, as I don't have access to any other system with Pro*C.
  362. X  However, other people have compiled and used it on a range of different
  363. X  systems including Amdahl, Convex, Cray, NeXT, Pyramid, Sun and Ultrix,
  364. X***************
  365. X*** 85,90 ****
  366. X--- 85,91 ----
  367. X      ckdebug.pl    tests to see if debugging is available
  368. X      commit.pl    using commit and rollback
  369. X      ex.pl        simple example of Oraperl functions
  370. X+     japh        just another perl hacker, in Oraperl
  371. X      mkdb.pl        more extensive example, using curses if available
  372. X              you can run this with either Oraperl or Coraperl
  373. X      oradump.pl    dump an Oracle table into a set of insert statements
  374. X***************
  375. X*** 100,105 ****
  376. X--- 101,107 ----
  377. X      Readme         test information
  378. X      Standard-Results correct results for a test run
  379. X      commit.pl     test script
  380. X+     japh.pl         test script
  381. X      mkdb.pl         test script
  382. X  
  383. X  Miscellaneous:
  384. X***************
  385. X*** 124,129 ****
  386. X  Corporation or any of their subsidiaries. There is no warranty, and no
  387. X  official support is available.
  388. X  
  389. X! It is Copyright 1991, 1992 Kevin Stock, but may be freely distributed
  390. X  under the same terms as Perl itself, that is, under the terms of either
  391. X  the GNU Public License or the Artistic License.
  392. X--- 126,131 ----
  393. X  Corporation or any of their subsidiaries. There is no warranty, and no
  394. X  official support is available.
  395. X  
  396. X! It is Copyright 1991, 1992, 1993 Kevin Stock, but may be freely distributed
  397. X  under the same terms as Perl itself, that is, under the terms of either
  398. X  the GNU Public License or the Artistic License.
  399. Xdiff -cr oraperl-v2/colons.c oraperl-v2.4/colons.c
  400. X*** oraperl-v2/colons.c    Wed Jun  9 12:32:08 1993
  401. X--- oraperl-v2.4/colons.c    Wed Jun  9 12:39:28 1993
  402. X***************
  403. X*** 2,8 ****
  404. X   *
  405. X   * Returns the number of substitution variables in an SQL query.
  406. X   */
  407. X! /* Copyright 1991, 1992 Kevin Stock.
  408. X   *
  409. X   * You may copy this under the terms of the GNU General Public License,
  410. X   * or the Artistic License, copies of which should have accompanied your
  411. X--- 2,8 ----
  412. X   *
  413. X   * Returns the number of substitution variables in an SQL query.
  414. X   */
  415. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  416. X   *
  417. X   * You may copy this under the terms of the GNU General Public License,
  418. X   * or the Artistic License, copies of which should have accompanied your
  419. X***************
  420. X*** 10,15 ****
  421. X--- 10,16 ----
  422. X   */
  423. X  
  424. X  #include <stdio.h>
  425. X+ #include <ctype.h>
  426. X  #include "EXTERN.h"
  427. X  #include "orafns.h"
  428. X  
  429. X***************
  430. X*** 29,46 ****
  431. X              /* numbers must be used in sequence,
  432. X               * but they may be repeated if a parameter is reused
  433. X               */
  434. X!             if (((c = atoi(++s)) <= 0) || (c > n+1))
  435. X              {
  436. X!                 /* number too low or out of sequence */
  437. X!                 DBUG_PRINT("exit",
  438. X!                 ("count_colons: got %d, expected %d", c, n+1));
  439. X!                 DBUG_RETURN(-1);
  440. X              }
  441. X!             else if (c == n + 1)
  442. X              {
  443. X!                 ++n;
  444. X              }
  445. X-             /* else repeating a previous parameter */
  446. X          }
  447. X          else if (*s == '\'')
  448. X          {
  449. X--- 30,56 ----
  450. X              /* numbers must be used in sequence,
  451. X               * but they may be repeated if a parameter is reused
  452. X               */
  453. X! 
  454. X!             if (isdigit(*++s))
  455. X              {
  456. X!                 if (((c = atoi(s)) <= 0) || (c > n+1))
  457. X!                 {
  458. X!                     /* number too low or out of sequence */
  459. X!                     DBUG_PRINT("exit",
  460. X!                         ("count_colons: got %d, expected %d",
  461. X!                     c, n+1));
  462. X!                     DBUG_RETURN(-1);
  463. X!                 }
  464. X!                 else if (c == n + 1)
  465. X!                 {
  466. X!                     ++n;
  467. X!                 }
  468. X!                 /* else repeating a previous parameter */
  469. X              }
  470. X!             else
  471. X              {
  472. X!                 DBUG_PRINT("info", ("ignoring :%c", *s));
  473. X              }
  474. X          }
  475. X          else if (*s == '\'')
  476. X          {
  477. Xdiff -cr oraperl-v2/doc/oraperl.1 oraperl-v2.4/doc/oraperl.1
  478. X*** oraperl-v2/doc/oraperl.1    Wed Jun  9 12:33:42 1993
  479. X--- oraperl-v2.4/doc/oraperl.1    Wed Jun  9 11:23:56 1993
  480. X***************
  481. X*** 79,85 ****
  482. X  correlating or transferring data between databases.
  483. X  
  484. X  Most \fIOracle\fP programs (for example, \fISQL*Plus\fP or \fISQL*Forms\fP)
  485. X! examine the environment variable \fBORACLE_SID\fP
  486. X  to determine which database to connect to.
  487. X  In an environment which uses several different databases,
  488. X  it is easy to make a mistake, and attempt to run a program on the wrong one.
  489. X--- 79,85 ----
  490. X  correlating or transferring data between databases.
  491. X  
  492. X  Most \fIOracle\fP programs (for example, \fISQL*Plus\fP or \fISQL*Forms\fP)
  493. X! examine the environment variable \fBORACLE_SID\fP or \fBTWO_TASK\fP
  494. X  to determine which database to connect to.
  495. X  In an environment which uses several different databases,
  496. X  it is easy to make a mistake, and attempt to run a program on the wrong one.
  497. X***************
  498. X*** 86,94 ****
  499. X  Also, it is cumbersome to create a program
  500. X  which works with more than one database simultaneously.
  501. X  Therefore, \fIOraperl\fP requires the system ID to be passed as a parameter.
  502. X- However, if the system ID parameter is an empty string
  503. X- then \fIOraperl\fP will use the existing value of \fBORACLE_SID\fP.
  504. X  
  505. X  .ne 4
  506. X  Example:
  507. X  
  508. X--- 86,100 ----
  509. X  Also, it is cumbersome to create a program
  510. X  which works with more than one database simultaneously.
  511. X  Therefore, \fIOraperl\fP requires the system ID to be passed as a parameter.
  512. X  
  513. X+ If the system ID parameter contains a colon,
  514. X+ it is assumed to be a \fBTWO_TASK\fP value.
  515. X+ Otherwise, if it is not blank,
  516. X+ it is assumed to be an \fBORACLE_SID\fP value.
  517. X+ If it is blank,
  518. X+ the current values of \fBORACLE_SID\fP and \fBTWO_TASK\fP
  519. X+ will be left unchanged.
  520. X+ 
  521. X  .ne 4
  522. X  Example:
  523. X  
  524. X***************
  525. X*** 167,173 ****
  526. X  .ti +.5i
  527. X  .if t .ft CW
  528. X  &ora_bind($csr, 70, 'marketing', undef);
  529. X! .if t .fi P
  530. X  
  531. X  \fI&ora_bind()\fP returns an undefined value if an error occurred.
  532. X  Otherwise, it returns the number of rows affected by the command
  533. X--- 173,179 ----
  534. X  .ti +.5i
  535. X  .if t .ft CW
  536. X  &ora_bind($csr, 70, 'marketing', undef);
  537. X! .if t .ft P
  538. X  
  539. X  \fI&ora_bind()\fP returns an undefined value if an error occurred.
  540. X  Otherwise, it returns the number of rows affected by the command
  541. X***************
  542. X*** 343,349 ****
  543. X  by calling the \fI&ora_types()\fP function.
  544. X  This function takes a single parameter,
  545. X  a statement identifier (obtained from \fI&ora_open()\fP)
  546. X! indicating the query for which the lengths are required.
  547. X  The types are returned as an array of integers, one for each field.
  548. X  
  549. X  These types are defined in your OCI documentation.
  550. X--- 349,355 ----
  551. X  by calling the \fI&ora_types()\fP function.
  552. X  This function takes a single parameter,
  553. X  a statement identifier (obtained from \fI&ora_open()\fP)
  554. X! indicating the query for which the types are required.
  555. X  The types are returned as an array of integers, one for each field.
  556. X  
  557. X  These types are defined in your OCI documentation.
  558. X***************
  559. X*** 513,519 ****
  560. X  The \fI$ora_errstr\fP variable contains the \fIOracle\fP error message
  561. X  corresponding to the current value of \fI$ora_errno\fP.
  562. X  
  563. X! This is equivalent to the \fIOCI oerrmsg\fP function.
  564. X  .\"
  565. X  .SH "$ora_verno"
  566. X  .\"
  567. X--- 519,525 ----
  568. X  The \fI$ora_errstr\fP variable contains the \fIOracle\fP error message
  569. X  corresponding to the current value of \fI$ora_errno\fP.
  570. X  
  571. X! This is equivalent to the \fIOCI oerhms\fI and \fIoermsg\fP functions.
  572. X  .\"
  573. X  .SH "$ora_verno"
  574. X  .\"
  575. X***************
  576. X*** 568,576 ****
  577. X  Note that the substitution variables must be assigned consecutively
  578. X  beginning from \fB1\fP for each SQL statement,
  579. X  as \fI&ora_bind()\fP assigns its parameters in this order.
  580. X! Named substitution variables
  581. X! (for example, \fB:NAME\fP, \fB:TELNO\fP)
  582. X! are not permitted.
  583. X  .\"
  584. X  .SH DEBUGGING
  585. X  .\"
  586. X--- 574,585 ----
  587. X  Note that the substitution variables must be assigned consecutively
  588. X  beginning from \fB1\fP for each SQL statement,
  589. X  as \fI&ora_bind()\fP assigns its parameters in this order.
  590. X! 
  591. X! \fIOraperl\fP does not recognise the named substitution variables
  592. X! (for example, :NAME, :TELNO) which are allowed by the \fIOCI\fP.
  593. X! Any colon which is not followed by a digit will be ignored by \fIOraperl\fP
  594. X! and passed on to the \fIOracle\fP engine.
  595. X! This allows PL/SQL assignments and triggers to be used.
  596. X  .\"
  597. X  .SH DEBUGGING
  598. X  .\"
  599. Xdiff -cr oraperl-v2/examples/sql oraperl-v2.4/examples/sql
  600. X*** oraperl-v2/examples/sql    Wed Jun  9 12:33:43 1993
  601. X--- oraperl-v2.4/examples/sql    Wed Jun  9 14:42:17 1993
  602. X***************
  603. X*** 18,56 ****
  604. X  #    -l page_len      lines per page, only used by -f (default 60)
  605. X  #    -n string      replace NULL fields by string
  606. X  #    name/pass    * Oracle username and password
  607. X! #    stmt        * Oracle statement to be executed
  608. X  #
  609. X  # Author:    Kevin Stock
  610. X  # Date:        18th November 1991
  611. X! # Last change:    18th November 1992
  612. X  #
  613. X  
  614. X  $ora_debug = shift if $ARGV[0] =~ /^-#/;
  615. X  
  616. X  $USAGE = <<;
  617. X!     [-bbase] [-ccache] [-ddelim] [-f|-h] [-lpage_len] [-nstring] name/pass stmt
  618. X  
  619. X- $, = "\t";            # default delimiter is a tab
  620. X- $\ = "\n";            # each record terminated with newline
  621. X- 
  622. X  require 'getopts.pl';        # option parsing
  623. X  do Getopts('b:c:d:fhl:n:');
  624. X  die "$0: only one of -f and -h may be specified\n" if ($opt_f && $opt_h);
  625. X  
  626. X! $USER = shift;            # get the user name and password
  627. X! die "Usage: $0 $USAGE\n" unless $#ARGV >= 0;        # must have a statement
  628. X  
  629. X! $ENV{'ORACLE_SID'} = $opt_b if defined($opt_b);        # set database
  630. X  $ora_cache = $opt_c if defined($opt_c);            # set fetch cache
  631. X  $, = $opt_d if defined($opt_d);                # set column delimiter
  632. X  $= = $opt_l if defined($opt_l);                # set page length
  633. X  
  634. X- die "ORACLE_SID not set\n" unless defined($ENV{'ORACLE_SID'});
  635. X- 
  636. X  # log into the database and execute the statement
  637. X  
  638. X! $lda = &ora_login('', $USER, '') || die "$ora_errstr\n";
  639. X! $csr = &ora_open($lda, "@ARGV") || die "$ora_errstr\n";
  640. X  
  641. X  # print out any information which comes back
  642. X  
  643. X--- 18,64 ----
  644. X  #    -l page_len      lines per page, only used by -f (default 60)
  645. X  #    -n string      replace NULL fields by string
  646. X  #    name/pass    * Oracle username and password
  647. X! #    stmt          Oracle statement to be executed
  648. X! #              read from stdin if not given on command line
  649. X  #
  650. X  # Author:    Kevin Stock
  651. X  # Date:        18th November 1991
  652. X! # Last change:    9th June 1993
  653. X  #
  654. X  
  655. X  $ora_debug = shift if $ARGV[0] =~ /^-#/;
  656. X  
  657. X  $USAGE = <<;
  658. X! [-bbase] [-ccache] [-ddelim] [-f|-h] [-lpage_len] [-nstring] name/pass [stmt]
  659. X  
  660. X  require 'getopts.pl';        # option parsing
  661. X  do Getopts('b:c:d:fhl:n:');
  662. X  die "$0: only one of -f and -h may be specified\n" if ($opt_f && $opt_h);
  663. X  
  664. X! $USER = shift || die "user/password not specified\n";
  665. X! 
  666. X! if ($#ARGV >= 0)
  667. X! {
  668. X!     @stmt = @ARGV;
  669. X! }
  670. X! else
  671. X! {
  672. X!     print "Enter the statement to execute (^D to end):\n";
  673. X!     @stmt = <STDIN>;
  674. X! }
  675. X! 
  676. X! $, = "\t";            # default delimiter is a tab
  677. X! $\ = "\n";            # each record terminated with newline
  678. X  
  679. X! $db = $opt_b if defined($opt_b);            # set database
  680. X  $ora_cache = $opt_c if defined($opt_c);            # set fetch cache
  681. X  $, = $opt_d if defined($opt_d);                # set column delimiter
  682. X  $= = $opt_l if defined($opt_l);                # set page length
  683. X  
  684. X  # log into the database and execute the statement
  685. X  
  686. X! $lda = &ora_login($db, $USER, '') || die "$ora_errstr\n";
  687. X! $csr = &ora_open($lda, "@stmt") || die "$ora_errstr\n";
  688. X  
  689. X  # print out any information which comes back
  690. X  
  691. X***************
  692. X*** 129,135 ****
  693. X  .nr nl 0-1        \" fake up transition to first page again
  694. X  .nr % 0            \" start at page 1
  695. X  ';<<'.ex'; ############## From here on it's a standard manual page ############
  696. X- .ll 80
  697. X  .TH SQL L "18th November 1992"
  698. X  .ad
  699. X  .nh
  700. X--- 137,142 ----
  701. X***************
  702. X*** 155,161 ****
  703. X  
  704. X  The \fB\-b\fP\fIbase\fP flag may be supplied to specify the database to be used.
  705. X  If it is not given, the database specified by the environment variable
  706. X! \fBORACLE_SID\fP is used.
  707. X  
  708. X  The \fB\-c\fP\fIcache\fP flag may be supplied to set the size of fetch cache
  709. X  to be used. If it is not given, the system default is used.
  710. X--- 162,168 ----
  711. X  
  712. X  The \fB\-b\fP\fIbase\fP flag may be supplied to specify the database to be used.
  713. X  If it is not given, the database specified by the environment variable
  714. X! \fBORACLE_SID\fP or \fBTWO_TASK\fP is used.
  715. X  
  716. X  The \fB\-c\fP\fIcache\fP flag may be supplied to set the size of fetch cache
  717. X  to be used. If it is not given, the system default is used.
  718. X***************
  719. X*** 182,188 ****
  720. X  this may be changed to any desired string (\fIdelim\fP)
  721. X  using the \fB\-d\fP flag.
  722. X  .SH ENVIRONMENT
  723. X! The environment variable \fBORACLE_SID\fP
  724. X  determines the Oracle database to be used
  725. X  if the \fB\-b\fP\fIbase\fP flag is not supplied.
  726. X  .SH DIAGNOSTICS
  727. X--- 189,195 ----
  728. X  this may be changed to any desired string (\fIdelim\fP)
  729. X  using the \fB\-d\fP flag.
  730. X  .SH ENVIRONMENT
  731. X! The environment variable \fBORACLE_SID\fP or \fBTWO_TASK\fP
  732. X  determines the Oracle database to be used
  733. X  if the \fB\-b\fP\fIbase\fP flag is not supplied.
  734. X  .SH DIAGNOSTICS
  735. X***************
  736. X*** 192,204 ****
  737. X  .br
  738. X  the \fB\-f\fP and \fB\-h\fP options are mutually exclusive,
  739. X  but both were specified
  740. X- 
  741. X- .ti -5
  742. X- \fBORACLE_SID not set\fP
  743. X- .br
  744. X- the \fB\-b\fP\fIbase\fP option was not supplied,
  745. X- and the \fBORACLE_SID\fP environment variable was not set,
  746. X- so \fIsql\fP cannot work out which database to open
  747. X  
  748. X  .in -5
  749. X  The only other diagnostics generated by \fIsql\fP are usage messages,
  750. X--- 199,204 ----
  751. Xdiff -cr oraperl-v2/getcursor.c oraperl-v2.4/getcursor.c
  752. X*** oraperl-v2/getcursor.c    Wed Jun  9 12:31:51 1993
  753. X--- oraperl-v2.4/getcursor.c    Wed Jun  9 10:51:55 1993
  754. X***************
  755. X*** 2,8 ****
  756. X   *
  757. X   * Functions to deal with allocating and freeing cursors for Oracle
  758. X   */
  759. X! /* Copyright 1991, 1992 Kevin Stock.
  760. X   *
  761. X   * You may copy this under the terms of the GNU General Public License,
  762. X   * or the Artistic License, copies of which should have accompanied your
  763. X--- 2,8 ----
  764. X   *
  765. X   * Functions to deal with allocating and freeing cursors for Oracle
  766. X   */
  767. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  768. X   *
  769. X   * You may copy this under the terms of the GNU General Public License,
  770. X   * or the Artistic License, copies of which should have accompanied your
  771. X***************
  772. X*** 17,23 ****
  773. X  
  774. X  /* head of the cursor list */
  775. X  struct cursor csr_list =
  776. X!     { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL };
  777. X  
  778. X  
  779. X  /* ora_free_data(csr)
  780. X--- 17,23 ----
  781. X  
  782. X  /* head of the cursor list */
  783. X  struct cursor csr_list =
  784. X!     { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL };
  785. X  
  786. X  
  787. X  /* ora_free_data(csr)
  788. X***************
  789. X*** 108,114 ****
  790. X      {
  791. X          DBUG_PRINT("malloc", ("insufficient memory for a cursor"));
  792. X          DBUG_PRINT("exit", ("returning NULL"));
  793. X!         ora_errno = ORAP_NOMEM;
  794. X          DBUG_RETURN(NULL);
  795. X      }
  796. X      DBUG_PRINT("malloc", ("got a cursor at %#lx", (long) tmp));
  797. X--- 108,115 ----
  798. X      {
  799. X          DBUG_PRINT("malloc", ("insufficient memory for a cursor"));
  800. X          DBUG_PRINT("exit", ("returning NULL"));
  801. X!         ora_err.no = ORAP_NOMEM;
  802. X!         ora_err.lda = NULL;
  803. X          DBUG_RETURN(NULL);
  804. X      }
  805. X      DBUG_PRINT("malloc", ("got a cursor at %#lx", (long) tmp));
  806. X***************
  807. X*** 118,124 ****
  808. X          free(tmp);
  809. X          DBUG_PRINT("malloc", ("insufficient memory for a csrdef"));
  810. X          DBUG_PRINT("exit", ("returning NULL"));
  811. X!         ora_errno = ORAP_NOMEM;
  812. X          DBUG_RETURN(NULL);
  813. X      }
  814. X      DBUG_PRINT("malloc", ("got a csr at %#lx", (long) tmp->csr));
  815. X--- 119,126 ----
  816. X          free(tmp);
  817. X          DBUG_PRINT("malloc", ("insufficient memory for a csrdef"));
  818. X          DBUG_PRINT("exit", ("returning NULL"));
  819. X!         ora_err.no = ORAP_NOMEM;
  820. X!         ora_err.lda = NULL;
  821. X          DBUG_RETURN(NULL);
  822. X      }
  823. X      DBUG_PRINT("malloc", ("got a csr at %#lx", (long) tmp->csr));
  824. X***************
  825. X*** 134,144 ****
  826. X      tmp->next_entry = 0;
  827. X      tmp->nfields = 0;
  828. X      tmp->varfields = 0;
  829. X  
  830. X      tmp->next = csr_list.next;
  831. X      csr_list.next = tmp;
  832. X  
  833. X!     ora_errno = 0;
  834. X      DBUG_PRINT("exit", ("returning %#lx", (long) tmp));
  835. X      DBUG_RETURN(tmp);
  836. X  }
  837. X--- 136,148 ----
  838. X      tmp->next_entry = 0;
  839. X      tmp->nfields = 0;
  840. X      tmp->varfields = 0;
  841. X+     tmp->parent = NULL;
  842. X  
  843. X      tmp->next = csr_list.next;
  844. X      csr_list.next = tmp;
  845. X  
  846. X!     ora_err.no = 0;
  847. X!     ora_err.lda = NULL;
  848. X      DBUG_PRINT("exit", ("returning %#lx", (long) tmp));
  849. X      DBUG_RETURN(tmp);
  850. X  }
  851. X***************
  852. X*** 167,173 ****
  853. X      {
  854. X          DBUG_PRINT("malloc", ("insufficient memory for an hda"));
  855. X          ora_dropcursor(tmp);
  856. X!         ora_errno = ORAP_NOMEM;
  857. X          DBUG_PRINT("exit", ("returning NULL"));
  858. X          DBUG_RETURN(NULL);
  859. X      }
  860. X--- 171,178 ----
  861. X      {
  862. X          DBUG_PRINT("malloc", ("insufficient memory for an hda"));
  863. X          ora_dropcursor(tmp);
  864. X!         ora_err.no = ORAP_NOMEM;
  865. X!         ora_err.lda = NULL;
  866. X          DBUG_PRINT("exit", ("returning NULL"));
  867. X          DBUG_RETURN(NULL);
  868. X      }
  869. X***************
  870. X*** 199,205 ****
  871. X  
  872. X      if (tmp->next == NULL)
  873. X      {
  874. X!         ora_errno = ORAP_INVCSR;
  875. X          DBUG_PRINT("exit", ("not a cursor"));
  876. X          DBUG_RETURN(0);
  877. X      }
  878. X--- 204,211 ----
  879. X  
  880. X      if (tmp->next == NULL)
  881. X      {
  882. X!         ora_err.no = ORAP_INVCSR;
  883. X!         ora_err.lda = NULL;
  884. X          DBUG_PRINT("exit", ("not a cursor"));
  885. X          DBUG_RETURN(0);
  886. X      }
  887. Xdiff -cr oraperl-v2/oracle.mus oraperl-v2.4/oracle.mus
  888. X*** oraperl-v2/oracle.mus    Wed Jun  9 12:33:44 1993
  889. X--- oraperl-v2.4/oracle.mus    Wed Jun  9 11:28:42 1993
  890. X***************
  891. X*** 5,11 ****
  892. X   * NOTE: Do not modify oracle.c as it is created automagically from oracle.mus.
  893. X   *     Modify oracle.mus instead, or your changes will be lost.
  894. X   */
  895. X! /* Copyright 1991, 1992 Kevin Stock.
  896. X   *
  897. X   * You may copy this under the terms of the GNU General Public License,
  898. X   * or the Artistic License, copies of which should have accompanied your
  899. X--- 5,11 ----
  900. X   * NOTE: Do not modify oracle.c as it is created automagically from oracle.mus.
  901. X   *     Modify oracle.mus instead, or your changes will be lost.
  902. X   */
  903. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  904. X   *
  905. X   * You may copy this under the terms of the GNU General Public License,
  906. X   * or the Artistic License, copies of which should have accompanied your
  907. X***************
  908. X*** 231,237 ****
  909. X  
  910. X          if (vars == NULL)
  911. X          {
  912. X!         ora_errno = ORAP_NOMEM;
  913. X          retval = 0;
  914. X          }
  915. X          else
  916. X--- 231,237 ----
  917. X  
  918. X          if (vars == NULL)
  919. X          {
  920. X!         ora_err.no = ORAP_NOMEM;
  921. X          retval = 0;
  922. X          }
  923. X          else
  924. X***************
  925. X*** 493,499 ****
  926. X      break;
  927. X  
  928. X      case UV_ora_errno:
  929. X!     str_numset(str, (double) ora_errno);
  930. X      break;
  931. X  
  932. X      case UV_ora_verno:
  933. X--- 493,499 ----
  934. X      break;
  935. X  
  936. X      case UV_ora_errno:
  937. X!     str_numset(str, (double) ora_err.no);
  938. X      break;
  939. X  
  940. X      case UV_ora_verno:
  941. X***************
  942. X*** 500,513 ****
  943. X      str_numset(str, (double) (VERSION + (double) PATCHLEVEL / 1000));
  944. X      break;
  945. X  
  946. X!     case UV_ora_errstr:
  947. X      {
  948. X          int len;
  949. X!         char ertxt[132];
  950. X  
  951. X!         if (ora_errno < ORAP_ERRMIN)
  952. X          {
  953. X!             oermsg(ora_errno, ertxt);
  954. X              if (ertxt[len = (strlen(ertxt) - 1)] == '\n')
  955. X              {
  956. X                  ertxt[len] = '\0';
  957. X--- 500,528 ----
  958. X      str_numset(str, (double) (VERSION + (double) PATCHLEVEL / 1000));
  959. X      break;
  960. X  
  961. X!    case UV_ora_errstr:
  962. X      {
  963. X          int len;
  964. X!         char ertxt[256];
  965. X  
  966. X!         if (ora_err.no < ORAP_ERRMIN)
  967. X          {
  968. X!             DBUG_PRINT("info",
  969. X!                 ("ora_err.no = %d, ora_err.lda = 0x%x",
  970. X!                  ora_err.no, ora_err.lda));
  971. X! 
  972. X!             if (ora_err.lda == NULL)
  973. X!             {
  974. X!                 /* lda isn't set */
  975. X!                 DBUG_PRINT("info", ("Using oermsg"));
  976. X!                 oermsg(ora_err.no, ertxt);
  977. X!             }
  978. X!             else
  979. X!             {
  980. X!                 DBUG_PRINT("info", ("Using oerhms"));
  981. X!                 oerhms(ora_err.lda->csr, ora_err.no, ertxt,256);
  982. X!             }
  983. X! 
  984. X              if (ertxt[len = (strlen(ertxt) - 1)] == '\n')
  985. X              {
  986. X                  ertxt[len] = '\0';
  987. X***************
  988. X*** 514,527 ****
  989. X              }
  990. X              str_set(str, ertxt);
  991. X          }
  992. X!         else if((ora_errno == ORAP_ERRMIN) || (ora_errno > ORAP_ERRMAX))
  993. X          {
  994. X!             sprintf(ertxt, "unknown error %d", ora_errno);
  995. X              str_set(str, ertxt);
  996. X          }
  997. X          else
  998. X          {
  999. X!             str_set(str, ora_errlist[ora_errno - ORAP_ERRMIN]);
  1000. X          }
  1001. X      }
  1002. X      break;
  1003. X--- 529,543 ----
  1004. X              }
  1005. X              str_set(str, ertxt);
  1006. X          }
  1007. X!         else if ((ora_err.no == ORAP_ERRMIN) ||
  1008. X!              (ora_err.no > ORAP_ERRMAX))
  1009. X          {
  1010. X!             sprintf(ertxt, "unknown error %d", ora_err.no);
  1011. X              str_set(str, ertxt);
  1012. X          }
  1013. X          else
  1014. X          {
  1015. X!             str_set(str, ora_errlist[ora_err.no - ORAP_ERRMIN]);
  1016. X          }
  1017. X      }
  1018. X      break;
  1019. Xdiff -cr oraperl-v2/orafns.c oraperl-v2.4/orafns.c
  1020. X*** oraperl-v2/orafns.c    Wed Jun  9 12:33:44 1993
  1021. X--- oraperl-v2.4/orafns.c    Wed Jun  9 11:58:54 1993
  1022. X***************
  1023. X*** 2,8 ****
  1024. X   *
  1025. X   * Simple C interface to Oracle, intended to be linked to Perl.
  1026. X   */
  1027. X! /* Copyright 1991, 1992 Kevin Stock.
  1028. X   *
  1029. X   * You may copy this under the terms of the GNU General Public License,
  1030. X   * or the Artistic License, copies of which should have accompanied your
  1031. X--- 2,8 ----
  1032. X   *
  1033. X   * Simple C interface to Oracle, intended to be linked to Perl.
  1034. X   */
  1035. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  1036. X   *
  1037. X   * You may copy this under the terms of the GNU General Public License,
  1038. X   * or the Artistic License, copies of which should have accompanied your
  1039. X***************
  1040. X*** 60,91 ****
  1041. X  /* oracle_sid is just used so that we don't keep repeating the string */
  1042. X  
  1043. X  static char *oracle_sid        = "ORACLE_SID";
  1044. X  
  1045. X  
  1046. X  /* set_sid() uses my_setenv() to set ORACLE_SID to the required database.
  1047. X   * It preserves the old value of ORACLE_SID so that it can be restored
  1048. X   * (by calling set_sid() with NULL as its parameter.
  1049. X   */
  1050. X  
  1051. X! void set_sid(db)
  1052. X  char *db;
  1053. X  {
  1054. X!     char *h;
  1055. X      static char *oldsid        = NULL;
  1056. X  
  1057. X      DBUG_ENTER("set_sid");
  1058. X      DBUG_PRINT("entry", ("set_sid(%s)", db ? db : "<NULL>"));
  1059. X  
  1060. X!     ora_errno = 0;
  1061. X  
  1062. X      if (db == NULL)
  1063. X      {
  1064. X          if (oldsid != NULL)
  1065. X          {
  1066. X!             DBUG_PRINT("info", ("setting oracle_sid to %s",oldsid));
  1067. X!             my_setenv(oracle_sid, oldsid);
  1068. X          }
  1069. X-         /* no old value to restore if oldsid == NULL */
  1070. X      }
  1071. X      else
  1072. X      {
  1073. X--- 60,104 ----
  1074. X  /* oracle_sid is just used so that we don't keep repeating the string */
  1075. X  
  1076. X  static char *oracle_sid        = "ORACLE_SID";
  1077. X+ static char *two_task        = "TWO_TASK";
  1078. X  
  1079. X  
  1080. X  /* set_sid() uses my_setenv() to set ORACLE_SID to the required database.
  1081. X   * It preserves the old value of ORACLE_SID so that it can be restored
  1082. X   * (by calling set_sid() with NULL as its parameter.
  1083. X+  *
  1084. X+  * If db contains a colon, then TWO_TASK is used instead of ORACLE_SID.
  1085. X   */
  1086. X  
  1087. X! set_sid(db)
  1088. X  char *db;
  1089. X  {
  1090. X!     char *h, *var;
  1091. X      static char *oldsid        = NULL;
  1092. X  
  1093. X      DBUG_ENTER("set_sid");
  1094. X      DBUG_PRINT("entry", ("set_sid(%s)", db ? db : "<NULL>"));
  1095. X  
  1096. X!     ora_err.no = 0;
  1097. X!     ora_err.lda = NULL;
  1098. X  
  1099. X      if (db == NULL)
  1100. X      {
  1101. X          if (oldsid != NULL)
  1102. X          {
  1103. X!             var = (strchr(oldsid, ':') == NULL) ? oracle_sid
  1104. X!                                  : two_task;
  1105. X! 
  1106. X!             DBUG_PRINT("info", ("resetting %s to %s", var, oldsid));
  1107. X!             my_setenv(var, oldsid);
  1108. X!             DBUG_RETURN(1);        /* assume it worked */
  1109. X!         }
  1110. X!         else
  1111. X!         {
  1112. X!             DBUG_PRINT("info", ("no value to reset %s/%s",
  1113. X!                 oracle_sid, two_task));
  1114. X!             DBUG_RETURN(1);
  1115. X          }
  1116. X      }
  1117. X      else
  1118. X      {
  1119. X***************
  1120. X*** 96,102 ****
  1121. X              free(oldsid);
  1122. X          }
  1123. X  
  1124. X!         if ((h = getenv(oracle_sid)) == NULL)
  1125. X          {
  1126. X              /* no previous value to save */
  1127. X              oldsid = NULL;
  1128. X--- 109,117 ----
  1129. X              free(oldsid);
  1130. X          }
  1131. X  
  1132. X!         var = (strchr(db, ':') == NULL) ? oracle_sid : two_task;
  1133. X! 
  1134. X!         if ((h = getenv(var)) == NULL)
  1135. X          {
  1136. X              /* no previous value to save */
  1137. X              oldsid = NULL;
  1138. X***************
  1139. X*** 107,113 ****
  1140. X              {
  1141. X                  DBUG_PRINT("malloc",
  1142. X                      ("insufficient memory for oldsid"));
  1143. X!                 ora_errno = ORAP_NOMEM;
  1144. X              }
  1145. X              else
  1146. X              {
  1147. X--- 122,129 ----
  1148. X              {
  1149. X                  DBUG_PRINT("malloc",
  1150. X                      ("insufficient memory for oldsid"));
  1151. X!                 ora_err.no = ORAP_NOMEM;
  1152. X!                 DBUG_RETURN(0);
  1153. X              }
  1154. X              else
  1155. X              {
  1156. X***************
  1157. X*** 118,128 ****
  1158. X              }
  1159. X          }
  1160. X  
  1161. X!         DBUG_PRINT("info", ("setting oracle_sid to %s", db));
  1162. X!         my_setenv(oracle_sid, db);
  1163. X      }
  1164. X  
  1165. X!     DBUG_VOID_RETURN;
  1166. X  }
  1167. X  
  1168. X  
  1169. X--- 134,150 ----
  1170. X              }
  1171. X          }
  1172. X  
  1173. X!         DBUG_PRINT("info", ("setting %s to %s", var, db));
  1174. X!         my_setenv(var, db);
  1175. X! 
  1176. X!         if (((h = getenv(var)) == NULL) || (strcmp(h, db) != 0))
  1177. X!         {
  1178. X!             DBUG_PRINT("info", ("%s misset to %s", var, h));
  1179. X!             DBUG_RETURN(0);
  1180. X!         }
  1181. X      }
  1182. X  
  1183. X!     DBUG_RETURN(1);
  1184. X  }
  1185. X  
  1186. X  
  1187. X***************
  1188. X*** 150,164 ****
  1189. X  
  1190. X      if (*database != '\0')
  1191. X      {
  1192. X!         set_sid(database);
  1193. X!         if (((tmp = getenv(oracle_sid)) == NULL)    ||
  1194. X!              (strcmp(database, tmp) != 0))
  1195. X          {
  1196. X              (void) ora_dropcursor(lda);
  1197. X!             ora_errno = ORAP_NOSID;
  1198. X!             DBUG_PRINT("exit",
  1199. X!                 ("%s misset to %s, returning NULL",
  1200. X!                 oracle_sid, tmp ? tmp : "<NULL>"));
  1201. X              DBUG_RETURN(NULL);
  1202. X          }
  1203. X      }
  1204. X--- 172,182 ----
  1205. X  
  1206. X      if (*database != '\0')
  1207. X      {
  1208. X!         if (set_sid(database) == 0)
  1209. X          {
  1210. X              (void) ora_dropcursor(lda);
  1211. X!             ora_err.no = ORAP_NOSID;
  1212. X!             DBUG_PRINT("exit", ("couldn't set database ID"));
  1213. X              DBUG_RETURN(NULL);
  1214. X          }
  1215. X      }
  1216. X***************
  1217. X*** 178,192 ****
  1218. X          sprintf(address, "%#lx", (long) lda);
  1219. X          DBUG_PRINT("conv", ("lda %#lx converted to string \"%s\"",
  1220. X              (long) lda, address));
  1221. X!         ora_errno = 0;
  1222. X          DBUG_PRINT("exit", ("returning lda %s", address));
  1223. X          DBUG_RETURN(address);
  1224. X      }
  1225. X      else
  1226. X      {
  1227. X!         ora_errno = lda->csr->csrrc;
  1228. X          (void) ora_droplda(lda);
  1229. X!         DBUG_PRINT("exit", ("orlon failed (error %d)", ora_errno));
  1230. X          DBUG_RETURN((char *) NULL);
  1231. X      }
  1232. X  }
  1233. X--- 196,215 ----
  1234. X          sprintf(address, "%#lx", (long) lda);
  1235. X          DBUG_PRINT("conv", ("lda %#lx converted to string \"%s\"",
  1236. X              (long) lda, address));
  1237. X!         ora_err.no = 0;
  1238. X!         ora_err.lda = NULL;
  1239. X          DBUG_PRINT("exit", ("returning lda %s", address));
  1240. X          DBUG_RETURN(address);
  1241. X      }
  1242. X      else
  1243. X      {
  1244. X!         ora_err.no = lda->csr->csrrc;
  1245. X!         ora_err.lda = NULL;    /* this ought to be lda, not NULL
  1246. X!                      * but as we're about to drop the
  1247. X!                      * lda, that wouldn't make sense
  1248. X!                      */
  1249. X          (void) ora_droplda(lda);
  1250. X!         DBUG_PRINT("exit", ("orlon failed (error %d)", ora_err.no));
  1251. X          DBUG_RETURN((char *) NULL);
  1252. X      }
  1253. X  }
  1254. X***************
  1255. X*** 213,219 ****
  1256. X  
  1257. X      if (check_lda(lda) == 0)
  1258. X      {
  1259. X!         ora_errno = ORAP_INVLDA;
  1260. X          DBUG_PRINT("exit", ("invalid lda, returning NULL"));
  1261. X          DBUG_RETURN((char *) NULL);
  1262. X      }
  1263. X--- 236,242 ----
  1264. X  
  1265. X      if (check_lda(lda) == 0)
  1266. X      {
  1267. X!         ora_err.no = ORAP_INVLDA;
  1268. X          DBUG_PRINT("exit", ("invalid lda, returning NULL"));
  1269. X          DBUG_RETURN((char *) NULL);
  1270. X      }
  1271. X***************
  1272. X*** 223,228 ****
  1273. X--- 246,252 ----
  1274. X          DBUG_PRINT("exit", ("can't get a cursor, returning NULL"));
  1275. X          DBUG_RETURN((char *) NULL);
  1276. X      }
  1277. X+     csr->parent = lda;
  1278. X  
  1279. X      /* Check whether there are any substitution variables in the statement
  1280. X       * If there are, we don't execute the statement yet.
  1281. X***************
  1282. X*** 229,235 ****
  1283. X       */
  1284. X      if ((csr->varfields = count_colons(stmt)) < 0)
  1285. X      {
  1286. X!         ora_errno = ORAP_BADVAR;
  1287. X          DBUG_PRINT("exit", ("invalid variable sequence"));
  1288. X          DBUG_RETURN((char *) NULL);
  1289. X      }
  1290. X--- 253,259 ----
  1291. X       */
  1292. X      if ((csr->varfields = count_colons(stmt)) < 0)
  1293. X      {
  1294. X!         ora_err.no = ORAP_BADVAR;
  1295. X          DBUG_PRINT("exit", ("invalid variable sequence"));
  1296. X          DBUG_RETURN((char *) NULL);
  1297. X      }
  1298. X***************
  1299. X*** 242,252 ****
  1300. X          || (osql3(csr->csr, stmt, -1) != 0)
  1301. X          || ((csr->varfields == 0) && (oexec(csr->csr) != 0)))
  1302. X      {
  1303. X!         ora_errno = csr->csr->csrrc;
  1304. X          oclose(csr->csr);
  1305. X          (void) ora_dropcursor(csr);
  1306. X          DBUG_PRINT("exit",
  1307. X!             ("couldn't run SQL statement (error %d)", ora_errno));
  1308. X          DBUG_RETURN((char *) NULL);
  1309. X      }
  1310. X  
  1311. X--- 266,277 ----
  1312. X          || (osql3(csr->csr, stmt, -1) != 0)
  1313. X          || ((csr->varfields == 0) && (oexec(csr->csr) != 0)))
  1314. X      {
  1315. X!         ora_err.no = csr->csr->csrrc;
  1316. X!         ora_err.lda = lda;
  1317. X          oclose(csr->csr);
  1318. X          (void) ora_dropcursor(csr);
  1319. X          DBUG_PRINT("exit",
  1320. X!             ("couldn't run SQL statement (error %d)", ora_err.no));
  1321. X          DBUG_RETURN((char *) NULL);
  1322. X      }
  1323. X  
  1324. X***************
  1325. X*** 259,265 ****
  1326. X              (short *) 0, (char *) 0, (short *) 0, (short *) 0);
  1327. X      } while (csr->csr->csrrc == 0);
  1328. X      --i;
  1329. X!     ora_errno = 0;
  1330. X  
  1331. X      /* set up csr->data  to receive the information when we do a fetch
  1332. X       *      csr->rcode to receive the column return codes
  1333. X--- 284,291 ----
  1334. X              (short *) 0, (char *) 0, (short *) 0, (short *) 0);
  1335. X      } while (csr->csr->csrrc == 0);
  1336. X      --i;
  1337. X!     ora_err.no = 0;
  1338. X!     ora_err.lda = NULL;
  1339. X  
  1340. X      /* set up csr->data  to receive the information when we do a fetch
  1341. X       *      csr->rcode to receive the column return codes
  1342. X***************
  1343. X*** 282,288 ****
  1344. X              DBUG_PRINT("malloc", ("insufficient memory for data"));
  1345. X              oclose(csr->csr);
  1346. X              (void) ora_dropcursor(csr);
  1347. X!             ora_errno = ORAP_NOMEM;
  1348. X              DBUG_PRINT("exit", ("returning NULL"));
  1349. X              DBUG_RETURN((char *) NULL);
  1350. X          }
  1351. X--- 308,314 ----
  1352. X              DBUG_PRINT("malloc", ("insufficient memory for data"));
  1353. X              oclose(csr->csr);
  1354. X              (void) ora_dropcursor(csr);
  1355. X!             ora_err.no = ORAP_NOMEM;
  1356. X              DBUG_PRINT("exit", ("returning NULL"));
  1357. X              DBUG_RETURN((char *) NULL);
  1358. X          }
  1359. X***************
  1360. X*** 296,302 ****
  1361. X              DBUG_PRINT("malloc", ("insufficient memory for len"));
  1362. X              oclose(csr->csr);
  1363. X              (void) ora_dropcursor(csr);
  1364. X!             ora_errno = ORAP_NOMEM;
  1365. X              DBUG_PRINT("exit", ("returning NULL"));
  1366. X              DBUG_RETURN((char *) NULL);
  1367. X          }
  1368. X--- 322,328 ----
  1369. X              DBUG_PRINT("malloc", ("insufficient memory for len"));
  1370. X              oclose(csr->csr);
  1371. X              (void) ora_dropcursor(csr);
  1372. X!             ora_err.no = ORAP_NOMEM;
  1373. X              DBUG_PRINT("exit", ("returning NULL"));
  1374. X              DBUG_RETURN((char *) NULL);
  1375. X          }
  1376. X***************
  1377. X*** 308,314 ****
  1378. X              DBUG_PRINT("malloc", ("insufficient memory for rcode"));
  1379. X              oclose(csr->csr);
  1380. X              (void) ora_dropcursor(csr);
  1381. X!             ora_errno = ORAP_NOMEM;
  1382. X              DBUG_PRINT("exit", ("returning NULL"));
  1383. X              DBUG_RETURN((char *) NULL);
  1384. X          }
  1385. X--- 334,340 ----
  1386. X              DBUG_PRINT("malloc", ("insufficient memory for rcode"));
  1387. X              oclose(csr->csr);
  1388. X              (void) ora_dropcursor(csr);
  1389. X!             ora_err.no = ORAP_NOMEM;
  1390. X              DBUG_PRINT("exit", ("returning NULL"));
  1391. X              DBUG_RETURN((char *) NULL);
  1392. X          }
  1393. X***************
  1394. X*** 321,327 ****
  1395. X              DBUG_PRINT("malloc", ("insufficient memory for type"));
  1396. X              oclose(csr->csr);
  1397. X              (void) ora_dropcursor(csr);
  1398. X!             ora_errno = ORAP_NOMEM;
  1399. X              DBUG_PRINT("exit", ("returning NULL"));
  1400. X              DBUG_RETURN((char *) NULL);
  1401. X          }
  1402. X--- 347,353 ----
  1403. X              DBUG_PRINT("malloc", ("insufficient memory for type"));
  1404. X              oclose(csr->csr);
  1405. X              (void) ora_dropcursor(csr);
  1406. X!             ora_err.no = ORAP_NOMEM;
  1407. X              DBUG_PRINT("exit", ("returning NULL"));
  1408. X              DBUG_RETURN((char *) NULL);
  1409. X          }
  1410. X***************
  1411. X*** 352,358 ****
  1412. X                      ("insufficient memory for data[%d]", i));
  1413. X                  oclose(csr->csr);
  1414. X                  (void) ora_dropcursor(csr);
  1415. X!                 ora_errno = ORAP_NOMEM;
  1416. X                  DBUG_PRINT("exit", ("returning NULL"));
  1417. X                  DBUG_RETURN((char *) NULL);
  1418. X              }
  1419. X--- 378,384 ----
  1420. X                      ("insufficient memory for data[%d]", i));
  1421. X                  oclose(csr->csr);
  1422. X                  (void) ora_dropcursor(csr);
  1423. X!                 ora_err.no = ORAP_NOMEM;
  1424. X                  DBUG_PRINT("exit", ("returning NULL"));
  1425. X                  DBUG_RETURN((char *) NULL);
  1426. X              }
  1427. X***************
  1428. X*** 366,372 ****
  1429. X                      ("insufficient memory for rcode[%d]", i));
  1430. X                  oclose(csr->csr);
  1431. X                  (void) ora_dropcursor(csr);
  1432. X!                 ora_errno = ORAP_NOMEM;
  1433. X                  DBUG_PRINT("exit", ("returning NULL"));
  1434. X                  DBUG_RETURN((char *) NULL);
  1435. X              }
  1436. X--- 392,398 ----
  1437. X                      ("insufficient memory for rcode[%d]", i));
  1438. X                  oclose(csr->csr);
  1439. X                  (void) ora_dropcursor(csr);
  1440. X!                 ora_err.no = ORAP_NOMEM;
  1441. X                  DBUG_PRINT("exit", ("returning NULL"));
  1442. X                  DBUG_RETURN((char *) NULL);
  1443. X              }
  1444. X***************
  1445. X*** 400,406 ****
  1446. X                      ("insufficient memory for ora_result"));
  1447. X                  oclose(csr->csr);
  1448. X                  (void) ora_dropcursor(csr);
  1449. X!                 ora_errno = ORAP_NOMEM;
  1450. X                  DBUG_PRINT("exit", ("returning NULL"));
  1451. X                  DBUG_RETURN((char *) NULL);
  1452. X              }
  1453. X--- 426,432 ----
  1454. X                      ("insufficient memory for ora_result"));
  1455. X                  oclose(csr->csr);
  1456. X                  (void) ora_dropcursor(csr);
  1457. X!                 ora_err.no = ORAP_NOMEM;
  1458. X                  DBUG_PRINT("exit", ("returning NULL"));
  1459. X                  DBUG_RETURN((char *) NULL);
  1460. X              }
  1461. X***************
  1462. X*** 454,472 ****
  1463. X  
  1464. X      if (check_csr(csr) == 0)
  1465. X      {
  1466. X!         ora_errno = ORAP_INVCSR;
  1467. X          DBUG_PRINT("exit", ("not a csr"));
  1468. X          DBUG_RETURN(0);
  1469. X      }
  1470. X      else if (csr->nfields == 0)
  1471. X      {
  1472. X!         ora_errno = ORAP_NODATA;
  1473. X          DBUG_PRINT("exit", ("nothing to return"));
  1474. X          DBUG_RETURN(0);
  1475. X      }
  1476. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1477. X      {
  1478. X!         ora_errno = ORAP_NOMEM;
  1479. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1480. X          DBUG_RETURN(0);
  1481. X      }
  1482. X--- 480,498 ----
  1483. X  
  1484. X      if (check_csr(csr) == 0)
  1485. X      {
  1486. X!         ora_err.no = ORAP_INVCSR;
  1487. X          DBUG_PRINT("exit", ("not a csr"));
  1488. X          DBUG_RETURN(0);
  1489. X      }
  1490. X      else if (csr->nfields == 0)
  1491. X      {
  1492. X!         ora_err.no = ORAP_NODATA;
  1493. X          DBUG_PRINT("exit", ("nothing to return"));
  1494. X          DBUG_RETURN(0);
  1495. X      }
  1496. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1497. X      {
  1498. X!         ora_err.no = ORAP_NOMEM;
  1499. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1500. X          DBUG_RETURN(0);
  1501. X      }
  1502. X***************
  1503. X*** 515,521 ****
  1504. X              i, (long) ora_result[i], ora_result[i]));
  1505. X      }
  1506. X  
  1507. X!     ora_errno = 0;
  1508. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1509. X      DBUG_RETURN(csr->nfields);
  1510. X  }
  1511. X--- 541,548 ----
  1512. X              i, (long) ora_result[i], ora_result[i]));
  1513. X      }
  1514. X  
  1515. X!     ora_err.no = 0;
  1516. X!     ora_err.lda = NULL;
  1517. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1518. X      DBUG_RETURN(csr->nfields);
  1519. X  }
  1520. X***************
  1521. X*** 541,559 ****
  1522. X  
  1523. X      if (check_csr(csr) == 0)
  1524. X      {
  1525. X!         ora_errno = ORAP_INVCSR;
  1526. X          DBUG_PRINT("exit", ("not a csr"));
  1527. X          DBUG_RETURN(0);
  1528. X      }
  1529. X      else if (csr->nfields == 0)
  1530. X      {
  1531. X!         ora_errno = ORAP_NODATA;
  1532. X          DBUG_PRINT("exit", ("nothing to return"));
  1533. X          DBUG_RETURN(0);
  1534. X      }
  1535. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1536. X      {
  1537. X!         ora_errno = ORAP_NOMEM;
  1538. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1539. X          DBUG_RETURN(0);
  1540. X      }
  1541. X--- 568,586 ----
  1542. X  
  1543. X      if (check_csr(csr) == 0)
  1544. X      {
  1545. X!         ora_err.no = ORAP_INVCSR;
  1546. X          DBUG_PRINT("exit", ("not a csr"));
  1547. X          DBUG_RETURN(0);
  1548. X      }
  1549. X      else if (csr->nfields == 0)
  1550. X      {
  1551. X!         ora_err.no = ORAP_NODATA;
  1552. X          DBUG_PRINT("exit", ("nothing to return"));
  1553. X          DBUG_RETURN(0);
  1554. X      }
  1555. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1556. X      {
  1557. X!         ora_err.no = ORAP_NOMEM;
  1558. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1559. X          DBUG_RETURN(0);
  1560. X      }
  1561. X***************
  1562. X*** 567,573 ****
  1563. X              i, (long) csr->data[i], csr->data[i]));
  1564. X      }
  1565. X  
  1566. X!     ora_errno = 0;
  1567. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1568. X      DBUG_RETURN(csr->nfields);
  1569. X  }
  1570. X--- 594,601 ----
  1571. X              i, (long) csr->data[i], csr->data[i]));
  1572. X      }
  1573. X  
  1574. X!     ora_err.no = 0;
  1575. X!     ora_err.lda = csr->parent;
  1576. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1577. X      DBUG_RETURN(csr->nfields);
  1578. X  }
  1579. X***************
  1580. X*** 594,612 ****
  1581. X  
  1582. X      if (check_csr(csr) == 0)
  1583. X      {
  1584. X!         ora_errno = ORAP_INVCSR;
  1585. X          DBUG_PRINT("exit", ("not a csr"));
  1586. X          DBUG_RETURN(0);
  1587. X      }
  1588. X      else if (csr->nfields == 0)
  1589. X      {
  1590. X!         ora_errno = ORAP_NODATA;
  1591. X          DBUG_PRINT("exit", ("nothing to return"));
  1592. X          DBUG_RETURN(0);
  1593. X      }
  1594. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1595. X      {
  1596. X!         ora_errno = ORAP_NOMEM;
  1597. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1598. X          DBUG_RETURN(0);
  1599. X      }
  1600. X--- 622,640 ----
  1601. X  
  1602. X      if (check_csr(csr) == 0)
  1603. X      {
  1604. X!         ora_err.no = ORAP_INVCSR;
  1605. X          DBUG_PRINT("exit", ("not a csr"));
  1606. X          DBUG_RETURN(0);
  1607. X      }
  1608. X      else if (csr->nfields == 0)
  1609. X      {
  1610. X!         ora_err.no = ORAP_NODATA;
  1611. X          DBUG_PRINT("exit", ("nothing to return"));
  1612. X          DBUG_RETURN(0);
  1613. X      }
  1614. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1615. X      {
  1616. X!         ora_err.no = ORAP_NOMEM;
  1617. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1618. X          DBUG_RETURN(0);
  1619. X      }
  1620. X***************
  1621. X*** 621,627 ****
  1622. X              types[csr->type[i]] ? types[csr->type[i]] : "unknown"));
  1623. X      }
  1624. X  
  1625. X!     ora_errno = 0;
  1626. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1627. X      DBUG_RETURN(csr->nfields);
  1628. X  }
  1629. X--- 649,656 ----
  1630. X              types[csr->type[i]] ? types[csr->type[i]] : "unknown"));
  1631. X      }
  1632. X  
  1633. X!     ora_err.no = 0;
  1634. X!     ora_err.lda = NULL;
  1635. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1636. X      DBUG_RETURN(csr->nfields);
  1637. X  }
  1638. X***************
  1639. X*** 648,666 ****
  1640. X  
  1641. X      if (check_csr(csr) == 0)
  1642. X      {
  1643. X!         ora_errno = ORAP_INVCSR;
  1644. X          DBUG_PRINT("exit", ("not a csr"));
  1645. X          DBUG_RETURN(0);
  1646. X      }
  1647. X      else if (csr->nfields == 0)
  1648. X      {
  1649. X!         ora_errno = ORAP_NODATA;
  1650. X          DBUG_PRINT("exit", ("no data to return"));
  1651. X          DBUG_RETURN(0);
  1652. X      }
  1653. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1654. X      {
  1655. X!         ora_errno = ORAP_NOMEM;
  1656. X          DBUG_PRINT("exit", ("ora_result is not assigned"));
  1657. X          DBUG_RETURN(0);
  1658. X      }
  1659. X--- 677,695 ----
  1660. X  
  1661. X      if (check_csr(csr) == 0)
  1662. X      {
  1663. X!         ora_err.no = ORAP_INVCSR;
  1664. X          DBUG_PRINT("exit", ("not a csr"));
  1665. X          DBUG_RETURN(0);
  1666. X      }
  1667. X      else if (csr->nfields == 0)
  1668. X      {
  1669. X!         ora_err.no = ORAP_NODATA;
  1670. X          DBUG_PRINT("exit", ("no data to return"));
  1671. X          DBUG_RETURN(0);
  1672. X      }
  1673. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1674. X      {
  1675. X!         ora_err.no = ORAP_NOMEM;
  1676. X          DBUG_PRINT("exit", ("ora_result is not assigned"));
  1677. X          DBUG_RETURN(0);
  1678. X      }
  1679. X***************
  1680. X*** 671,677 ****
  1681. X  
  1682. X          if (csr->end_of_data)
  1683. X          {
  1684. X!             ora_errno = 0;
  1685. X              DBUG_PRINT("exit", ("end of data"));
  1686. X              DBUG_RETURN(0);
  1687. X          }
  1688. X--- 700,707 ----
  1689. X  
  1690. X          if (csr->end_of_data)
  1691. X          {
  1692. X!             ora_err.no = 0;
  1693. X!             ora_err.lda = csr->parent;
  1694. X              DBUG_PRINT("exit", ("end of data"));
  1695. X              DBUG_RETURN(0);
  1696. X          }
  1697. X***************
  1698. X*** 691,705 ****
  1699. X          {
  1700. X              if ((i == 1) && (csr->csr->csrrc == 4))
  1701. X              {
  1702. X!                 ora_errno = 0;
  1703. X                  DBUG_PRINT("exit", ("end of data"));
  1704. X                  DBUG_RETURN(0);
  1705. X              }
  1706. X              else
  1707. X              {
  1708. X!                 ora_errno = csr->csr->csrrc;
  1709. X                  DBUG_PRINT("exit",
  1710. X!                     ("ofen error (%d)", ora_errno));
  1711. X                  DBUG_RETURN(0);
  1712. X              }
  1713. X          }
  1714. X--- 721,737 ----
  1715. X          {
  1716. X              if ((i == 1) && (csr->csr->csrrc == 4))
  1717. X              {
  1718. X!                 ora_err.no = 0;
  1719. X!                 ora_err.lda = csr->parent;
  1720. X                  DBUG_PRINT("exit", ("end of data"));
  1721. X                  DBUG_RETURN(0);
  1722. X              }
  1723. X              else
  1724. X              {
  1725. X!                 ora_err.no = csr->csr->csrrc;
  1726. X!                 ora_err.lda = csr->parent;
  1727. X                  DBUG_PRINT("exit",
  1728. X!                     ("ofen error (%d)", ora_err.no));
  1729. X                  DBUG_RETURN(0);
  1730. X              }
  1731. X          }
  1732. X***************
  1733. X*** 722,728 ****
  1734. X              break;
  1735. X  
  1736. X          case 1406:
  1737. X!             ora_errno = 1406;
  1738. X  
  1739. X              if (trunc    &&
  1740. X                  ((csr->type[i] == 8) || (csr->type[i] == 24)))
  1741. X--- 754,761 ----
  1742. X              break;
  1743. X  
  1744. X          case 1406:
  1745. X!             ora_err.no = 1406;
  1746. X!             ora_err.lda = csr->parent;
  1747. X  
  1748. X              if (trunc    &&
  1749. X                  ((csr->type[i] == 8) || (csr->type[i] == 24)))
  1750. X***************
  1751. X*** 744,750 ****
  1752. X          default:    /* others should not happen */
  1753. X              DBUG_PRINT("info", ("ofetch error %d, field %d",
  1754. X                  csr->rcode[i][csr->next_entry], i));
  1755. X!             ora_errno = csr->csr->csrrc;
  1756. X              DBUG_PRINT("exit", ("returning 0"));
  1757. X              DBUG_RETURN(0);
  1758. X          }
  1759. X--- 777,784 ----
  1760. X          default:    /* others should not happen */
  1761. X              DBUG_PRINT("info", ("ofetch error %d, field %d",
  1762. X                  csr->rcode[i][csr->next_entry], i));
  1763. X!             ora_err.no = csr->csr->csrrc;
  1764. X!             ora_err.lda = csr->parent;
  1765. X              DBUG_PRINT("exit", ("returning 0"));
  1766. X              DBUG_RETURN(0);
  1767. X          }
  1768. X***************
  1769. X*** 757,763 ****
  1770. X      ++csr->next_entry;
  1771. X      --csr->in_cache;
  1772. X  
  1773. X!     ora_errno = 0;
  1774. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1775. X      DBUG_RETURN(csr->nfields);
  1776. X  }
  1777. X--- 791,798 ----
  1778. X      ++csr->next_entry;
  1779. X      --csr->in_cache;
  1780. X  
  1781. X!     ora_err.no = 0;
  1782. X!     ora_err.lda = csr->parent;
  1783. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1784. X      DBUG_RETURN(csr->nfields);
  1785. X  }
  1786. X***************
  1787. X*** 786,798 ****
  1788. X  
  1789. X      if (check_csr(csr) == 0)
  1790. X      {
  1791. X!         ora_errno = ORAP_INVCSR;
  1792. X          DBUG_PRINT("exit", ("not a csr"));
  1793. X          DBUG_RETURN(-1L);
  1794. X      }
  1795. X      else if (csr->varfields != nitems)
  1796. X      {
  1797. X!         ora_errno = ORAP_NUMVARS;
  1798. X          DBUG_PRINT("exit", ("expected %d items, got %d",
  1799. X              csr->varfields, nitems));
  1800. X          DBUG_RETURN(-1L);
  1801. X--- 821,833 ----
  1802. X  
  1803. X      if (check_csr(csr) == 0)
  1804. X      {
  1805. X!         ora_err.no = ORAP_INVCSR;
  1806. X          DBUG_PRINT("exit", ("not a csr"));
  1807. X          DBUG_RETURN(-1L);
  1808. X      }
  1809. X      else if (csr->varfields != nitems)
  1810. X      {
  1811. X!         ora_err.no = ORAP_NUMVARS;
  1812. X          DBUG_PRINT("exit", ("expected %d items, got %d",
  1813. X              csr->varfields, nitems));
  1814. X          DBUG_RETURN(-1L);
  1815. X***************
  1816. X*** 805,811 ****
  1817. X          if ((obndrn(csr->csr, i+1, (char *) -1, 0,
  1818. X              5, -1, &null_flag, (char *) -1, 0, 0)) != 0)
  1819. X          {
  1820. X!             ora_errno = csr->csr->csrrc;
  1821. X              DBUG_PRINT("exit", ("obndrn failed on field %d, <NULL>",
  1822. X                  i + 1));
  1823. X              DBUG_RETURN(-1L);
  1824. X--- 840,847 ----
  1825. X          if ((obndrn(csr->csr, i+1, (char *) -1, 0,
  1826. X              5, -1, &null_flag, (char *) -1, 0, 0)) != 0)
  1827. X          {
  1828. X!             ora_err.no = csr->csr->csrrc;
  1829. X!             ora_err.lda = csr->parent;
  1830. X              DBUG_PRINT("exit", ("obndrn failed on field %d, <NULL>",
  1831. X                  i + 1));
  1832. X              DBUG_RETURN(-1L);
  1833. X***************
  1834. X*** 825,831 ****
  1835. X          if ((obndrn(csr->csr, i+1, vars[i], strlen(vars[i])+1,
  1836. X              5, -1, (short *) -1, (char *) -1, 0, 0)) != 0)
  1837. X          {
  1838. X!             ora_errno = csr->csr->csrrc;
  1839. X              DBUG_PRINT("exit", ("obndrn failed on field %d, \"%s\"",
  1840. X                  i + 1, vars[i]));
  1841. X              DBUG_RETURN(-1L);
  1842. X--- 861,868 ----
  1843. X          if ((obndrn(csr->csr, i+1, vars[i], strlen(vars[i])+1,
  1844. X              5, -1, (short *) -1, (char *) -1, 0, 0)) != 0)
  1845. X          {
  1846. X!             ora_err.no = csr->csr->csrrc;
  1847. X!             ora_err.lda = csr->parent;
  1848. X              DBUG_PRINT("exit", ("obndrn failed on field %d, \"%s\"",
  1849. X                  i + 1, vars[i]));
  1850. X              DBUG_RETURN(-1L);
  1851. X***************
  1852. X*** 837,843 ****
  1853. X  
  1854. X      if (oexec(csr->csr) != 0)
  1855. X      {
  1856. X!         ora_errno = csr->csr->csrrc;
  1857. X          DBUG_PRINT("exit", ("oexec failed"));
  1858. X          DBUG_RETURN(-1L);
  1859. X      }
  1860. X--- 874,881 ----
  1861. X  
  1862. X      if (oexec(csr->csr) != 0)
  1863. X      {
  1864. X!         ora_err.no = csr->csr->csrrc;
  1865. X!         ora_err.lda = csr->parent;
  1866. X          DBUG_PRINT("exit", ("oexec failed"));
  1867. X          DBUG_RETURN(-1L);
  1868. X      }
  1869. X***************
  1870. X*** 918,930 ****
  1871. X  
  1872. X      if (check_csr(csr) == 0)
  1873. X      {
  1874. X!         ora_errno = ORAP_INVCSR;
  1875. X          DBUG_PRINT("exit", ("not a csr"));
  1876. X          DBUG_RETURN(NULL);
  1877. X      }
  1878. X      else if (oclose(csr->csr) != 0)
  1879. X      {
  1880. X!         ora_errno = csr->csr->csrrc;
  1881. X          DBUG_PRINT("exit", ("oclose failed"));
  1882. X          DBUG_RETURN(NULL);
  1883. X      }
  1884. X--- 956,969 ----
  1885. X  
  1886. X      if (check_csr(csr) == 0)
  1887. X      {
  1888. X!         ora_err.no = ORAP_INVCSR;
  1889. X          DBUG_PRINT("exit", ("not a csr"));
  1890. X          DBUG_RETURN(NULL);
  1891. X      }
  1892. X      else if (oclose(csr->csr) != 0)
  1893. X      {
  1894. X!         ora_err.no = csr->csr->csrrc;
  1895. X!         ora_err.lda = csr->parent;
  1896. X          DBUG_PRINT("exit", ("oclose failed"));
  1897. X          DBUG_RETURN(NULL);
  1898. X      }
  1899. X***************
  1900. X*** 953,966 ****
  1901. X  
  1902. X      if (check_lda(lda) == 0)
  1903. X      {
  1904. X!         ora_errno = ORAP_INVLDA;
  1905. X          DBUG_PRINT("exit", ("not an lda"));
  1906. X          DBUG_RETURN(NULL);
  1907. X      }
  1908. X      else if (ologof(lda->csr) != 0)
  1909. X      {
  1910. X!         ora_errno = lda->csr->csrrc;
  1911. X!         DBUG_PRINT("exit", ("ologof failed, error code %d", ora_errno));
  1912. X          DBUG_RETURN(NULL);
  1913. X      }
  1914. X      else
  1915. X--- 992,1006 ----
  1916. X  
  1917. X      if (check_lda(lda) == 0)
  1918. X      {
  1919. X!         ora_err.no = ORAP_INVLDA;
  1920. X          DBUG_PRINT("exit", ("not an lda"));
  1921. X          DBUG_RETURN(NULL);
  1922. X      }
  1923. X      else if (ologof(lda->csr) != 0)
  1924. X      {
  1925. X!         ora_err.no = lda->csr->csrrc;
  1926. X!         ora_err.lda = lda;
  1927. X!         DBUG_PRINT("exit", ("ologof failed, error code %d",ora_err.no));
  1928. X          DBUG_RETURN(NULL);
  1929. X      }
  1930. X      else
  1931. X***************
  1932. X*** 988,1001 ****
  1933. X  
  1934. X      if (check_lda(lda) == 0)
  1935. X      {
  1936. X!         ora_errno = ORAP_INVLDA;
  1937. X          DBUG_PRINT("exit", ("not an lda"));
  1938. X          DBUG_RETURN(NULL);
  1939. X      }
  1940. X      else if (ocom(lda->csr) != 0)
  1941. X      {
  1942. X!         ora_errno = lda->csr->csrrc;
  1943. X!         DBUG_PRINT("exit", ("ocom failed, error code %d", ora_errno));
  1944. X          DBUG_RETURN(NULL);
  1945. X      }
  1946. X      else
  1947. X--- 1028,1042 ----
  1948. X  
  1949. X      if (check_lda(lda) == 0)
  1950. X      {
  1951. X!         ora_err.no = ORAP_INVLDA;
  1952. X          DBUG_PRINT("exit", ("not an lda"));
  1953. X          DBUG_RETURN(NULL);
  1954. X      }
  1955. X      else if (ocom(lda->csr) != 0)
  1956. X      {
  1957. X!         ora_err.no = lda->csr->csrrc;
  1958. X!         ora_err.lda = lda;
  1959. X!         DBUG_PRINT("exit", ("ocom failed, error code %d", ora_err.no));
  1960. X          DBUG_RETURN(NULL);
  1961. X      }
  1962. X      else
  1963. X***************
  1964. X*** 1022,1035 ****
  1965. X  
  1966. X      if (check_lda(lda) == 0)
  1967. X      {
  1968. X!         ora_errno = ORAP_INVLDA;
  1969. X          DBUG_PRINT("exit", ("not an lda", stderr));
  1970. X          DBUG_RETURN(NULL);
  1971. X      }
  1972. X      else if (orol(lda->csr) != 0)
  1973. X      {
  1974. X!         ora_errno = lda->csr->csrrc;
  1975. X!         DBUG_PRINT("exit", ("orol failed, error code %d", ora_errno));
  1976. X          DBUG_RETURN(NULL);
  1977. X      }
  1978. X      else
  1979. X--- 1063,1077 ----
  1980. X  
  1981. X      if (check_lda(lda) == 0)
  1982. X      {
  1983. X!         ora_err.no = ORAP_INVLDA;
  1984. X          DBUG_PRINT("exit", ("not an lda", stderr));
  1985. X          DBUG_RETURN(NULL);
  1986. X      }
  1987. X      else if (orol(lda->csr) != 0)
  1988. X      {
  1989. X!         ora_err.no = lda->csr->csrrc;
  1990. X!         ora_err.lda = lda;
  1991. X!         DBUG_PRINT("exit", ("orol failed, error code %d", ora_err.no));
  1992. X          DBUG_RETURN(NULL);
  1993. X      }
  1994. X      else
  1995. X***************
  1996. X*** 1057,1063 ****
  1997. X  
  1998. X      if (check_lda(lda) == 0)
  1999. X      {
  2000. X!         ora_errno = ORAP_INVLDA;
  2001. X          DBUG_PRINT("exit", ("not an lda", stderr));
  2002. X          DBUG_RETURN(NULL);
  2003. X      }
  2004. X--- 1099,1105 ----
  2005. X  
  2006. X      if (check_lda(lda) == 0)
  2007. X      {
  2008. X!         ora_err.no = ORAP_INVLDA;
  2009. X          DBUG_PRINT("exit", ("not an lda", stderr));
  2010. X          DBUG_RETURN(NULL);
  2011. X      }
  2012. X***************
  2013. X*** 1066,1074 ****
  2014. X      {
  2015. X          if (ocon(lda->csr) != 0)
  2016. X          {
  2017. X!             ora_errno = lda->csr->csrrc;
  2018. X              DBUG_PRINT("exit",
  2019. X!                 ("ocon failed, error code %d", ora_errno));
  2020. X              DBUG_RETURN(NULL);
  2021. X          }
  2022. X      }
  2023. X--- 1108,1117 ----
  2024. X      {
  2025. X          if (ocon(lda->csr) != 0)
  2026. X          {
  2027. X!             ora_err.no = lda->csr->csrrc;
  2028. X!             ora_err.lda = lda;
  2029. X              DBUG_PRINT("exit",
  2030. X!                 ("ocon failed, error code %d", ora_err.no));
  2031. X              DBUG_RETURN(NULL);
  2032. X          }
  2033. X      }
  2034. X***************
  2035. X*** 1076,1084 ****
  2036. X      {
  2037. X          if (ocof(lda->csr) != 0)
  2038. X          {
  2039. X!             ora_errno = lda->csr->csrrc;
  2040. X              DBUG_PRINT("exit",
  2041. X!                 ("ocof failed, error code %d", ora_errno));
  2042. X              DBUG_RETURN(NULL);
  2043. X          }
  2044. X      }
  2045. X--- 1119,1128 ----
  2046. X      {
  2047. X          if (ocof(lda->csr) != 0)
  2048. X          {
  2049. X!             ora_err.no = lda->csr->csrrc;
  2050. X!             ora_err.lda = lda;
  2051. X              DBUG_PRINT("exit",
  2052. X!                 ("ocof failed, error code %d", ora_err.no));
  2053. X              DBUG_RETURN(NULL);
  2054. X          }
  2055. X      }
  2056. Xdiff -cr oraperl-v2/orafns.h oraperl-v2.4/orafns.h
  2057. X*** oraperl-v2/orafns.h    Wed Jun  9 12:33:45 1993
  2058. X--- oraperl-v2.4/orafns.h    Wed Jun  9 11:28:54 1993
  2059. X***************
  2060. X*** 2,8 ****
  2061. X   *
  2062. X   * Common declarations for the Oraperl functions
  2063. X   */
  2064. X! /* Copyright 1991, 1992 Kevin Stock.
  2065. X   *
  2066. X   * You may copy this under the terms of the GNU General Public License,
  2067. X   * or the Artistic License, copies of which should have accompanied your
  2068. X--- 2,8 ----
  2069. X   *
  2070. X   * Common declarations for the Oraperl functions
  2071. X   */
  2072. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  2073. X   *
  2074. X   * You may copy this under the terms of the GNU General Public License,
  2075. X   * or the Artistic License, copies of which should have accompanied your
  2076. X***************
  2077. X*** 86,92 ****
  2078. X              next_entry,    /* next valid cache entry         */
  2079. X              nfields,    /* number of fields to retrieve         */
  2080. X              varfields;    /* number of modifiable variables    */
  2081. X!     struct    cursor    *next;        /* list pointer                 */
  2082. X  };
  2083. X  
  2084. X  
  2085. X--- 86,93 ----
  2086. X              next_entry,    /* next valid cache entry         */
  2087. X              nfields,    /* number of fields to retrieve         */
  2088. X              varfields;    /* number of modifiable variables    */
  2089. X!     struct    cursor    *next,        /* list pointer                 */
  2090. X!             *parent;    /* lda related to this csr         */
  2091. X  };
  2092. X  
  2093. X  
  2094. X***************
  2095. X*** 105,112 ****
  2096. X  
  2097. X  /* variables accesible to the outside world */
  2098. X  
  2099. X! EXT    int    ora_errno    INIT(0),    /* latest error code         */
  2100. X!         ora_long    INIT(80),    /* length of LONG fields     */
  2101. X          ora_nfields    INIT(0),    /* size of ora_result array  */
  2102. X          ora_trunc    INIT(0);    /* allow LONG truncation?    */
  2103. X  
  2104. X--- 106,122 ----
  2105. X  
  2106. X  /* variables accesible to the outside world */
  2107. X  
  2108. X! EXT    struct                    /* code & lda of last error  */
  2109. X!     {
  2110. X!         int        no;
  2111. X!         struct    cursor    *lda;
  2112. X!     } ora_err
  2113. X! #ifdef    DOINIT
  2114. X!          = { 0, NULL }
  2115. X! #endif
  2116. X!                 ;        /* ends decl of ora_err         */
  2117. X! 
  2118. X! EXT    int    ora_long    INIT(80),    /* length of LONG fields     */
  2119. X          ora_nfields    INIT(0),    /* size of ora_result array  */
  2120. X          ora_trunc    INIT(0);    /* allow LONG truncation?    */
  2121. X  
  2122. Xdiff -cr oraperl-v2/usersub.c oraperl-v2.4/usersub.c
  2123. X*** oraperl-v2/usersub.c    Wed Jun  9 12:32:05 1993
  2124. X--- oraperl-v2.4/usersub.c    Wed Jun  9 11:29:40 1993
  2125. X***************
  2126. X*** 2,8 ****
  2127. X   * 
  2128. X   * Initialisation for Oraperl.
  2129. X   */
  2130. X! /* Copyright 1991, 1992 Kevin Stock.
  2131. X   *
  2132. X   * You may copy this under the terms of the GNU General Public License,
  2133. X   * or the Artistic License, copies of which should have accompanied your
  2134. X--- 2,8 ----
  2135. X   * 
  2136. X   * Initialisation for Oraperl.
  2137. X   */
  2138. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  2139. X   *
  2140. X   * You may copy this under the terms of the GNU General Public License,
  2141. X   * or the Artistic License, copies of which should have accompanied your
  2142. X***************
  2143. X*** 60,66 ****
  2144. X      warn_on_debug = dowarn;
  2145. X  #endif
  2146. X  
  2147. X!     ora_errno = 0;
  2148. X      DBUG_VOID_RETURN;
  2149. X  }
  2150. X  
  2151. X--- 60,68 ----
  2152. X      warn_on_debug = dowarn;
  2153. X  #endif
  2154. X  
  2155. X!     ora_err.no = 0;
  2156. X!     ora_err.lda = NULL;
  2157. X! 
  2158. X      DBUG_VOID_RETURN;
  2159. X  }
  2160. X  
  2161. X***************
  2162. X*** 117,123 ****
  2163. X  
  2164. X      printf("\nPerl is copyright by Larry Wall; type %s -v for details.\n",
  2165. X          prog);
  2166. X!     printf("Additions for %s: Copyright 1991, 1992, Kevin Stock.\n", prog);
  2167. X  
  2168. X      printf("\n%s may be distributed under the same conditions as Perl.\n\n",
  2169. X          Prog);
  2170. X--- 119,126 ----
  2171. X  
  2172. X      printf("\nPerl is copyright by Larry Wall; type %s -v for details.\n",
  2173. X          prog);
  2174. X!     printf("Additions for %s: Copyright 1991, 1992, 1993, Kevin Stock.\n",
  2175. X!         prog);
  2176. X  
  2177. X      printf("\n%s may be distributed under the same conditions as Perl.\n\n",
  2178. X          Prog);
  2179. END_OF_FILE
  2180.   if test 51655 -ne `wc -c <'patch4'`; then
  2181.     echo shar: \"'patch4'\" unpacked with wrong size!
  2182.   fi
  2183.   # end of 'patch4'
  2184. fi
  2185. echo shar: End of archive 1 \(of 1\).
  2186. cp /dev/null ark1isdone
  2187. MISSING=""
  2188. for I in 1 ; do
  2189.     if test ! -f ark${I}isdone ; then
  2190.     MISSING="${MISSING} ${I}"
  2191.     fi
  2192. done
  2193. if test "${MISSING}" = "" ; then
  2194.     echo You have the archive.
  2195.     rm -f ark[1-9]isdone
  2196. else
  2197.     echo You still must unpack the following archives:
  2198.     echo "        " ${MISSING}
  2199. fi
  2200. exit 0
  2201. exit 0 # Just in case...
  2202.