Annotation of win32/sql/oracle/include/oci/ocidef.h, revision 1.1.1.1
1.1 parser 1: /*
2: * $Header: /var/lib/cvsroot/parser3/parser3/src/sql/oracle/oracle32/include/oci/ocidef.h,v 1.1 2001/08/22 14:02:19 parser Exp $ ocidef.h
3: */
4:
5: /* copyright (c) 1981 by Relational Software Incorporated */
6: /* copyright (c) 1984 by the Oracle Corporation */
7:
8: /*
9: NAME
10: ocidef
11: CONTENTS
12: Oracle Call Interface cursor area and LDA definitions
13: NOTES
14: none
15: OWNER
16: Oates
17: DATE
18: 09/07/82
19: MODIFIED
20: whe 09/01/99 - 976457:check __cplusplus for C++ code
21: skmishra 04/23/97 - Provide C++ compatibility
22: lchidamb 06/26/96 - put upidef.h, riddef.h within #ifndef
23: slari 06/12/96 - add ocigft_getFcnType
24: dchatter 11/10/95 - ocignfd - oci get native file descriptor
25: slari 05/11/95 - change OCIEVDEF and OCIEVTSF to UPIEVDEF and UPIEVTSF
26: dchatter 04/06/95 - add ifdef flags around OCI_flags
27: lchidamb 04/06/95 - drop maxdsz from ocibndps/ocidfnps
28: slari 04/07/95 - rename opinit to ocipin
29: slari 03/13/95 - thread safety changes
30: dchatter 03/08/95 - piece definitions OCI_*_PIECE
31: lchidamb 12/06/94 - add support for binding/defining with skips
32: dchatter 03/06/95 - merge changes from branch 1.12.720.1
33: dchatter 02/06/95 - add defines for login mode parameters
34: dchatter 07/06/94 - Deleting CRSCHK, with refcursor, no way to set this
35: dchatter 06/13/94 - add a new LDA flag LDANBL
36: rkooi 11/18/92 - update ocidpr interface
37: mmoore 10/31/92 - add ocidpr
38: gpongrac 11/17/92 - fix oexfet prototype
39: sjain 01/03/92 - Add ocibra
40: rjenkins 11/04/91 - adding prototypes for oparse and oexfet
41: sjain 04/15/91 - Change ocistf proto
42: sjain 04/01/91 - Rearrange oty codes. Add new ones
43: Jain 12/03/90 - Add #define for new describe call
44: Jain 11/29/90 - Add new function code for the new oci calls
45: Mendels 01/20/89 - fix 19170: make ocitbl CONST_DATA
46: Kabcene 01/27/88 - change interfaces to match V5
47: Navab 12/09/87 - add a parameter to ocierr call
48: Navab 11/30/87 - add ocierr, rename ocioer
49: Navab 10/08/87 - add prototypes for procedure declarations
50: Howard 09/07/87 - endif blah
51: Howard 05/11/87 - Add OTY types
52: Howard 04/27/87 - move ocldef defines here
53: Oates 10/15/85 - Add OCANCEL
54: Oates 09/30/85 - Implement ORA*Net
55: Oates 06/27/85 - Make datatype compatible with upidef.h
56: Andy 05/07/85 - delete CSRFBPIC
57: */
58:
59: #ifndef UPIDEF
60: #include <upidef.h>
61: #endif
62:
63: #ifndef RIDDEF
64: #include <riddef.h>
65: #endif
66:
67: #ifndef OCIDEF
68: #define OCIDEF
69:
70:
71: #define CSRCHECK 172 /* csrdef is a cursor */
72: #define LDACHECK 202 /* csrdef is a login data area */
73: struct csrdef
74: {
75: b2 csrrc; /* return code: v2 codes, v4 codes negative */
76: ub2 csrft; /* function type */
77: ub4 csrrpc; /* rows processed count */
78: ub2 csrpeo; /* parse error offset */
79: ub1 csrfc; /* function code */
80: ub1 csrlfl; /* lda flag to indicate type of login */
81: ub2 csrarc; /* actual untranslated return code */
82: ub1 csrwrn; /* warning flags */
83: ub1 csrflg; /* error action */
84: word csrcn; /* cursor number */
85: riddef csrrid; /* rowid structure */
86: word csrose; /* os dependent error code */
87: ub1 csrchk; /* check byte = CSRCHECK - in cursor */
88: /* check byte = LDACHECK - in LDA */
89: struct hstdef *csrhst; /* pointer to the hst */
90: };
91: typedef struct csrdef csrdef;
92: typedef struct csrdef ldadef; /* lda is the same as a csr */
93:
94:
95: /* values for csrlfl */
96: #define LDAFLG 1 /* ...via ologon */
97: #define LDAFLO 2 /* ...via olon or orlon */
98: #define LDANBL 3 /* ...nb logon in progress */
99:
100: /* valuses for crsfc */
101: #define csrfpa 2 /* ...OSQL */
102: #define csrfex 4 /* ...OEXEC */
103: #define csrfbi 6 /* ...OBIND */
104: #define csrfdb 8 /* ...ODFINN */
105: #define csrfdi 10 /* ...ODSRBN */
106: #define csrffe 12 /* ...OFETCH */
107: #define csrfop 14 /* ...OOPEN */
108: #define csrfcl 16 /* ...OCLOSE */
109: #define csrfds 22 /* ...ODSC */
110: #define csrfnm 24 /* ...ONAME */
111: #define csrfp3 26 /* ...OSQL3 */
112: #define csrfbr 28 /* ...OBNDRV */
113: #define csrfbx 30 /* ...OBNDRN */
114: /*#defe csrfdf 32*/ /* ???? */
115: #define csrfso 34 /* ...OOPT */
116: #define csrfre 36 /* ...ORESUM */
117: #define csrfbn 50 /* ...OBINDN */
118: #define csrfca 52 /* ..OCANCEL */
119: #define csrfsd 54 /* ..OSQLD */
120: #define csrfef 56 /* ..OEXFEN */
121: #define csrfln 58 /* ..OFLNG */
122: #define csrfdp 60 /* ..ODSCSP */
123: #define csrfba 62 /* ..OBNDRA */
124: #define csrfbps 63 /*..OBINDPS */
125: #define csrfdps 64 /*..ODEFINPS */
126: #define csrfgpi 65 /* ...OGETPI */
127: #define csrfspi 66 /* ...OSETPI */
128:
129: /* values for csrwrn */
130: #define CSRWANY 0x01 /* there is a warning flag set */
131: #define CSRWTRUN 0x02 /* a data item was truncated */
132: #define CSRWNVIC 0x04 /* NULL values were used in an aggregate function */
133: #define CSRWITCE 0x08 /* column count not equal to into list count */
134: #define CSRWUDNW 0x10 /* update or delete without where clause */
135: #define CSRWRSV0 0x20
136: #define CSRWROLL 0x40 /* rollback required */
137: #define CSRWRCHG 0x80 /* change after query start on select for update */
138:
139: /* values fro csrflg */
140: #define CSRFSPND 0x01 /* current operation suspended */
141: #define CSRFATAL 0x02 /* fatal operation: transaction rolled back */
142: #define CSRFBROW 0x04 /* current row backed out */
143: #define CSRFREFC 0x08 /* ref cursor type CRSCHK disabled for this cursor */
144: #define CSRFNOAR 0x10 /* ref cursor type binds, so no array bind/execute */
145:
146: /* define function codes; in order of octdef.h */
147: #define OTYCTB 1 /* CREATE TABLE */
148: #define OTYSER 2 /* set role */
149: #define OTYINS 3 /* INSERT */
150: #define OTYSEL 4 /* SELECT */
151: #define OTYUPD 5 /* UPDATE */
152: #define OTYDRO 6 /* drop role */
153: #define OTYDVW 7 /* DROP VIEW */
154: /* once was validate index */
155: /* once was create partition */
156: /* once was alter partition */
157: #define OTYDTB 8 /* DROP TABLE */
158: /* once was alter space */
159: /* once was drop space */
160: #define OTYDEL 9 /* DELETE */
161: #define OTYCVW 10 /* create view */
162: #define OTYDUS 11 /* drop user */
163: #define OTYCRO 12 /* create role */
164: #define OTYCSQ 13 /* create sequence */
165: #define OTYASQ 14 /* alter sequence */
166: #define OTYDSQ 16 /* drop sequence */
167: #define OTYCSC 17 /* create schema */
168: #define OTYCCL 18 /* CREATE CLUSTER */
169: /* once was alter cluster */
170: #define OTYCUS 19 /* create user */
171: #define OTYCIX 20 /* CREATE INDEX */
172: #define OTYDIX 21 /* DROP INDEX */
173: #define OTYDCL 22 /* DROP CLUSTER */
174: #define OTYVIX 23 /* validate index */
175: #define OTYCPR 24 /* create procedure */
176: #define OTYAPR 25 /* alter procedure */
177: #define OTYATB 26 /* alter table */
178: /* once was evaluate */
179: #define OTYXPL 27 /* explain */
180: #define OTYGRA 28 /* grant */
181: #define OTYREV 29 /* revoke */
182: #define OTYCSY 30 /* create synonym */
183: #define OTYDSY 31 /* drop synonym */
184: #define OTYASY 32 /* alter system switch log */
185: #define OTYSET 33 /* set transaction */
186: #define OTYPLS 34 /* pl/sql execute */
187: #define OTYLTB 35 /* lock */
188: #define OTYNOP 36 /* noop */
189: #define OTYRNM 37 /* rename */
190: #define OTYCMT 38 /* comment */
191: #define OTYAUD 39 /* audit */
192: #define OTYNOA 40 /* no audit */
193: #define OTYAIX 41 /* ALTER INDEX */
194: #define OTYCED 42 /* create external database */
195: #define OTYDED 43 /* drop external database */
196: #define OTYCDB 44 /* create database */
197: #define OTYADB 45 /* alter database */
198: #define OTYCRS 46 /* create rollback segment */
199: #define OTYARS 47 /* alter rollback segment */
200: #define OTYDRS 48 /* drop rollback segment */
201: #define OTYCTS 49 /* create tablespace */
202: #define OTYATS 50 /* alter tablespace */
203: #define OTYDTS 51 /* drop tablespace */
204: #define OTYASE 52 /* alter session */
205: #define OTYAUR 53 /* alter user */
206: #define OTYCWK 54 /* commit (work) */
207: #define OTYROL 55 /* rollback */
208: #define OTYSPT 56 /* savepoint */
209:
210: /* For number greater than 56 the the type is the same as defined in
211: ** octdef.h for that number. So for completion look at octdef.h
212: */
213:
214: #define OTYDEV OTYCVW /* old DEFINE VIEW = create view */
215:
216: /* Retired OTY types; try to reserve their values for a while */
217: #ifdef NEVER /* unused */
218: # define OTYCLN 2 /* CREATE LINK */
219: # define OTYDLN 6 /* DROP LINK */
220: # define OTYEXP 11 /* EXPAND */
221: /* 12 through 17 are also unused */
222: # define OTYACL 19 /* ALTER CLUSTER */
223: # define OTYCSP 23 /* CREATE SPACE */
224: # define OTYASP 24 /* alter space */
225: # define OTYDSP 25 /* drop space */
226: # define OTYEVA 27 /* evaluate */
227: # define OTYVIN 32 /* validate index */
228: # define OTYCPA 33 /* create partition */
229: # define OTYAPA 34 /* alter partition */
230: #endif /*NEVER *//* end of unused */
231:
232: /* FUNCTION CODES */
233: #define OCLFPA 2 /* parse - OSQL */
234: #define OCLFEX 4 /* execute - OEXEC */
235: #define OCLFBI 6 /* BIND by name - OBIND */
236: #define OCLFDB 8 /* define buffer - ODEFIN */
237: #define OCLFDI 10 /* describe item - ODSC */
238: #define OCLFFE 12 /* fetch - OFETCH */
239: #define OCLFOC 14 /* open cursor - OOPEN */
240: # define OCLFLI OCLFOC /* old name for open cursor - OOPEN */
241: #define OCLFCC 16 /* close cursor - OCLOSE */
242: # define OCLFLO OCLFCC /* old name for close cursor - OCLOSE */
243: #define OCLFDS 22 /* describe - ODSC */
244: #define OCLFON 24 /* get table and column names - ONAME */
245: #define OCLFP3 26 /* parse - OSQL3 */
246: #define OCLFBR 28 /* bind reference by name - OBNDRV */
247: #define OCLFBX 30 /* bind referecne numeric - OBNDRN */
248: #define OCLFSO 34 /* special function - OOPT */
249: #define OCLFRE 36 /* resume - ORESUM */
250: #define OCLFBN 50 /* bindn */
251: #define OCLFMX 52 /* maximum function number */
252:
253: #ifdef NEVER /* unused codes */
254: # define OCLFLK 18 /* open for kernel operations */
255: # define OCLFEK 20 /* execute kernel operations */
256: # define OCLFOK 22 /* kernel close */
257: # define OCLFIN 28 /* logon to oracle */
258: # define OCLFOF 30 /* logoff from oracle */
259: # define OCLFAX 32 /* allocate a context area */
260: # define OCLFPI 34 /* page in context area */
261: # define OCLFIS 36 /* special system logon */
262: # define OCLFCO 38 /* cancel the current operation */
263: # define OCLFGI 40 /* get database id */
264: # define OCLFJN 42 /* journal operation */
265: # define OCLFCL 44 /* cleanup prior execute operation */
266: # define OCLFMC 46 /* map a cursor area */
267: # define OCLFUC 48 /* unmap cursor and restore user maping */
268: #endif /*NEVER *//* obsolete codes */
269:
270:
271: /* values for ocimode in ocipin call */
272:
273: #define OCIEVDEF UPIEVDEF /* default : non-thread safe enivronment */
274: #define OCIEVTSF UPIEVTSF /* thread-safe environment */
275:
276:
277: /* OCIL* flags used to determine the mode of login, using ocilog().
278: ** Currently defined only for non-blocking and thread-safe logins.
279: */
280:
281: #define OCILMDEF UPILMDEF /* default, regular login */
282: #define OCILMNBL UPILMNBL /* non-blocking logon */
283: #define OCILMESY UPILMESY /* thread safe but external sync */
284: #define OCILMISY UPILMISY /* internal sync, we do it */
285: #define OCILMTRY UPILMTRY /* try to, but do not block on mutex */
286:
287:
288: /*
289: * since sqllib uses both ocidef and ocidfn the following defines
290: * need to be guarded
291: */
292: #ifndef OCI_FLAGS
293: #define OCI_FLAGS
294:
295: /* OCI_*_PIECE defines the piece types that are returned or set
296: */
297:
298: #define OCI_ONE_PIECE UPI_ONE_PIECE /* there or this is the only piece */
299: #define OCI_FIRST_PIECE UPI_FIRST_PIECE /* the first of many pieces */
300: #define OCI_NEXT_PIECE UPI_NEXT_PIECE /* the next of many pieces */
301: #define OCI_LAST_PIECE UPI_LAST_PIECE /* the last piece of this column */
302: #endif
303:
304: /*
305: ** OCITAB: define return code pairs for version 2 to 3 conversions
306: */
307: struct ocitab
308: {
309: b2 ocitv3; /* Version 3/4 return code */
310: b2 ocitv2; /* Version 2 equivalent return code */
311: };
312: typedef struct ocitab ocitab;
313:
314: externref CONST_DATA ocitab ocitbl[];
315:
316: /* macros to check cursors and LDA's. */
317: /* macros to set error codes */
318:
319: # define CRSCHK(c) if ((c->csrchk != CSRCHECK)\
320: && !bit(c->csrflg, CSRFREFC))\
321: return(ocir32(c, OER(1001)))
322: # define ldaerr(l, e) ( l->csrrc = (b2)(-( l->csrarc = (ub2)(e)) ) )
323: # define LDACHK(l) if (l->csrchk != LDACHECK) \
324: return(ldaerr(l, OER(1001)))
325:
326:
327: /************************************************/
328: /* OCI PROCEDURE DECLARATIONS */
329: /************************************************/
330:
331:
332:
333:
334: /*****************************/
335: /* Database logon/logout */
336: /*****************************/
337: sword ocilog( /*_ ldadef *lda, struct hstdef *hst, text *uid, sword uidl,
338: text *psw, sword pswl, text* conn, sword connl,
339: ub4 mode _*/);
340: sword ocilon( /*_ ldadef *lda, text *uid, word uidl, text *psw, word pswl,
341: word audit _*/);
342: sword ocilgi( /*_ ldadef *lda, b2 areacount _*/ );
343: sword ocirlo( /*_ ldadef *lda, struct hstdef *hst, text *uid, word uidl,
344: text *psw, word pswl, word audit _*/ );
345: /* ocilon - logon to oracle
346: ** ocilgi - version 2 compatible ORACLE logon call.
347: ** no login to ORACLE is performed: the LDA is initialized
348: ** ocirlo - version 5 compatible ORACLE Remote Login call,
349: ** oracle login is executed.
350: ** lda - pointer to ldadef
351: ** uid - user id [USER[/PASSWORD]]
352: ** uidl - length of uid, if -1 strlen(uid) is used
353: ** psw - password string; ignored if specified in uid
354: ** pswl - length of psw, if -1 strlen(psw) is used
355: ** audit - is not supported; the only permissible value is 0
356: ** areacount - unused
357: */
358:
359: sword ocilof( /*_ ldadef *lda _*/ );
360: /*
361: ** ocilof - disconnect from ORACLE
362: ** lda - pointer to ldadef
363: */
364:
365:
366: /*********************/
367: /* Error Messages */
368: /*********************/
369: sword ocierr( /*_ ldadef *lda, b2 rcode, text *buffer, word bufl _*/ );
370: sword ocidhe( /*_ b2 rcode, text *buffer _*/ );
371: /*
372: ** Move the text explanation for an ORACLE error to a user defined buffer
373: ** ocierr - will return the message associated with the hstdef stored
374: ** in the lda.
375: ** ocidhe - will return the message associated with the default host.
376: ** lda - lda associated with the login session
377: ** rcode - error code as returned by V3 call interface
378: ** buffer - address of a user buffer of at least 132 characters
379: */
380:
381:
382: /***********************/
383: /* Cursor Open/Close */
384: /***********************/
385: sword ociope( /*_ struct csrdef *cursor, ldadef *lda, text *dbn, word dbnl,
386: word areasize, text *uid, word uidl _*/ );
387:
388: sword ociclo( /*_ struct csrdef *cursor _*/ );
389: /*
390: ** open or close a cursor.
391: ** cursor - pointer to csrdef
392: ** ldadef - pointer to ldadef
393: ** dbn - unused
394: ** dbnl - unused
395: ** areasize - if (areasize == -1) areasize <- system default initial size
396: ** else if (areasize IN [1..256]) areasize <- areasize * 1024;
397: ** most applications should use the default size since context
398: ** areas are extended as needed until memory is exhausted.
399: ** uid - user id
400: ** uidl - userid length
401: */
402:
403: /***********************************/
404: /* CONTROL AND OPTIONS */
405: /***********************************/
406: sword ocibre( /*_ ldadef *lda _*/ );
407: /*
408: ** ocibrk - Oracle Call Interface send BReaK Sends a break to
409: ** oracle. If oracle is active, the current operation is
410: ** cancelled. May be called asynchronously. DOES NOT SET
411: ** OERRCD in the hst. This is because ocibrk may be called
412: ** asynchronously. Callers must test the return code.
413: ** lda - pointer to a ldadef
414: */
415:
416: sword ocican( /*_ struct csrdef *cursor _*/ );
417: /*
418: ** cancel the operation on the cursor, no additional OFETCH calls
419: ** will be issued for the existing cursor without an intervening
420: ** OEXEC call.
421: ** cursor - pointer to csrdef
422: */
423:
424: sword ocisfe( /*_ struct csrdef *cursor, word erropt, word waitopt _*/ );
425: /*
426: ** ocisfe - user interface set error options
427: ** set the error and cursor options.
428: ** allows user to set the options for dealing with fatal dml errors
429: ** and other cursor related options
430: ** see oerdef for valid settings
431: ** cursor - pointer to csrdef
432: ** erropt - error optionsn
433: ** waitopr - wait options
434: */
435:
436:
437: /***************************************/
438: /* COMMIT/ROLLBACK/AUTOCOMMIT */
439: /***************************************/
440: sword ocicom( /*_ ldadef *lda _*/ );
441: sword ocirol( /*_ ldadef *lda _*/ );
442: /*
443: ** ocicom - commit the current transaction
444: ** ocirol - roll back the current transaction
445: */
446:
447: sword ocicon( /*_ ldadef *lda _*/ );
448: sword ocicof( /*_ ldadef *lda _*/ );
449: /*
450: ** ocicon - auto Commit ON
451: ** ocicof - auto Commit OFf
452: */
453:
454:
455:
456: /************************/
457: /* parsing */
458: /************************/
459: sword ocisq3( /*_ struct csrdef *cursor, text *sqlstm, word sqllen _*/ );
460: /*
461: ** ocisq3 - user interface parse sql statement
462: ** cursor - pointer to csrdef
463: ** sqlstm - pointer to SQL statement
464: ** sqllen - length of SQL statement. if -1, strlen(sqlstm) is used
465: */
466:
467:
468:
469: /***************************/
470: /* BINDING */
471: /***************************/
472: /* these are for the opcode in ocibndps, ocidfnps */
473: #define OCI_PCWS 0
474: #define OCI_SKIP 1
475:
476: sword ocibin( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
477: word progvl, word ftype, word scale, text *fmt, word fmtl,
478: word fmtt _*/ );
479: sword ocibrv( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
480: word progvl, word ftype, word scale, b2 *indp, text *fmt,
481: word fmtl, word fmtt _*/ );
482: sword ocibra( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
483: word progvl, word ftype, word scale, b2 *indp, ub2 *aln,
484: ub2 *rcp, ub4 mal, ub4 *cal, text *fmt,
485: word fmtl, word fmtt _*/ );
486: sword ocibndps( /*_ struct csrdef *cursor, ub1 opcode, text *sqlvar, sb4 sqlvl,
487: ub1 *progv, sb4 progvl, word ftype, word scale, b2 *indp,
488: ub2 *aln, ub2 *rcp,
489: sb4 pv_skip, sb4 ind_skip, sb4 len_skip, sb4 rc_skip,
490: ub4 mal, ub4 *cal, text *fmt, sb4 fmtl, word fmtt _*/ );
491: sword ocibnn ( /*_ struct csrdef *cursor, ub2 sqlvn, ub1 *progv, word progvl,
492: word ftype, word scale, text *fmt, word fmtl, word fmtt _*/ );
493: sword ocibrn( /*_ struct csrdef *cursor, word sqlvn, ub1 *progv, word progvl,
494: word ftype, word scale, b2 *indp, text *fmt, word fmtl,
495: word fmtt _*/ );
496: /*
497: ** ocibin - bind by value by name
498: ** ocibrv - bind by reference by name
499: ** ocibra - bind by reference by name (array)
500: ** ocibndps - bind by reference by name (array) piecewise or with skips
501: ** ocibnn - bind by value numeric
502: ** ocibrn - bind by reference numeric
503: **
504: ** the contents of storage specified in bind-by-value calls are
505: ** evaluated immediately.
506: ** the addresses of storage specified in bind-by-reference calls are
507: ** remembered, and the contents are examined at every execute.
508: **
509: ** cursor - pointer to csrdef
510: ** sqlvn - the number represented by the name of the bind variables
511: ** for variables of the form :n or &n for n in [1..256)
512: ** (i.e. &1, :234). unnecessarily using larger numbers
513: ** in the range wastes space.
514: ** sqlvar - the name of the bind variable (:name or &name)
515: ** sqlval - the length of the name;
516: ** in bindif -1, strlen(bvname) is used
517: ** progv - pointer to the object to bind.
518: ** progvl - length of object to bind.
519: ** in bind-by-value if specified as -1 then strlen(bfa) is
520: ** used (really only makes sends with character types)
521: ** in bind-by-value, if specified as -1 then UB2MAXVAL
522: ** is used. Again this really makes sense only with
523: ** SQLT_STR.
524: ** ftype - datatype of object
525: ** indp - pointer to indicator variable.
526: ** -1 means to ignore bfa/bfl and bind NULL;
527: ** not -1 means to bind the contents of bfa/bfl
528: ** bind the contents pointed to by bfa
529: ** aln - Alternate length pointer
530: ** rcp - Return code pointer
531: ** mal - Maximum array length
532: ** cal - Current array length pointer
533: ** fmt - format string
534: ** fmtl - length of format string; if -1, strlen(fmt) is used
535: ** fmtt - desired output type after applying forat mask. Not
536: ** really yet implemented
537: ** scale - number of decimal digits in a cobol packed decimal (type 7)
538: **
539: ** Note that the length of bfa when bound as SQLT_STR is reduced
540: ** to strlen(bfa).
541: ** Note that trailing blanks are stripped of storage of SQLT_STR.
542: */
543:
544: /***************************/
545: /* DESCRIBING */
546: /***************************/
547: sword ocidsc ( /*_ struct csrdef *cursor, word pos, b2 *dbsize, b2 *fsize,
548: b2 *rcode, b2 *dtype, b1 *buf, b2 *bufl, b2 *dsize _*/ );
549: sword ocidsr( /*_ struct csrdef *cursor, word pos, b2 *dbsize, b2 *dtype,
550: b2 *fsize _*/ );
551: sword ocinam( /*_ struct csrdef *cursor, word pos, b1 *tbuf, b2 *tbufl,
552: b1 *buf, b2 *bufl _*/);
553: /*
554: ** ocidsc, ocidsr: Obtain information about a column
555: ** ocinam : get the name of a column
556: ** cursor - pointer to csrdef
557: ** pos - position in select list from [1..N]
558: ** dbsize - place to store the database size
559: ** fsize - place to store the fetched size
560: ** rcode - place to store the fetched column returned code
561: ** dtype - place to store the data type
562: ** buf - array to store the column name
563: ** bufl - place to store the column name length
564: ** dsize - maximum display size
565: ** tbuf - place to store the table name
566: ** tbufl - place to store the table name length
567: */
568:
569: sword ocidsp ( /*_ struct csrdef *cursor, word pos, b4 *dbsize, b2 *dbtype,
570: b1 *cbuf, b4 *cbufl, b4 *dsize, sb2 *pre, sb2 *scl,
571: sb2 *nul _*/);
572:
573: sword ocidpr(/*_ ldadef *lda, text *object_name, size_t object_length,
574: ptr_t reserved1, size_t reserved1_length, ptr_t reserved2,
575: size_t reserved2_length, ub2 *overload, ub2 *position,
576: ub2 *level, text **argument_name, ub2 *argument_length,
577: ub2 *datatype, ub1 *default_supplied, ub1 *in_out,
578: ub4 *length, sb2 *precision, sb2 *scale, ub1 *radix,
579: ub4 *spare, ub4 *total_elements _*/);
580: /*
581: ** OCIDPR - User Program Interface: Describe Stored Procedure
582: **
583: ** This routine is used to obtain information about the calling
584: ** arguments of a stored procedure. The client provides the
585: ** name of the procedure using "object_name" and "database_name"
586: ** (database name is optional). The client also supplies the
587: ** arrays for OCIDPR to return the values and indicates the
588: ** length of array via the "total_elements" parameter. Upon return
589: ** the number of elements used in the arrays is returned in the
590: ** "total_elements" parameter. If the array is too small then
591: ** an error will be returned and the contents of the return arrays
592: ** are invalid.
593: **
594: **
595: ** EXAMPLE :
596: **
597: ** Client provides -
598: **
599: ** object_name - SCOTT.ACCOUNT_UPDATE@BOSTON
600: ** total_elements - 100
601: **
602: **
603: ** ACCOUNT_UPDATE is an overloaded function with specification :
604: **
605: ** type number_table is table of number index by binary_integer;
606: ** table account (account_no number, person_id number,
607: ** balance number(7,2))
608: ** table person (person_id number(4), person_nm varchar2(10))
609: **
610: ** function ACCOUNT_UPDATE (account number,
611: ** person person%rowtype, amounts number_table,
612: ** trans_date date) return accounts.balance%type;
613: **
614: ** function ACCOUNT_UPDATE (account number,
615: ** person person%rowtype, amounts number_table,
616: ** trans_no number) return accounts.balance%type;
617: **
618: **
619: ** Values returned -
620: **
621: ** overload position argument level datatype length prec scale rad
622: ** -------------------------------------------------------------------
623: ** 0 0 0 NUMBER 22 7 2 10
624: ** 0 1 ACCOUNT 0 NUMBER 22 0 0 0
625: ** 0 2 PERSON 0 RECORD 0 0 0 0
626: ** 0 2 PERSON_ID 1 NUMBER 22 4 0 10
627: ** 0 2 PERSON_NM 1 VARCHAR2 10 0 0 0
628: ** 0 3 AMOUNTS 0 TABLE 0 0 0 0
629: ** 0 3 1 NUMBER 22 0 0 0
630: ** 0 4 TRANS_NO 0 NUMBER 22 0 0 0
631: **
632: ** 1 0 0 NUMBER 22 7 2 10
633: ** 1 1 ACCOUNT 0 NUMBER 22 0 0 0
634: ** 1 2 PERSON 0 RECORD 0 0 0 0
635: ** 1 2 PERSON_ID 1 NUMBER 22 4 0 10
636: ** 1 2 PERSON_NM 1 VARCHAR2 10 0 0 0
637: ** 1 3 AMOUNTS 0 TABLE 0 0 0 0
638: ** 1 3 1 NUMBER 22 0 0 0
639: ** 1 4 TRANS_DATE 0 NUMBER 22 0 0 0
640: **
641: **
642: ** OCIDPR Argument Descriptions -
643: **
644: ** ldadef - pointer to ldadef
645: ** object_name - object name, synonyms are also accepted and will
646: ** be translate, currently only procedure and function
647: ** names are accepted, also NLS names are accepted.
648: ** Currently, the accepted format of a name is
649: ** [[part1.]part2.]part3[@dblink] (required)
650: ** object_length - object name length (required)
651: ** reserved1 - reserved for future use
652: ** reserved1_length - reserved for future use
653: ** reserved2 - reserved for future use
654: ** reserved2_length - reserved for future use
655: ** overload - array indicating overloaded procedure # (returned)
656: ** position - array of argument positions, position 0 is a function
657: ** return argument (returned)
658: ** level - array of argument type levels, used to describe
659: ** sub-datatypes of data structures like records
660: ** and arrays (returned)
661: ** argument_name - array of argument names, only returns first
662: ** 30 characters of argument names, note storage
663: ** for 30 characters is allocated by client (returned)
664: ** argument_length - array of argument name lengths (returned)
665: ** datatype - array of oracle datatypes (returned)
666: ** default_supplied - array indicating parameter has default (returned)
667: ** 0 = no default, 1 = default supplied
668: ** in_out - array indicating if argument is IN or OUT (returned
669: ** 0 = IN param, 1 = OUT param, 2 = IN/OUT param
670: ** length - array of argument lengths (returned)
671: ** precision - array of precisions (if number type)(returned)
672: ** scale - array of scales (if number type)(returned)
673: ** radix - array of radix (if number type)(returned)
674: ** spare - array of spares.
675: ** total_elements - size of arrays supplied by client (required),
676: ** total number of elements filled (returned)
677: */
678:
679: /*************************************/
680: /* DEFINING */
681: /*************************************/
682: sword ocidfi( /*_ struct csrdef *cursor, word pos, ub1 *buf, word bufl,
683: word ftype, b2 *rc, word scale _*/ );
684: sword ocidfn( /*_ struct csrdef *cursor, word pos, ub1 *buf, word bufl,
685: word ftype, word scale, b2 *indp, text *fmt, word fmtl,
686: word fmtt, ub2 *rl, ub2 *rc _*/ );
687: sword ocidfnps( /*_ struct csrdef *cursor, ub1 opcode, word pos, ub1 *buf,
688: sb4 bufl, word ftype, word scale,
689: b2 *indp, text *fmt, sb4 fmtl,
690: word fmtt, ub2 *rl, ub2 *rc,
691: sb4 pv_skip, sb4 ind_skip, sb4 len_skip, sb4 rc_skip _*/ );
692:
693:
694: /* Define a user data buffer using upidfn
695: ** cursor - pointer to csrdef
696: ** pos - position of a field or exp in the select list of a query
697: ** bfa/bfl - address and length of client-supplied storage
698: to receive data
699: ** ftype - user datatype
700: ** scale - number of fractional digits for cobol packed decimals
701: ** indp - place to store the length of the returned value. If returned
702: ** value is:
703: ** negative, the field fetched was NULL
704: ** zero , the field fetched was same length or shorter than
705: ** the buffer provided
706: ** positive, the field fetched was truncated
707: ** fmt - format string
708: ** fmtl - length of format string, if -1 strlent(fmt) used
709: ** rl - place to store column length after each fetch
710: ** rc - place to store column error code after each fetch
711: ** fmtt - fomat type
712: */
713:
714: /********************************/
715: /* PIECE INFORMATION GET/SET */
716: /********************************/
717: sword ocigetpi( /*_ struct csrdef *cursor, ub1 *piecep,
718: dvoid **ctxpp, ub4 *iterp, ub4 *indexp _*/ );
719: sword ocisetpi( /*_ struct csrdef *cursor, ub1 piece,
720: dvoid *bufp, ub4 *lenp _*/ );
721:
722:
723: /********************************/
724: /* EXECUTE */
725: /********************************/
726: sword ociexe( /*_ struct csrdef *cursor _*/ );
727: sword ociexn( /*_ struct csrdef *cursor, word iters, word roff _*/ );
728: sword ociefn( /*_ struct csrdef *cursor, ub4 nrows, word can, word exact _*/);
729: /*
730: ** ociexe - execute a cursor
731: ** ociexn - execute a cursosr N times
732: ** cursor - pointer to a csrdef
733: ** iters - number of times to execute cursor
734: ** roff - offset within the bind variable array at which to begin
735: ** operations.
736: */
737:
738:
739: /*********************************/
740: /* FETCHING */
741: /*********************************/
742: sword ocifet( /*_ struct csrdef *cursor _*/ );
743: sword ocifen( /*_ struct csrdef *cursor, word nrows _*/ );
744: /* ocifet - fetch the next row
745: ** ocifen - fetch n rows
746: ** cursor - pointer to csrdef
747: ** nrows - number of rows to be fetched
748: */
749:
750: sword ocilng(/*_ struct csrdef *cursor, word posit, ub1 *bfa, sb4 bfl,
751: word dty, ub4 *rln, sb4 off _*/);
752:
753: /*********************************/
754: /* CONVERSION */
755: /*********************************/
756: sword ocic32( /*_ struct csrdef *cursor _*/ );
757: /*
758: ** Convert selected version 3 return codes to the equivalent
759: ** version 2 code.
760: ** csrdef->csrrc is set to the converted code
761: ** csrdef->csrft is set to v2 oracle statment type
762: ** csrdef->csrrpc is set to the rows processed count
763: ** csrdef->csrpeo is set to error postion
764: **
765: ** cursor - pointer to csrdef
766: */
767:
768:
769: sword ocir32( /*_ struct csrdef *cursor, word retcode _*/ );
770: /*
771: ** Convert selected version 3 return codes to the equivalent version 2 code.
772: **
773: ** cursor - pointer to csrdef
774: ** retcode - place to store the return code
775: */
776:
777:
778: VOID ociscn( /*_ word **arglst, char *mask_addr, word **newlst _*/ );
779: /*
780: ** Convert call-by-ref to call-by-value:
781: ** takes an arg list and a mask address, determines which args need
782: ** conversion to a value, and creates a new list begging at the address
783: ** of newlst.
784: **
785: ** arglst - list of arguments
786: ** mast_addr _ mask address determines args needing conversion
787: ** newlst - new list of args
788: */
789:
790: word ocistf ( /*_ word typ, word bufl, word rdig, text *fmt,
791: struct csrdef *cursor, sword *err _*/ );
792: /* Convert a packed decimal buffer length (bytes) and scale to a format
793: ** string of the form mm.+/-nn, where mm is the number of packed
794: ** decimal digits, and nn is the scaling factor. A positive scale name
795: ** nn digits to the rights of the decimal; a negative scale means nn zeros
796: ** should be supplied to the left of the decimal.
797: ** bufl - length of the packed decimal buffer
798: ** rdig - number of fractional digits
799: ** fmt - pointer to a string holding the conversion format
800: ** cursor - pointer to csrdef
801: ** err - pointer to word storing error code
802: */
803:
804:
805: /******************************************/
806: /* Non-blocking operations */
807: /******************************************/
808: sword ocinbs( /*_ ldadef *lda _*/ ); /* set a connection to non-blocking */
809: sword ocinbt( /*_ ldadef *lda _*/ ); /* test if connection is non-blocking */
810: sword ocinbc( /*_ ldadef *lda _*/ ); /* clear a connection to blocking */
811: sword ocinlo( /*_ ldadef *lda, struct hstdef *hst, text *conn,
812: sword connl, text *uid, sword uidl,
813: text *psw, sword pswl, sword audit _*/ );
814: /* logon in non-blocking fashion */
815: /* ocinlo allows an application to logon in non-blocking fashion.
816: ** lda - pointer to ldadef
817: ** hst - pointer to a 256 byte area, must be cleared to zero before call
818: ** conn - the database link (if specified @LINK in uid will be ignored)
819: ** connl - length of conn; if -1 strlen(conn) is used
820: ** uid - user id [USER[/PASSWORD][@LINK]]
821: ** uidl - length of uid, if -1 strlen(uid) is used
822: ** psw - password string; ignored if specified in uid
823: ** pswl - length of psw, if -1 strlen(psw) is used
824: ** audit - is not supported; the only permissible value is 0
825: */
826:
827: /***************************************************/
828: /* Procedure Declaration for Pro*C */
829: /***************************************************/
830: /* Note: The following routines are used in Pro*C and have the
831: same interface as their couterpart in OCI.
832: Althought the interface follows for more details please refer
833: to the above routines */
834:
835: /******************************************/
836: /* initialization/logon/logof */
837: /******************************************/
838: sword ocipin( /*_ ub4 mode _*/ );
839:
840: sword ologin( /*_ ldadef *lda, b2 areacount _*/ );
841: sword ologon( /*_ ldadef *lda, b2 areacount _*/ );
842: sword olon( /*_ ldadef *lda, text *uid, word uidl, text *psw, word pswl,
843: word audit _*/);
844: sword orlon( /*_ ldadef *lda, struct hstdef *hst, text *uid, word uidl,
845: text *psw, word pswl, word audit _*/ );
846: sword ologof( /*_ ldadef *lda _*/ );
847:
848: /*****************************************/
849: /* Open/Close/Parse Cursor */
850: /*****************************************/
851: sword oopen( /*_ struct csrdef *cursor, ldadef *lda, text *dbn, word dbnl,
852: word areasize, text *uid, word uidl _*/ );
853: sword oclose( /*_ struct csrdef *cursor _*/ );
854: sword osql3( /*_ struct csrdef *cursor, text *sqlstm, word sqllen _*/ );
855: sword oparse( /*_ struct csrdef *cursor, text *sqlstm, sb4 sqllen,
856: word defflg, ub4 sqlt _*/);
857:
858: /*
859: ** ocisqd - oci delayed parse (Should be used only with deferred upi/oci)
860: ** FUNCTION: Call upidpr to delay the parse of the sql statement till the
861: ** time that a call needs to be made to the kernel (execution or
862: ** describe time )
863: ** RETURNS: Oracle return code.
864: */
865: sword ocisq7(/*_ struct csrdef *cursor, text *sqlstm, sb4 sqllen,
866: word defflg, ub4 sqlt _*/);
867:
868: /*****************************************/
869: /* Commit/Rollback */
870: /*****************************************/
871: sword ocom( /*_ ldadef *lda _*/ );
872: sword ocon( /*_ ldadef *lda _*/ );
873: sword ocof( /*_ ldadef *lda _*/ );
874: sword orol( /*_ ldadef *lda _*/ );
875:
876:
877: /*****************************************/
878: /* Control/Options */
879: /*****************************************/
880: sword oopt( /*_ struct csrdef *cursor, word erropt, word waitopt _*/ );
881: sword ocan( /*_ struct csrdef *cursor _*/ );
882: sword obreak( /*_ ldadef *lda _*/ );
883:
884:
885: /*****************************************/
886: /* Bind */
887: /*****************************************/
888: sword obind( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
889: word progvl, word ftype, word scale, text *fmt, word fmtl,
890: word fmtt _*/ );
891: sword obindn( /*_ struct csrdef *cursor, ub2 sqlvn, ub1 *progv, word progvl,
892: word ftype, word scale, text *fmt, word fmtl, word fmtt _*/ );
893: sword obndrn( /*_ struct csrdef *cursor, word sqlvn, ub1 *progv, word progvl,
894: word ftype, word scale, b2 *indp, text *fmt, word fmtl,
895: word fmtt _*/ );
896: sword obndrv( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
897: word progvl, word ftype, word scale, b2 *indp, text *fmt,
898: word fmtl, word fmtt _*/ );
899:
900: /**********************************************/
901: /* Define */
902: /**********************************************/
903: sword odefin( /*_ struct csrdef *cursor, word pos, ub1 *buf, word bufl,
904: word ftype, word scale, b2 *indp, text *fmt, word fmtl,
905: word fmtt, ub2 *rl, ub2 *rc _*/ );
906: sword odfinn( /*_ struct csrdef *cursor, word pos, ub1 *buf, word bufl,
907: word ftype, b2 *rc, word scale _*/ );
908:
909: /**********************************************/
910: /* Describe */
911: /**********************************************/
912: sword odsc ( /*_ struct csrdef *cursor, word pos, b2 *dbsize, b2 *fsize,
913: b2 *rcode, b2 *dtype, b1 *buf, b2 *bufl, b2 *dsize _*/ );
914: sword odsrbn( /*_ struct csrdef *cursor, word pos, b2 *dbsize, b2 *dtype,
915: b2 *fsize _*/ );
916: sword oname( /*_ struct csrdef *cursor, word pos, b1 *tbuf, b2 *tbufl,
917: b1 *buf, b2 *bufl _*/);
918:
919: /***********************************************/
920: /* Error message */
921: /***********************************************/
922: #if !defined(__STDC__) && !defined(__cplusplus)
923: sword oermsg( /*_ b2 rcode, text *buffer _*/ );
924: sword oerhms( /*_ ldadef *lda, b2 rcode, text *buffer, word bufl _*/ );
925: #endif /* __STDC__ */
926:
927: /***********************************************/
928: /* Execute */
929: /***********************************************/
930: sword oexec( /*_ struct csrdef *cursor _*/ );
931: sword oexn( /*_ struct csrdef *cursor, word iters, word roff _*/ );
932: sword oexfet( /*_ struct csrdef *cursor, ub4 nrows, word can, word exact _*/ );
933:
934:
935: /***********************************************/
936: /* Fetch */
937: /***********************************************/
938: sword ofetch( /*_ struct csrdef *cursor _*/ );
939: sword ofen( /*_ struct csrdef *cursor, word nrows _*/ );
940:
941: /******************************************/
942: /* Non-blocking operations */
943: /******************************************/
944: sword onbset( /*_ ldadef *lda _*/ ); /* set a connection to non-blocking */
945: sword onbtst( /*_ ldadef *lda _*/ ); /* test if connection is non-blocking */
946: sword onbclr( /*_ ldadef *lda _*/ ); /* clear a connection to blocking */
947: sword onblon( /*_ ldadef *lda, struct hstdef *hst, text *conn,
948: sword connl, text *uid, sword uidl,
949: text *psw, sword pswl, sword audit _*/ );
950: /* logon in non-blocking fashion */
951: sword ocignfd( /*_ ldadef *lda, dvoid *nfdp _*/); /* get native fd */
952:
953: ub2 ocigft_getFcnType( /*_ ub2 oertyp _*/ ); /* get sql function code */
954:
955: #endif
E-mail: