-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorl.h
More file actions
3633 lines (3291 loc) · 154 KB
/
orl.h
File metadata and controls
3633 lines (3291 loc) · 154 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (c) 1993, 2006, Oracle. All rights reserved. */
/*
Author: Srinath Krishnaswamy
Date: 11/24/93
Source documents: "Functional Specification for C Language Mapping of
OTS Types, Object Management Subsystem", "Oracle C
Coding Standards version 2.2", and the header file
template
Rule sets: the generic and .h file rule sets
Quality status: not exited
Identification tag: [ one or more letters to identify the .h file ]
Revision code: 11/24/93
NAME
ORL - ORacle's external C Language interface to primitive OTS types
DESCRIPTION
This header file contains C langauge interface to the OTS primitive
types. The interface includes C mapping of OTS primitive types and
the prototype of the pre-defined operations on the primitive types.
***********************************************************************
*** NOTE: The OCI functions for objects requires the ***
*** application to be running in OBJECT mode. That is, during ***
*** process initialization OCIInitialize(), the mode ***
*** specified should be OBJECT mode. ***
** OCIInitialize(OCI_OBJECT, ..); ***
***********************************************************************
RELATED DOCUMENTS
[1] Krishnaswamy, Srinath and Nguyen, Tin A., "Functional Specification
for C Language Mapping of OTS Types, Object Management Subsystem",
March 1994.
[2] Nguyen, Tin A., "The Open Type System", Oracle Corporation,
February 1994.
[3] Klein, Jonathan D., "Large Field Management", Oracle Corporation,
October 1993.
PUBLIC FUNCTIONS
OCI - OCI functions to manipulate Oracle Number, float and decimal
ARITHMETIC
OCINumberInc - OCINumber INCrement (optimized)
OCINumberDec - OCINumber DECrement (optimized)
OCINumberAdd - OCINumber ADD numbers
OCINumberSub - OCINumber SUBtract numbers
OCINumberMul - OCINumber MULtiply numbers
OCINumberDiv - OCINumber DIVide numbers
OCINumberMod - OCINumber MODulo division
OCINumberIntPower - OCINumber integer PoWeR
OCINumberShift - OCINumber decimal ShiFT number
OCINumberNeg - OCINumber NEGate number
OCINumberAbs - OCINumber ABSolute value
OCINumberCeil - OCINumber CEiling of number
OCINumberFloor - OCINumber FLooR of number
OCINumberSqrt - OCINumber SQuare Root of number
OCINumberSign - OCINumber get SIGN of number
NATIVE TYPE CONVERSION
OCINumberToInt - OCINumber convert number TO machine-format Integer
OCINumberFromInt - OCINumber convert machine-format Integer TO Number
OCINumberToReal - OCINumber convert number TO machine-format Real
OCINumberToRealArray - OCINumber convert array of numbers TO
machine-format Real
OCINumberFromReal - OCINumber convert machine-format Real TO Number
TEXT STRING CONVERSION
OCINumberToText - OCINumber convert number TO String
OCINumberFromText - OCINumber convert String TO Number
COMPARISON
OCINumberCmp - OCINumber CoMPare numbers
OCINumberIsZero - OCINumber comparison with ZERo
OCINumberIsInt - OCINumber Is an Integer
ASSIGNMENT
OCINumberAssign - OCINumber ASsiGn number
OCINumberSetZero - OCINumber Set number to Zero value
OCINumberSetPi - OCINumber Set number to Pi
ROUNDING
OCINumberTrunc - OCINumber TRUncate an Oracle number
OCINumberRound - OCINumber ROUnd number
OCINumberPrec - OCINumber round to Precision digits
TRANSCENDENTAL
OCINumberSin - OCINumber SINe
OCINumberArcSin - OCINumber Arc SINe
OCINumberHypSin - OCINumber SiNe Hyperbolic
OCINumberCos - OCINumber COSine
OCINumberArcCos - OCINumber Arc COSine
OCINumberHypCos - OCINumber CoSine Hyperbolic
OCINumberTan - OCINumber TANgent
OCINumberArcTan - OCINumber Arc TANgent
OCINumberArcTan2 - OCINumber Arc TaNgent 2
OCINumberHypTan - OCINumber TaNgent Hyperbolic
OCINumberPower - OCINumber arbitrary Base EXponentiation
OCINumberExp - OCINumber EXPonentiation to base e
OCINumberLn - OCINumber Logarithm Natural
OCINumberLog - OCINumber LOGarithm to arbitrary base
OCIDate - OCI functions to manipulate OCI Date
OCIDateToExternal - OCIDate convert date to external form
OCIDateFromExternal - OCIDate convert external form of date into OCIDate
OCIDateAssign - OCIDate Assignment
OCIDateToText - OCIDate convert date TO String
OCIDateFromText - OCIDate convert String TO Date
OCIDateZoneToZone - OCIDate convert date from one time
Zone TO another Zone
OCIDateCompare - OCIDate CoMPare dates
OCIDateAddMonths - OCIDate ADd or subtract Months
OCIDateAddDays - OCIDate ADd or subtract Days
OCIDateLastDay - OCIDate get date of LaST day of month
OCIDateDaysBetween - OCIDate get number of days BeTWeen two dates
OCIDateNextDay - OCIDate get date of Next DaY
OCIDateCheck - OCIDate CHecK if the given date is valid
OCIDateSysDate - OCIDate get current SYStem date and time
OCIString - OCI String functions to manipulate Variable-length string
OCIStringAssign - OCIString Assign string to string
OCIStringAssignText - OCIString Assign Text string to string
OCIStringResize - OCIString ReSiZe string
OCIStringSize - OCIString get String Size
OCIStringPtr - OCIString get String PoinTeR
OCIStringAllocSize - OCIString get Allocated SiZe
OCIRaw - OCI Raw functions to manipulate variable-length raW
OCIRawAssignRaw - OCIRaw Assign Raw (of type OCIRaw*) to raw
(of type OCIRaw*)
OCIRawResize - OCIRaw Resize raw
OCIRawSize - OCIRaw get Raw Size
OCIRawPtr - OCIRaw get Raw data Pointer
OCIRawAllocSize - OCIRaw get Allocated Size
OCIColl - OCI Collection generic functions. These functions can be
used to manipulate both variable-length array (varray) and
nested table.
OCICollSize - OCIColl return current SIZe of the given collection
(in number of elements)
OCICollMax - OCIColl return the MAXimum number of elements in the
collection (i.e. upper-bound)
OCICollGetElem - OCIColl GET pointer to the element at the given
position
OCICollAssignElem - OCIColl assign to element at given index
OCICollAssign - OCIColl ASsiGn collection; perform deep-copy of source
collection to target collection
OCICollAppend - OCIColl aPPend the given element to the end of the
collection
OCICollTrim - OCIColl trim (delete) the given number of elements
from the end of the collection
OCICollIsLocator - OCIColl indicates whether a collection is locator
based or not.
OCIIterCreate - OCIColl Create an ITerator to scan the collection
elements
OCIIterDelete - OCIColl Delete ITerator
OCIIterInit - OCIColl Initialize ITerator to scan the given collection
OCIIterGetCurrent - OCIColl Iterator based, get CURrent
collection element
OCIIterNext - OCIColl Iterator based, get NeXT collection element
OCIIterPrev - OCIColl Iterator based, get PReVious collection element
OCITable - OCI functions to manipulate nested Table. The OCIColl*() and
OCITable*() functions can be used to manipulate nested table
OCITableDelete(i) - OCITable if element(i) exists then the element is
marked as deleted else the function returns false. So
delete's create "holes".
OCITableExists(i) - OCITable return true iff an element at
position i EXIsts
OCITableFirst - OCITable return the smallest value of i for which
exists(i) is true.
OCITableLast - OCITable return the largest value of i for which
exists(i) is true.
OCITableNext(i) - OCITable return pointer to the smallest position j,
greater than i, such that OCITableExists(j) is true
OCITablePrev(i) - OCITable return pointer to the largest position j,
less than i, such that OCITableExists(j) is true
OCITableSize - OCITable return current SIZe of the given nested table not
including deleted elements
OCIRef - OCI functions to manipulate object Reference
OCIRefClear - OCIRef CLeaR or nullify a ref
OCIRefAssign - OCIRef ASsiGn a ref to another
OCIRefIsEqual - OCIRef compare two refs for EQUality
OCIRefIsNull - OCIRef test if a ref is NULl
OCIRefFromHex - OCIRef convert a Hexadecimal string TO a Ref
OCIRefToHex - OCIRef convert a ref to a Hexadecimal string
OCIRefHexSize - OCIRef get size of buffer in bytes to store hexadecimal
string
OBSOLETE: to be replaced by functions from oci.h:
ORLL - ORL functions to manipulate lob Locators
orllasg - ORLL AsiGn one locator to another
orllequ - ORLL compare two locators for EQUality
orlliini - ORLL Is the locator INItialized?
orllgsz - ORLL Get locator SiZe
orllgcid - ORLL Get Character set ID
NOTE: The following are specific to FILE lobs:
orllsnm - ORLL Set directory alias and file NaMe in the locator
orllgnm - ORLL Get directory alias and file NaMe from the locator
EXAMPLES
Examples are given in the description of each function where
relevant.
NOTES
This file has been subsetted to contain ONLY the routines that will
be in the first release.
QUESTIONS
MODIFIED
bkhaladk 08/01/05 - add defn for OCIBinXmlReposCtx
dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup
srseshad 03/12/03 - convert oci public api to ansi
rpingte 11/21/02 - Add OCICollGetElemArray and OCINumberToRealArray
aahluwal 06/03/02 - bug 2360115
gayyappa 02/01/02 - fix 2210776 : change Dom to DOM
whe 09/25/01 - add OCIXMLType & OCIDomDocument opaque types
bpalaval 02/09/01 - Change text to oratext.
rkasamse 09/20/99 - lint changes
whe 09/01/99 - 976457:check __cplusplus for C++ code
hsbedi 08/11/99 - Add macro
rxgovind 10/14/98 - make non exposed calls (OCIRowType etc) private
rxgovind 06/09/98 - update OCIRowTypeCreate
nmantrav 05/11/98 - add OCIRowTypeGetCount
rxgovind 03/29/98 - add OCIRowType and OCIRowData interfaces
jwijaya 05/06/98 - add OCICollIsLocator
rxgovind 03/18/98 - opaque types: move to kolo.h
etucker 02/02/98 - add comments for Dec and Inc
etucker 01/29/98 - Finish core5 integration
rxgovind 11/11/97 - opaque types
etucker 10/28/97 - add ORLN functions for SDK
cxcheng 07/28/97 - remove OCILobLocator #define
skmishra 05/13/97 - stdcc compatibility changes
skrishna 04/25/97 - rename OCINumber*(): Exp Power TanHyp Zero Init
TanToArc Sqr Truncate and Compare
skotsovo 03/31/97 - remove OCILobLocatorSize
skrishna 03/25/97 - remove orld2i and orldi2d
skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types
cxcheng 02/06/97 - take out short name support except with SLSHORTNAME
skrishna 01/06/97 - update OCITableSize() comments
skrishna 12/27/96 - fix OCIDateGet/OCIDateSet
skrishna 12/12/96 - update OCICollGelElem comments
skrishna 11/07/96 - OCICollGetElem: interface change
skrishna 11/05/96 - add OCIDate Get/Set and OCIDateAssign
cxcheng 10/31/96 - change OCINumberTanHyp to OCINumberHypTan
cxcheng 10/30/96 - #define orll short names to long names
dchatter 10/26/96 - fix some OCI file long names
cxcheng 10/24/96 - remove unnecessary comment in front
cxcheng 10/14/96 - disable long name mapping for LOB functions
skrishna 10/13/96 - continue beautification
skotsovo 10/16/96 - update ocilob names
cxcheng 10/09/96 - add structure members in #define for date/time
cxcheng 10/09/96 - more lint fixes
skrishna 10/09/96 - continue beautification
cxcheng 10/09/96 - more fixes
skrishna 10/09/96 - change fixed-char rep. to orlvstr*
jwijaya 10/08/96 - continue beautification
jwijaya 10/07/96 - beautify
cxcheng 10/07/96 - more changes
cxcheng 10/04/96 - replace short names with long names
skrishna 10/01/96 - orlcsiz, orltsiz: change prototype to take errhdl
skrishna 09/23/96 - fix lint errors
skotsovo 09/23/96 - remove orllmkcur().
jwijaya 09/17/96 - comments on null ref
skrishna 09/19/96 - change orlraw format
skotsovo 09/19/96 - add orlliini and remove orllnul
skrishna 08/14/96 - orlvstr: change format to ub4 followed by text
jboonleu 08/06/96 - update comment
skotsovo 08/08/96 - revert to locators instead of descriptors as input t
jboonleu 07/23/96 - remove orlrcur
skrishna 07/06/96 - add orltsiz
skrishna 07/05/96 - add orld2i and orldi2d
jwijaya 07/03/96 - add ANSI prototypes
skrishna 06/27/96 - document default string format in orlds2d & orld2s
skrishna 06/25/96 - change max date value
skrishna 06/18/96 - modify orld2s() comments
skotsovo 06/13/96 - orll functions take lob descriptors instead of locat
rxgovind 06/05/96 - change prototype of orlrcur to take ocienvh
skrishna 05/30/96 - support collection trimming
skrishna 05/30/96 - remove orlralo/fre and orllalo/fre instead use
orionew/fre
skrishna 05/28/96 - add orlt*() and modify orla*()
skotsovo 05/23/96 - add orlbl typedefs for pro*c
jboonleu 05/14/96 - add orlrcur
rxgovind 05/08/96 - changes for 3gl callbacks
skotsovo 05/01/96 - in orllasg, no need to alloc orlbl*
skrishna 04/21/96 - merge changes from 960418 object branch into big
skrishna 04/17/96 - rename orlrcpy to orlrasg
skrishna 04/12/96 - add orlr2h and orlrh2r functions
skotsovo 04/15/96 - add fnt to make the lob locator current
skrishna 04/08/96 - change orl*() to take ocienvh* and ocierrh* instead
of oroenv*
skotsovo 03/22/96 - add locator functions
skotsovo 03/22/96 - add locator functions
skrishna 02/27/96 - remove mlslabel interface
skotsovo 02/20/96 - remove orlbty and use dty type instead.
skotsovo 02/14/96 - add text file lobs.
skrishna 01/31/96 - update comments of orln2r, orldchk, orlds2d & orld2s
skrishna 01/31/96 - change orld2s() and orln2s() to return string length
skrishna 01/21/96 - remove old raw interface
skrishna 12/14/95 - add raw interface
skotsovo 01/03/96 - change LOB offsets and lengths from ub4 to ubig_ora
to support 64 bit machines.
skotsovo 10/30/95 - add orlblsiz() to get lob locator size
skrishna 10/24/95 - move ref functions from ori and update the ref
functions to support variable-length ref
cxcheng 10/20/95 - add more comments on number versions
cxcheng 10/13/95 - add more number functions
cxcheng 08/29/95 - Support for segmented varrays
cxcheng 08/18/95 - modifiy orlmls structure
skrishna 06/06/95 - rename orln, orld, orlvs and orlva to orlnum,
orldat, orlvstr and orlvary respectively
skrishna 11/15/94 - remove orlnget() function
skrishna 09/20/94 - modify orldbtw() to return number of days only
skrishna 08/24/94 - change format string length type from ub4 to ub1
skrishna 07/19/94 - Rename orln2c & orlnc2n to orln2s & orlns2n
skrishna 06/29/94 - Add blob interface; add examples
skrishna 06/23/94 - Update comments and format
skrishna 05/19/94 - update varray append comments
skrishna 05/05/94 - Subsetting
skrishna 11/24/93 - Creation
*/
#ifndef ORATYPES
#include <oratypes.h>
#endif
/*
#ifndef ORO_ORACLE
#include <oro.h>
#endif
#ifndef ORT_ORACLE
#include <ort.h>
#endif
*/
#ifndef OCI_ORACLE
#include <oci.h>
#endif
#ifndef ORL_ORACLE
#define ORL_ORACLE
/*---------------------------------------------------------------------------*/
/* SHORT NAMES SUPPORT SECTION */
/*---------------------------------------------------------------------------*/
#ifdef SLSHORTNAME
/* the following are short names that are only supported on IBM mainframes
with the SLSHORTNAME defined.
With this all subsequent long names will actually be substituted with
the short names here */
#define OCIArray orlvary
#define OCIColl orlcol
#define OCICollAppend orlcapp
#define OCICollAssign orlcasg
#define OCICollAssignElem orlcase
#define OCICollGetElem orlcget
#define OCICollGetElemArray orlcgeta
#define OCICollMax orlcmax
#define OCICollSize orlcsiz
#define OCICollTrim orlctrm
#define OCICollIsLocator orlcilc
#define OCIDate orldat
#define OCIDateAddDays orldadd
#define OCIDateAddMonths orldadm
#define OCIDateCheck orldchk
#define OCIDateCompare orldcmp
#define OCIDateDD day_orldat
#define OCIDateDaysBetween orldbtw
#define OCIDateFromText orlds2d
#define OCIDateLastDay orldlst
#define OCIDateMM mon_orldat
#define OCIDateNextDay orldndy
#define OCIDateSysDate orldsys
#define OCIDateTime time_orldat
#define OCIDateYYYY gye_orldat
#define OCIDateZoneToZone orldz2z
#define OCIIter orlcitr
#define OCIIterCreate orlccit
#define OCIIterDelete orlcdit
#define OCIIterGetCurrent orlcicur
#define OCIIterInit orlciit
#define OCIIterNext orlcinxt
#define OCIIterPrev orlciprv
#define OCINumber orlnum
#define OCINumberAbs orlnabs
#define OCINumberAdd orlnadd
#define OCINumberArcCos orlnacos
#define OCINumberArcSin orlnasin
#define OCINumberArcTan orlnatan
#define OCINumberAssign orlnasg
#define OCINumberCeil orlncel
#define OCINumberCos orlncos
#define OCINumberDiv orlndiv
#define OCINumberPower orlnbex
#define OCINumberFloor orlnflr
#define OCINumberFromInt orlni2n
#define OCINumberFromReal orlnr2n
#define OCINumberFromText orlns2n
#define OCINumberHypCos orlncsh
#define OCINumberHypSin orlnsnh
#define OCINumberSetZero orlnini
#define OCINumberSetPi orlnspi
#define OCINumberInc orlninc
#define OCINumberDec orlndec
#define OCINumberIntPower orlnpwr
#define OCINumberLn orlnln
#define OCINumberLog orlnlog
#define OCINumberMod orlnmod
#define OCINumberMul orlnmul
#define OCINumberNeg orlnneg
#define OCINumberPart orlnpart
#define OCINumberExp orlnexp
#define OCINumberRound orlnrou
#define OCINumberPrec orlnpre
#define OCINumberShift orlnsft
#define OCINumberSign orlnsgn
#define OCINumberSin orlnsin
#define OCINumberSqrt orlnsqr
#define OCINumberSub orlnsub
#define OCINumberTan orlntan
#define OCINumberHypTan orlntnh
#define OCINumberArcTan2 orlnatn2
#define OCINumberToInt orln2i
#define OCINumberToReal orln2r
#define OCINumberToRealArray orln2ra
#define OCINumberToText orln2s
#define OCINumberTrunc orlntru
#define OCINumberCmp orlncmp
#define OCINumberIsZero orlnzer
#define OCINumberIsInt orlnint
#define OCIRaw orlraw
#define OCIRawAllocSize orlwasz
#define OCIRawAssignBytes orlwabr
#define OCIRawAssignRaw orlwarr
#define OCIRawPtr orlwgrp
#define OCIRawResize orlwrsz
#define OCIRawSize orlwgsz
#define OCIRefAssign orlrasg
#define OCIRefClear orlrclr
#define OCIRefFromHex orlrh2r
#define OCIRefHexSize orlrhsz
#define OCIRefIsEqual orlrequ
#define OCIRefIsNull orlrnul
#define OCIRefToHex orlr2h
#define OCIString orlvstr
#define OCIStringAllocSize orlvasz
#define OCIStringAssign orlvass
#define OCIStringAssignText orlvats
#define OCIStringPtr orlvgsp
#define OCIStringResize orlvrsz
#define OCIStringSize orlvgsz
#define OCITable orltbl
#define OCITableDelete orltdel
#define OCITableExists orltexi
#define OCITableFirst orltfst
#define OCITableLast orltlst
#define OCITableNext orltnxt
#define OCITablePrev orltprv
#define OCITableSize orltsiz
#define OCITime orldtm
#define OCITimeHH orldtmhh
#define OCITimeMI orldtmmm
#define OCITimeSS orldtmss
#define OCI_LOBMODE_READONLY ORLBMORO
#define OCI_LOBMODE_READWRITE ORLBMORW
#endif /* SLSHORTNAME */
/*****************************************************************************/
/* NUMBER/FLOAT/DECIMAL TYPE */
/*****************************************************************************/
#define OCI_NUMBER_SIZE 22
struct OCINumber
{
ub1 OCINumberPart[OCI_NUMBER_SIZE];
};
typedef struct OCINumber OCINumber;
/*
* OCINumber - OCI Number mapping in c
*
* The OTS types: NUMBER, NUMERIC, INT, SHORTINT, REAL, DOUBLE PRECISION,
* FLOAT and DECIMAL are represented by OCINumber.
* The contents of OCINumber is opaque to clients.
*
* For binding variables of type OCINumber in OCI calls (OCIBindByName(),
* OCIBindByPos(), and OCIDefineByPos()) use the type code SQLT_VNU.
*/
/*
EXAMPLE
The following example shows how to manipulate an attribute of type
oracle number.
struct person
{
OCINumber sal;
};
typedef struct person person;
OCIError *err;
person* joe;
person* tom;
person* debbie;
OCINumber *joesal;
OCINumber *tomsal;
OCINumber *debsal;
sword status;
int inum;
double dnum;
OCINumber ornum;
char buffer[21];
ub4 buflen;
sword result;
/o See oci.h for an example of how to initialize OCIError.
o For this example, assume the OCIEnv and OCIError has been
o initialized.
o/
/o Pin joe, tom and debbie person objects in the object cache. See ori.h
o for an example on pinning objects. For this example, assume that
o joe, tom and debbie are pointing to pinned objects.
o/
joesal = &joe->sal;
tomsal = &tom->sal;
debsal = &debbie->sal;
/o initialize joe's salary to be $12,000 o/
inum = 12000;
status = OCINumberFromInt(err, &inum, sizeof(inum), OCI_NUMBER_SIGNED,
joesal);
if (status != OCI_SUCCESS)
/o goto to handle error from OCINumberFromInt o/;
/o initialize tom's salary to be same as joe o/
OCINumberAssign(err, joesal, tomsal);
/o initialize debbie's salary to be 20% more than joe's o/
dnum = 1.2;
status = OCINumberFromReal(err, &dnum, sizeof(double), &ornum);
if (status != OCI_SUCCESS)
/o goto to handle error from OCINumberFromReal o/;
status = OCINumberMul(err, joesal, &ornum, debsal);
if (status != OCI_SUCCESS) /o goto to handle error from OCINumberMul o/;
/o give tom a 50% raise o/
dnum = 1.5;
status = OCINumberFromReal(err, &dnum, sizeof(double), &ornum);
if (status != OCI_SUCCESS)
/o goto to handle error from OCINumberFromReal o/;
status = OCINumberMul(err, tomsal, &ornum, tomsal);
if (status != OCI_SUCCESS) /o goto to handle error from OCINumberMul o/;
/o double joe's salary o/
status = OCINumberAdd(err, joesal, joesal, joesal);
if (status != OCI_SUCCESS) /o goto to handle error from OCINumberAdd o/;
/o get joe's salary in integer o/
status = OCINumberToInt(err, joesal, sizeof(inum), OCI_NUMBER_SIGNED,
&inum);
if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToInt o/;
/o inum is set to 24000 o/
/o get debbie's salary in double o/
status = OCINumberToReal(err, debsal, sizeof(dnum), &dnum);
if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToReal o/;
/o dnum is set to 14400 o/
/o print tom's salary as DEM0001`8000.00 o/
buflen = sizeof(buffer);
status = OCINumberToText(err, tomsal, "C0999G9999D99", 13,
"NLS_NUMERIC_CHARACTERS='.`' NLS_ISO_CURRENCY='Germany'", 54,
&buflen, buffer);
if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToText o/;
printf("tom's salary = %s\n", buffer);
/o compare joe and tom's salary o/
status = OCINumberCmp(err, joesal, tomsal, &result);
if (status != OCI_SUCCESS) /o goto to handle error from OCINumberCmp o/;
/o result is positive o/
/o read debbie's new salary from string o/
status = OCINumberFromText(err, "48`000.00", 9, "99G999D99", 9,
"NLS_NUMERIC_CHARACTERS='.`'", 27, debsal);
if (status != OCI_SUCCESS)
/o goto to handle error from OCINumberFromText o/;
/o debbie's salary is now 48000.00 o/
*/
/*----------------------------- OCINumberInc --------------------------------*/
sword OCINumberInc( OCIError *err, OCINumber *number );
/*
NAME: OCINumberInc - OCINumber INCrement numbers
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number (IN/OUT) a positive Oracle number to be incremented
DESCRIPTION:
Increment Oracle number in place. It is assumed that the input is
an integer between 0 and 100^21-2. If the is input too large, it will
be treated as 0 - the result will be an Oracle number 1. If the input
is not a positive integer, the result will be unpredictable.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*----------------------------- OCINumberDec --------------------------------*/
sword OCINumberDec( OCIError *err, OCINumber *number );
/*
NAME: OCINumberDec - OCINumber DECrement numbers
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number (IN/OUT) - a positive Oracle number to be decremented
DESCRIPTION:
Decrement Oracle number in place. It is assumed that the input is an
integer between 1 and 100^21-2. If the input is too large, it will be
treated as 1 - the result will be an Oracle number 0. If the input is
not a positive integer, the result will be unpredictable.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*-------------------------- OCINumberSetZero -------------------------------*/
void OCINumberSetZero( OCIError *err, OCINumber *num );
/*
NAME: OCINumberSetZero - OCINumber Set number to Zero value
PARAMETERS:
err (IN/OUT) - pointer to OCI error handle
num (OUT) - set to zero value
DESCRIPTION:
Initialize the given number to value 0.
*/
/*--------------------------- OCINumberSetPi --------------------------------*/
void OCINumberSetPi( OCIError *err, OCINumber *num );
/*
NAME: OCINumberSetPi - OCINumber Set number to Pi
err (IN/OUT) - pointer to OCI error handle
num (OUT) - set to zero value
DESCRIPTION:
Initialize the given number to value Pi.
*/
/*----------------------------- OCINumberAdd --------------------------------*/
sword OCINumberAdd( OCIError *err, const OCINumber *number1,
const OCINumber *number2, OCINumber *result );
/*
NAME: OCINumberAdd - OCINumber ADD numbers
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number1, number2 (IN) - numbers to be added
result (OUT) - result of adding 'number1' with 'number2'
DESCRIPTION:
Add 'number1' with 'number2' and return result in 'result'.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*----------------------------- OCINumberSub --------------------------------*/
sword OCINumberSub( OCIError *err, const OCINumber *number1,
const OCINumber *number2, OCINumber *result );
/*
NAME: OCINumberSub - OCINumber SUBtract numbers
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number1, number2 (IN) - 'number2' subtracted from 'number1'
result (OUT) - subtraction result
DESCRIPTION:
Subtract 'number2' from 'number1' and return result in 'result'.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*----------------------------- OCINumberMul --------------------------------*/
sword OCINumberMul( OCIError *err, const OCINumber *number1,
const OCINumber *number2, OCINumber *result );
/*
NAME: OCINumberMul - OCINumber MULtiply numbers
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number1, number2 (IN) - numbers to be multiplied
result (OUT) - multiplication result
DESCRIPTION:
Multiply 'number1' with 'number2' and return result in 'result'.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*----------------------------- OCINumberDiv --------------------------------*/
sword OCINumberDiv( OCIError *err, const OCINumber *number1,
const OCINumber *number2, OCINumber *result );
/*
NAME: OCINumberDiv - OCINumber DIVide numbers
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number1 (IN) - pointer to the numerator
number2 (IN) - pointer to the denominator
result (OUT) - division result
DESCRIPTION:
Divide 'number1' by 'number2' and return result in 'result'.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
underflow errorr
overflow errorr
divide by zero errorr
*/
/*----------------------------- OCINumberMod --------------------------------*/
sword OCINumberMod( OCIError *err, const OCINumber *number1,
const OCINumber *number2, OCINumber *result );
/*
NAME: OCINumberMod - OCINumber MODulous
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number1 (IN) - pointer to the numerator
number2 (IN) - pointer to the denominator
result (OUT) - remainder of the result
DESCRIPTION:
Finds the remainder of the division of two Oracle numbers.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
divide by zero errorr
*/
/*------------------------ OCINumberIntPower --------------------------------*/
sword OCINumberIntPower( OCIError *err, const OCINumber *base,
const sword exp, OCINumber *result );
/*
NAME: OCINumberIntPower - OCINumber takes an arbitary base to an arbitary
integer PoWeR
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
base (IN) - base of the exponentiation
exp (IN) - exponent to which the base is to be raised
result (OUT) - output of exponentiation
DESCRIPTION:
Takes an arbitary base to an arbitary integer power.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*-------------------------- OCINumberShift ---------------------------------*/
sword OCINumberShift( OCIError *err, const OCINumber *number,
const sword nDig, OCINumber *result );
/*
NAME: OCINumberShift - OCINumber multiplies by a power of 10.
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number (IN) - Oracle Number to be shifted.
nDig (IN) - number of decimal places to shift.
result (OUT) - shift result.
DESCRIPTION:
Multiplies number by 10^NDig and sets product to the result.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*----------------------------- OCINumberNeg --------------------------------*/
sword OCINumberNeg( OCIError *err, const OCINumber *number,
OCINumber *result );
/*
NAME: OCINumberNeg - OCINumber NEGate number
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number (IN) - number to be negated
result (OUT) - will contain negated value of 'number'
DESCRIPTION:
Negates an Oracle number.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
any of the number arguments is null
*/
/*------------------------- OCINumberToText ---------------------------------*/
sword OCINumberToText( OCIError *err, const OCINumber *number,
const oratext *fmt, ub4 fmt_length,
const oratext *nls_params, ub4 nls_p_length,
ub4 *buf_size, oratext *buf );
/*
NAME: OCINumberToText - OCINumber convert number TO String
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number (IN) - Oracle number to be converted
fmt (IN) - conversion format
fmt_length (IN) - length of the 'fmt' parameter
nls_params (IN) - nls format specification, if null string
i.e. (oratext *)0, then the default parameters for the
session is used
nls_p_length (IN) - length of the 'nls_params' parameter
buf_size (IN/OUT) - size of the buffer must be passed as input by
the caller, this function will return the length of the
resulting string in bytes via this parameter. The length
does not include the terminating null ('\0').
buf (OUT) - buffer into which the converted string is placed. The
resulting string is null terminated.
DESCRIPTION:
Converts the given number to a character string
according to the specified format. Refer to "TO_NUMBER" conversion
function described in "Oracle SQL Language Reference Manual" for a
description of format and NLS parameters.
The converted number string is stored in the buffer 'buf', up to
a max of '*buf_size' bytes. Length of the resulting string is
returned via 'buf_size'.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
'number' or 'buf' is null
buffer too small
invalid format
invalid nls format
number to text translation for the given format causes overflow
*/
/*-------------------------- OCINumberFromText ------------------------------*/
sword OCINumberFromText( OCIError *err, const oratext *str,
ub4 str_length, const oratext *fmt, ub4 fmt_length,
const oratext *nls_params, ub4 nls_p_length,
OCINumber *number );
/*
NAME: OCINumberFromText - OCINumber convert String TO Number
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
str (IN) - input string to be converted to Oracle number
str_length (IN) - size of the input string
fmt (IN) - conversion format
fmt_length (IN) - length of the 'fmt' parameter
nls_params (IN) - nls format specification, if null string
i.e. (oratext *)0, then the default parameters for the
session is used
nls_p_length (IN) - length of the 'nls_params' parameter
number (OUT) - given string converted to number
DESCRIPTION:
Converts the given string to a number
according to the specified format. Refer to "TO_NUMBER" conversion
function described in "Oracle SQL Language Reference Manual" for a
description of format and NLS parameters.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
'number' or 'str' is null
'str_length' is 0
invalid format
invalid nls format
invalid input string
*/
/*-------------------------- OCINumberToInt ---------------------------------*/
#define OCI_NUMBER_UNSIGNED 0 /* Unsigned type -- ubX */
#define OCI_NUMBER_SIGNED 2 /* Signed type -- sbX */
sword OCINumberToInt( OCIError *err, const OCINumber *number,
uword rsl_length, uword rsl_flag, void *rsl );
/*
NAME: OCINumberToInt - OCINumber convert number TO Integer
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
number (IN) - number to be converted
rsl_length (IN) - size of the desired result
rsl_s_flag (IN) - flag denoting the desired sign of the output; valid
values are OCI_NUMBER_UNSIGNED, OCI_NUMBER_SIGNED
rsl (OUT) - pointer to space for the result
DESCRIPTION:
Native type conversion function.
Converts the given Oracle number into an xbx (e.g. ub2, ub4, sb2 etc.)
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
'number' or 'rsl' is null
integer value of 'number' is too big -- overflow
integer value of 'number' is too small -- underflow
invalid sign flag value ('rsl_s_flag')
*/
/*--------------------------- OCINumberFromInt ------------------------------*/
sword OCINumberFromInt( OCIError *err, const void *inum, uword inum_length,
uword inum_s_flag, OCINumber *number );
/*
NAME: OCINumberFromInt - OCINumber convert Integer TO Number
PARAMETERS:
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
inum (IN) - pointer to the integer to be converted
inum_length (IN) - size of the integer
inum_s_flag (IN) - flag that designates the sign of the integer; valid
values are OCI_NUMBER_UNSIGNED, OCI_NUMBER_SIGNED
number (OUT) - given integer converted to Oracle number
DESCRIPTION:
Native type conversion function. Converts any Oracle standard
machine-native integer type (xbx) to an Oracle number.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
'number' or 'inum' is null
integer too BIG -- the number is too large to fit into an Oracle
number
invalid sign flag value ('inum_s_flag')
*/
/*------------------------- OCINumberToReal ---------------------------------*/