-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathdpi.h
2329 lines (1835 loc) · 85.7 KB
/
dpi.h
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) 2016, 2024, Oracle and/or its affiliates.
//
// This software is dual-licensed to you under the Universal Permissive License
// (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
// 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
// either license.
//
// If you elect to accept the software under the Apache License, Version 2.0,
// the following applies:
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// dpi.h
// Include file for users of the ODPI-C library.
//-----------------------------------------------------------------------------
#ifndef DPI_PUBLIC
#define DPI_PUBLIC
// Avoid name-mangling when using C++
#ifdef __cplusplus
extern "C" {
#endif
// define standard integer types for older versions of Microsoft Visual Studio
#ifdef _MSC_VER
#if _MSC_VER < 1600
#define int8_t signed __int8
#define int16_t signed __int16
#define int32_t signed __int32
#define int64_t signed __int64
#define uint8_t unsigned __int8
#define uint16_t unsigned __int16
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#endif
#endif
#ifndef int8_t
#include <stdint.h>
#endif
// define __func__ for older versions of Microsoft Visual Studio
#ifdef _MSC_VER
#if _MSC_VER < 1900
#define __func__ __FUNCTION__
#endif
#endif
// define macro for exporting functions on Windows
#if defined(_MSC_VER) && defined(DPI_EXPORTS)
#define DPI_EXPORT __declspec(dllexport)
#else
#define DPI_EXPORT
#endif
// define ODPI-C version information
#define DPI_MAJOR_VERSION 5
#define DPI_MINOR_VERSION 4
#define DPI_PATCH_LEVEL 1
#define DPI_VERSION_SUFFIX
#define DPI_STR_HELPER(x) #x
#define DPI_STR(x) DPI_STR_HELPER(x)
#define DPI_VERSION_STRING \
DPI_STR(DPI_MAJOR_VERSION) "." \
DPI_STR(DPI_MINOR_VERSION) "." \
DPI_STR(DPI_PATCH_LEVEL) \
DPI_VERSION_SUFFIX
#define DPI_DEFAULT_DRIVER_NAME "ODPI-C : " DPI_VERSION_STRING
#define DPI_VERSION_TO_NUMBER(major, minor, patch) \
((major * 10000) + (minor * 100) + patch)
#define DPI_VERSION_NUMBER \
DPI_VERSION_TO_NUMBER(DPI_MAJOR_VERSION, DPI_MINOR_VERSION, \
DPI_PATCH_LEVEL)
#define DPI_ORACLE_VERSION_TO_NUMBER(versionNum, releaseNum, updateNum, \
portReleaseNum, portUpdateNum) \
((versionNum * 100000000) + (releaseNum * 1000000) + \
(updateNum * 10000) + (portReleaseNum * 100) + (portUpdateNum))
// define default array size to use
#define DPI_DEFAULT_FETCH_ARRAY_SIZE 100
// define default number of rows to prefetch
#define DPI_DEFAULT_PREFETCH_ROWS 2
// define default ping interval (in seconds) used when getting connections
#define DPI_DEFAULT_PING_INTERVAL 60
// define default ping timeout (in milliseconds) used when getting connections
#define DPI_DEFAULT_PING_TIMEOUT 5000
// define default statement cache size
#define DPI_DEFAULT_STMT_CACHE_SIZE 20
// define constants for dequeue wait (AQ)
#define DPI_DEQ_WAIT_NO_WAIT 0
#define DPI_DEQ_WAIT_FOREVER ((uint32_t) -1)
// define maximum precision that can be supported by an int64_t value
#define DPI_MAX_INT64_PRECISION 18
// define constants for success and failure of methods
#define DPI_SUCCESS 0
#define DPI_FAILURE -1
// set debug level (DPI_DEBUG_LEVEL) as a bitmask of desired flags
// reporting is to stderr
// 0x0001: reports errors during free
// 0x0002: reports on reference count changes
// 0x0004: reports on public function calls
// 0x0008: reports on all errors
// 0x0010: reports on all SQL statements
// 0x0020: reports on all memory allocations/frees
// 0x0040: reports on all attempts to load the Oracle Client library
#define DPI_DEBUG_LEVEL_UNREPORTED_ERRORS 0x0001
#define DPI_DEBUG_LEVEL_REFS 0x0002
#define DPI_DEBUG_LEVEL_FNS 0x0004
#define DPI_DEBUG_LEVEL_ERRORS 0x0008
#define DPI_DEBUG_LEVEL_SQL 0x0010
#define DPI_DEBUG_LEVEL_MEM 0x0020
#define DPI_DEBUG_LEVEL_LOAD_LIB 0x0040
//-----------------------------------------------------------------------------
// Enumerations
//-----------------------------------------------------------------------------
// connection/pool authorization modes
typedef uint32_t dpiAuthMode;
#define DPI_MODE_AUTH_DEFAULT 0x00000000
#define DPI_MODE_AUTH_SYSDBA 0x00000002
#define DPI_MODE_AUTH_SYSOPER 0x00000004
#define DPI_MODE_AUTH_PRELIM 0x00000008
#define DPI_MODE_AUTH_SYSASM 0x00008000
#define DPI_MODE_AUTH_SYSBKP 0x00020000
#define DPI_MODE_AUTH_SYSDGD 0x00040000
#define DPI_MODE_AUTH_SYSKMT 0x00080000
#define DPI_MODE_AUTH_SYSRAC 0x00100000
// connection close modes
typedef uint32_t dpiConnCloseMode;
#define DPI_MODE_CONN_CLOSE_DEFAULT 0x0000
#define DPI_MODE_CONN_CLOSE_DROP 0x0001
#define DPI_MODE_CONN_CLOSE_RETAG 0x0002
// connection/pool creation modes
typedef uint32_t dpiCreateMode;
#define DPI_MODE_CREATE_DEFAULT 0x00000000
#define DPI_MODE_CREATE_THREADED 0x00000001
#define DPI_MODE_CREATE_EVENTS 0x00000004
// dequeue modes for advanced queuing
typedef uint32_t dpiDeqMode;
#define DPI_MODE_DEQ_BROWSE 1
#define DPI_MODE_DEQ_LOCKED 2
#define DPI_MODE_DEQ_REMOVE 3
#define DPI_MODE_DEQ_REMOVE_NO_DATA 4
// dequeue navigation flags for advanced queuing
typedef uint32_t dpiDeqNavigation;
#define DPI_DEQ_NAV_FIRST_MSG 1
#define DPI_DEQ_NAV_NEXT_TRANSACTION 2
#define DPI_DEQ_NAV_NEXT_MSG 3
// event types
typedef uint32_t dpiEventType;
#define DPI_EVENT_NONE 0
#define DPI_EVENT_STARTUP 1
#define DPI_EVENT_SHUTDOWN 2
#define DPI_EVENT_SHUTDOWN_ANY 3
#define DPI_EVENT_DEREG 5
#define DPI_EVENT_OBJCHANGE 6
#define DPI_EVENT_QUERYCHANGE 7
#define DPI_EVENT_AQ 100
// JSON conversion options
#define DPI_JSON_OPT_DEFAULT 0x00
#define DPI_JSON_OPT_NUMBER_AS_STRING 0x01
#define DPI_JSON_OPT_DATE_AS_DOUBLE 0x02
// statement execution modes
typedef uint32_t dpiExecMode;
#define DPI_MODE_EXEC_DEFAULT 0x00000000
#define DPI_MODE_EXEC_DESCRIBE_ONLY 0x00000010
#define DPI_MODE_EXEC_COMMIT_ON_SUCCESS 0x00000020
#define DPI_MODE_EXEC_BATCH_ERRORS 0x00000080
#define DPI_MODE_EXEC_PARSE_ONLY 0x00000100
#define DPI_MODE_EXEC_ARRAY_DML_ROWCOUNTS 0x00100000
// statement fetch modes
typedef uint16_t dpiFetchMode;
#define DPI_MODE_FETCH_NEXT 0x0002
#define DPI_MODE_FETCH_FIRST 0x0004
#define DPI_MODE_FETCH_LAST 0x0008
#define DPI_MODE_FETCH_PRIOR 0x0010
#define DPI_MODE_FETCH_ABSOLUTE 0x0020
#define DPI_MODE_FETCH_RELATIVE 0x0040
// message delivery modes in advanced queuing
typedef uint16_t dpiMessageDeliveryMode;
#define DPI_MODE_MSG_PERSISTENT 1
#define DPI_MODE_MSG_BUFFERED 2
#define DPI_MODE_MSG_PERSISTENT_OR_BUFFERED 3
// message states in advanced queuing
typedef uint32_t dpiMessageState;
#define DPI_MSG_STATE_READY 0
#define DPI_MSG_STATE_WAITING 1
#define DPI_MSG_STATE_PROCESSED 2
#define DPI_MSG_STATE_EXPIRED 3
// native C types
typedef uint32_t dpiNativeTypeNum;
#define DPI_NATIVE_TYPE_INT64 3000
#define DPI_NATIVE_TYPE_UINT64 3001
#define DPI_NATIVE_TYPE_FLOAT 3002
#define DPI_NATIVE_TYPE_DOUBLE 3003
#define DPI_NATIVE_TYPE_BYTES 3004
#define DPI_NATIVE_TYPE_TIMESTAMP 3005
#define DPI_NATIVE_TYPE_INTERVAL_DS 3006
#define DPI_NATIVE_TYPE_INTERVAL_YM 3007
#define DPI_NATIVE_TYPE_LOB 3008
#define DPI_NATIVE_TYPE_OBJECT 3009
#define DPI_NATIVE_TYPE_STMT 3010
#define DPI_NATIVE_TYPE_BOOLEAN 3011
#define DPI_NATIVE_TYPE_ROWID 3012
#define DPI_NATIVE_TYPE_JSON 3013
#define DPI_NATIVE_TYPE_JSON_OBJECT 3014
#define DPI_NATIVE_TYPE_JSON_ARRAY 3015
#define DPI_NATIVE_TYPE_NULL 3016
#define DPI_NATIVE_TYPE_VECTOR 3017
// operation codes (database change and continuous query notification)
typedef uint32_t dpiOpCode;
#define DPI_OPCODE_ALL_OPS 0x0
#define DPI_OPCODE_ALL_ROWS 0x1
#define DPI_OPCODE_INSERT 0x2
#define DPI_OPCODE_UPDATE 0x4
#define DPI_OPCODE_DELETE 0x8
#define DPI_OPCODE_ALTER 0x10
#define DPI_OPCODE_DROP 0x20
#define DPI_OPCODE_UNKNOWN 0x40
// Oracle types
typedef uint32_t dpiOracleTypeNum;
#define DPI_ORACLE_TYPE_NONE 2000
#define DPI_ORACLE_TYPE_VARCHAR 2001
#define DPI_ORACLE_TYPE_NVARCHAR 2002
#define DPI_ORACLE_TYPE_CHAR 2003
#define DPI_ORACLE_TYPE_NCHAR 2004
#define DPI_ORACLE_TYPE_ROWID 2005
#define DPI_ORACLE_TYPE_RAW 2006
#define DPI_ORACLE_TYPE_NATIVE_FLOAT 2007
#define DPI_ORACLE_TYPE_NATIVE_DOUBLE 2008
#define DPI_ORACLE_TYPE_NATIVE_INT 2009
#define DPI_ORACLE_TYPE_NUMBER 2010
#define DPI_ORACLE_TYPE_DATE 2011
#define DPI_ORACLE_TYPE_TIMESTAMP 2012
#define DPI_ORACLE_TYPE_TIMESTAMP_TZ 2013
#define DPI_ORACLE_TYPE_TIMESTAMP_LTZ 2014
#define DPI_ORACLE_TYPE_INTERVAL_DS 2015
#define DPI_ORACLE_TYPE_INTERVAL_YM 2016
#define DPI_ORACLE_TYPE_CLOB 2017
#define DPI_ORACLE_TYPE_NCLOB 2018
#define DPI_ORACLE_TYPE_BLOB 2019
#define DPI_ORACLE_TYPE_BFILE 2020
#define DPI_ORACLE_TYPE_STMT 2021
#define DPI_ORACLE_TYPE_BOOLEAN 2022
#define DPI_ORACLE_TYPE_OBJECT 2023
#define DPI_ORACLE_TYPE_LONG_VARCHAR 2024
#define DPI_ORACLE_TYPE_LONG_RAW 2025
#define DPI_ORACLE_TYPE_NATIVE_UINT 2026
#define DPI_ORACLE_TYPE_JSON 2027
#define DPI_ORACLE_TYPE_JSON_OBJECT 2028
#define DPI_ORACLE_TYPE_JSON_ARRAY 2029
#define DPI_ORACLE_TYPE_UROWID 2030
#define DPI_ORACLE_TYPE_LONG_NVARCHAR 2031
#define DPI_ORACLE_TYPE_XMLTYPE 2032
#define DPI_ORACLE_TYPE_VECTOR 2033
#define DPI_ORACLE_TYPE_JSON_ID 2034
#define DPI_ORACLE_TYPE_MAX 2035
// session pool close modes
typedef uint32_t dpiPoolCloseMode;
#define DPI_MODE_POOL_CLOSE_DEFAULT 0x0000
#define DPI_MODE_POOL_CLOSE_FORCE 0x0001
// modes used when acquiring a connection from a session pool
typedef uint8_t dpiPoolGetMode;
#define DPI_MODE_POOL_GET_WAIT 0
#define DPI_MODE_POOL_GET_NOWAIT 1
#define DPI_MODE_POOL_GET_FORCEGET 2
#define DPI_MODE_POOL_GET_TIMEDWAIT 3
// purity values when acquiring a connection from a pool
typedef uint32_t dpiPurity;
#define DPI_PURITY_DEFAULT 0
#define DPI_PURITY_NEW 1
#define DPI_PURITY_SELF 2
// database shutdown modes
typedef uint32_t dpiShutdownMode;
#define DPI_MODE_SHUTDOWN_DEFAULT 0
#define DPI_MODE_SHUTDOWN_TRANSACTIONAL 1
#define DPI_MODE_SHUTDOWN_TRANSACTIONAL_LOCAL 2
#define DPI_MODE_SHUTDOWN_IMMEDIATE 3
#define DPI_MODE_SHUTDOWN_ABORT 4
#define DPI_MODE_SHUTDOWN_FINAL 5
// SODA flags
#define DPI_SODA_FLAGS_DEFAULT 0x00
#define DPI_SODA_FLAGS_ATOMIC_COMMIT 0x01
#define DPI_SODA_FLAGS_CREATE_COLL_MAP 0x02
#define DPI_SODA_FLAGS_INDEX_DROP_FORCE 0x04
// database startup modes
typedef uint32_t dpiStartupMode;
#define DPI_MODE_STARTUP_DEFAULT 0
#define DPI_MODE_STARTUP_FORCE 1
#define DPI_MODE_STARTUP_RESTRICT 2
// server types
typedef uint8_t dpiServerType;
#define DPI_SERVER_TYPE_UNKNOWN 0
#define DPI_SERVER_TYPE_DEDICATED 1
#define DPI_SERVER_TYPE_SHARED 2
#define DPI_SERVER_TYPE_POOLED 4
// statement types
typedef uint16_t dpiStatementType;
#define DPI_STMT_TYPE_UNKNOWN 0
#define DPI_STMT_TYPE_SELECT 1
#define DPI_STMT_TYPE_UPDATE 2
#define DPI_STMT_TYPE_DELETE 3
#define DPI_STMT_TYPE_INSERT 4
#define DPI_STMT_TYPE_CREATE 5
#define DPI_STMT_TYPE_DROP 6
#define DPI_STMT_TYPE_ALTER 7
#define DPI_STMT_TYPE_BEGIN 8
#define DPI_STMT_TYPE_DECLARE 9
#define DPI_STMT_TYPE_CALL 10
#define DPI_STMT_TYPE_EXPLAIN_PLAN 15
#define DPI_STMT_TYPE_MERGE 16
#define DPI_STMT_TYPE_ROLLBACK 17
#define DPI_STMT_TYPE_COMMIT 21
// subscription grouping classes
typedef uint8_t dpiSubscrGroupingClass;
#define DPI_SUBSCR_GROUPING_CLASS_TIME 1
// subscription grouping types
typedef uint8_t dpiSubscrGroupingType;
#define DPI_SUBSCR_GROUPING_TYPE_SUMMARY 1
#define DPI_SUBSCR_GROUPING_TYPE_LAST 2
// subscription namespaces
typedef uint32_t dpiSubscrNamespace;
#define DPI_SUBSCR_NAMESPACE_AQ 1
#define DPI_SUBSCR_NAMESPACE_DBCHANGE 2
// subscription protocols
typedef uint32_t dpiSubscrProtocol;
#define DPI_SUBSCR_PROTO_CALLBACK 0
#define DPI_SUBSCR_PROTO_MAIL 1
#define DPI_SUBSCR_PROTO_PLSQL 2
#define DPI_SUBSCR_PROTO_HTTP 3
// subscription quality of service
typedef uint32_t dpiSubscrQOS;
#define DPI_SUBSCR_QOS_RELIABLE 0x01
#define DPI_SUBSCR_QOS_DEREG_NFY 0x02
#define DPI_SUBSCR_QOS_ROWIDS 0x04
#define DPI_SUBSCR_QOS_QUERY 0x08
#define DPI_SUBSCR_QOS_BEST_EFFORT 0x10
// two-phase commit (flags for dpiConn_tpcBegin())
typedef uint32_t dpiTpcBeginFlags;
#define DPI_TPC_BEGIN_JOIN 0x00000002
#define DPI_TPC_BEGIN_NEW 0x00000001
#define DPI_TPC_BEGIN_PROMOTE 0x00000008
#define DPI_TPC_BEGIN_RESUME 0x00000004
// two-phase commit (flags for dpiConn_tpcEnd())
typedef uint32_t dpiTpcEndFlags;
#define DPI_TPC_END_NORMAL 0
#define DPI_TPC_END_SUSPEND 0x00100000
// vector flags
typedef uint8_t dpiVectorFlags;
#define DPI_VECTOR_FLAGS_FLEXIBLE_DIM 0x01
// vector formats
typedef uint8_t dpiVectorFormat;
#define DPI_VECTOR_FORMAT_FLOAT32 2
#define DPI_VECTOR_FORMAT_FLOAT64 3
#define DPI_VECTOR_FORMAT_INT8 4
#define DPI_VECTOR_FORMAT_BINARY 5
// visibility of messages in advanced queuing
typedef uint32_t dpiVisibility;
#define DPI_VISIBILITY_IMMEDIATE 1
#define DPI_VISIBILITY_ON_COMMIT 2
//-----------------------------------------------------------------------------
// Handle Types
//-----------------------------------------------------------------------------
typedef struct dpiConn dpiConn;
typedef struct dpiContext dpiContext;
typedef struct dpiDeqOptions dpiDeqOptions;
typedef struct dpiEnqOptions dpiEnqOptions;
typedef struct dpiJson dpiJson;
typedef struct dpiLob dpiLob;
typedef struct dpiMsgProps dpiMsgProps;
typedef struct dpiObject dpiObject;
typedef struct dpiObjectAttr dpiObjectAttr;
typedef struct dpiObjectType dpiObjectType;
typedef struct dpiPool dpiPool;
typedef struct dpiQueue dpiQueue;
typedef struct dpiRowid dpiRowid;
typedef struct dpiSodaColl dpiSodaColl;
typedef struct dpiSodaCollCursor dpiSodaCollCursor;
typedef struct dpiSodaDb dpiSodaDb;
typedef struct dpiSodaDoc dpiSodaDoc;
typedef struct dpiSodaDocCursor dpiSodaDocCursor;
typedef struct dpiStmt dpiStmt;
typedef struct dpiSubscr dpiSubscr;
typedef struct dpiVar dpiVar;
typedef struct dpiVector dpiVector;
//-----------------------------------------------------------------------------
// Forward Declarations of Other Types
//-----------------------------------------------------------------------------
typedef struct dpiAccessToken dpiAccessToken;
typedef struct dpiAnnotation dpiAnnotation;
typedef struct dpiAppContext dpiAppContext;
typedef struct dpiCommonCreateParams dpiCommonCreateParams;
typedef struct dpiConnCreateParams dpiConnCreateParams;
typedef struct dpiConnInfo dpiConnInfo;
typedef struct dpiContextCreateParams dpiContextCreateParams;
typedef struct dpiData dpiData;
typedef union dpiDataBuffer dpiDataBuffer;
typedef struct dpiDataTypeInfo dpiDataTypeInfo;
typedef struct dpiEncodingInfo dpiEncodingInfo;
typedef struct dpiErrorInfo dpiErrorInfo;
typedef struct dpiJsonNode dpiJsonNode;
typedef struct dpiMsgRecipient dpiMsgRecipient;
typedef struct dpiObjectAttrInfo dpiObjectAttrInfo;
typedef struct dpiObjectTypeInfo dpiObjectTypeInfo;
typedef struct dpiPoolCreateParams dpiPoolCreateParams;
typedef struct dpiQueryInfo dpiQueryInfo;
typedef struct dpiShardingKeyColumn dpiShardingKeyColumn;
typedef struct dpiStringList dpiSodaCollNames;
typedef struct dpiSodaOperOptions dpiSodaOperOptions;
typedef struct dpiStmtInfo dpiStmtInfo;
typedef struct dpiStringList dpiStringList;
typedef struct dpiSubscrCreateParams dpiSubscrCreateParams;
typedef struct dpiSubscrMessage dpiSubscrMessage;
typedef struct dpiSubscrMessageQuery dpiSubscrMessageQuery;
typedef struct dpiSubscrMessageRow dpiSubscrMessageRow;
typedef struct dpiSubscrMessageTable dpiSubscrMessageTable;
typedef struct dpiVectorInfo dpiVectorInfo;
typedef union dpiVectorDimensionBuffer dpiVectorDimensionBuffer;
typedef struct dpiVersionInfo dpiVersionInfo;
typedef struct dpiXid dpiXid;
//-----------------------------------------------------------------------------
// Declaration for function pointers
//-----------------------------------------------------------------------------
typedef int (*dpiAccessTokenCallback)(void *context,
dpiAccessToken *accessToken);
//-----------------------------------------------------------------------------
// Complex Native Data Types (used for transferring data to/from ODPI-C)
//-----------------------------------------------------------------------------
// structure used for transferring byte strings to/from ODPI-C
typedef struct {
char *ptr;
uint32_t length;
const char *encoding;
} dpiBytes;
// structure used for transferring day/seconds intervals to/from ODPI-C
typedef struct {
int32_t days;
int32_t hours;
int32_t minutes;
int32_t seconds;
int32_t fseconds;
} dpiIntervalDS;
// structure used for transferring years/months intervals to/from ODPI-C
typedef struct {
int32_t years;
int32_t months;
} dpiIntervalYM;
// structure used for transferring JSON nodes to/from ODPI-C
struct dpiJsonNode {
dpiOracleTypeNum oracleTypeNum;
dpiNativeTypeNum nativeTypeNum;
dpiDataBuffer *value;
};
// structure used for transferring JSON object values to/from ODPI-C
typedef struct {
uint32_t numFields;
char **fieldNames;
uint32_t *fieldNameLengths;
dpiJsonNode *fields;
dpiDataBuffer *fieldValues;
} dpiJsonObject;
// structure used for transferring JSON array values to/from ODPI-C
typedef struct {
uint32_t numElements;
dpiJsonNode *elements;
dpiDataBuffer *elementValues;
} dpiJsonArray;
// structure used for transferring dates to/from ODPI-C
typedef struct {
int16_t year;
uint8_t month;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t second;
uint32_t fsecond;
int8_t tzHourOffset;
int8_t tzMinuteOffset;
} dpiTimestamp;
//-----------------------------------------------------------------------------
// Other Types
//-----------------------------------------------------------------------------
// union used for providing a buffer of any data type
union dpiDataBuffer {
int asBoolean;
uint8_t asUint8;
uint16_t asUint16;
uint32_t asUint32;
int64_t asInt64;
uint64_t asUint64;
float asFloat;
double asDouble;
char *asString;
void *asRaw;
dpiBytes asBytes;
dpiTimestamp asTimestamp;
dpiIntervalDS asIntervalDS;
dpiIntervalYM asIntervalYM;
dpiJson *asJson;
dpiJsonObject asJsonObject;
dpiJsonArray asJsonArray;
dpiLob *asLOB;
dpiObject *asObject;
dpiStmt *asStmt;
dpiRowid *asRowid;
dpiVector *asVector;
};
// structure used for annotations
struct dpiAnnotation {
const char *key;
uint32_t keyLength;
const char *value;
uint32_t valueLength;
};
// structure used for application context
struct dpiAppContext {
const char *namespaceName;
uint32_t namespaceNameLength;
const char *name;
uint32_t nameLength;
const char *value;
uint32_t valueLength;
};
// structure used for common parameters used for creating standalone
// connections and session pools
struct dpiCommonCreateParams {
dpiCreateMode createMode;
const char *encoding;
const char *nencoding;
const char *edition;
uint32_t editionLength;
const char *driverName;
uint32_t driverNameLength;
int sodaMetadataCache;
uint32_t stmtCacheSize;
dpiAccessToken *accessToken;
};
// structure used for creating connections
struct dpiConnCreateParams {
dpiAuthMode authMode;
const char *connectionClass;
uint32_t connectionClassLength;
dpiPurity purity;
const char *newPassword;
uint32_t newPasswordLength;
dpiAppContext *appContext;
uint32_t numAppContext;
int externalAuth;
void *externalHandle;
dpiPool *pool;
const char *tag;
uint32_t tagLength;
int matchAnyTag;
const char *outTag;
uint32_t outTagLength;
int outTagFound;
dpiShardingKeyColumn *shardingKeyColumns;
uint8_t numShardingKeyColumns;
dpiShardingKeyColumn *superShardingKeyColumns;
uint8_t numSuperShardingKeyColumns;
int outNewSession;
};
// structure used for transferring connection information from ODPI-C
struct dpiConnInfo {
const char *dbDomain;
uint32_t dbDomainLength;
const char *dbName;
uint32_t dbNameLength;
const char *instanceName;
uint32_t instanceNameLength;
const char *serviceName;
uint32_t serviceNameLength;
uint32_t maxIdentifierLength;
uint32_t maxOpenCursors;
uint8_t serverType;
};
// structure used for creating a context
struct dpiContextCreateParams {
const char *defaultDriverName;
const char *defaultEncoding;
const char *loadErrorUrl;
const char *oracleClientLibDir;
const char *oracleClientConfigDir;
int sodaUseJsonDesc;
int useJsonId;
};
// structure used for transferring data to/from ODPI-C
struct dpiData {
int isNull;
dpiDataBuffer value;
};
// structure used for providing metadata about data types
struct dpiDataTypeInfo {
dpiOracleTypeNum oracleTypeNum;
dpiNativeTypeNum defaultNativeTypeNum;
uint16_t ociTypeCode;
uint32_t dbSizeInBytes;
uint32_t clientSizeInBytes;
uint32_t sizeInChars;
int16_t precision;
int8_t scale;
uint8_t fsPrecision;
dpiObjectType *objectType;
int isJson;
const char *domainSchema;
uint32_t domainSchemaLength;
const char *domainName;
uint32_t domainNameLength;
uint32_t numAnnotations;
dpiAnnotation *annotations;
int isOson;
uint32_t vectorDimensions;
uint8_t vectorFormat;
uint8_t vectorFlags;
};
// structure used for storing token authentication data
struct dpiAccessToken {
const char *token;
uint32_t tokenLength;
const char *privateKey;
uint32_t privateKeyLength;
};
// structure used for transferring encoding information from ODPI-C
struct dpiEncodingInfo {
const char *encoding;
int32_t maxBytesPerCharacter;
const char *nencoding;
int32_t nmaxBytesPerCharacter;
};
// structure used for transferring error information from ODPI-C
struct dpiErrorInfo {
int32_t code;
uint16_t offset16;
const char *message;
uint32_t messageLength;
const char *encoding;
const char *fnName;
const char *action;
const char *sqlState;
int isRecoverable;
int isWarning;
uint32_t offset;
};
// structure used for transferring object attribute information from ODPI-C
struct dpiObjectAttrInfo {
const char *name;
uint32_t nameLength;
dpiDataTypeInfo typeInfo;
};
// structure used for transferring object type information from ODPI-C
struct dpiObjectTypeInfo {
const char *schema;
uint32_t schemaLength;
const char *name;
uint32_t nameLength;
int isCollection;
dpiDataTypeInfo elementTypeInfo;
uint16_t numAttributes;
const char *packageName;
uint32_t packageNameLength;
};
// structure used for creating pools
struct dpiPoolCreateParams {
uint32_t minSessions;
uint32_t maxSessions;
uint32_t sessionIncrement;
int pingInterval;
int pingTimeout;
int homogeneous;
int externalAuth;
dpiPoolGetMode getMode;
const char *outPoolName;
uint32_t outPoolNameLength;
uint32_t timeout;
uint32_t waitTimeout;
uint32_t maxLifetimeSession;
const char *plsqlFixupCallback;
uint32_t plsqlFixupCallbackLength;
uint32_t maxSessionsPerShard;
dpiAccessTokenCallback accessTokenCallback;
void *accessTokenCallbackContext;
};
// structure used for transferring query metadata from ODPI-C
struct dpiQueryInfo {
const char *name;
uint32_t nameLength;
dpiDataTypeInfo typeInfo;
int nullOk;
};
// structure used for recipients list
struct dpiMsgRecipient {
const char *name;
uint32_t nameLength;
};
// structure used for sharding key columns
struct dpiShardingKeyColumn {
dpiOracleTypeNum oracleTypeNum;
dpiNativeTypeNum nativeTypeNum;
dpiDataBuffer value;
};
// structure used for getting an array of strings from the database; the unions
// are for aliases for the names used when the structure was called
// dpiSodaCollNames instead
struct dpiStringList {
union {
uint32_t numStrings;
uint32_t numNames;
};
union {
const char **strings;
const char **names;
};
union {
uint32_t *stringLengths;
uint32_t *nameLengths;
};
};
// structure used for SODA operations (find/replace/remove)
struct dpiSodaOperOptions {
uint32_t numKeys;
const char **keys;
uint32_t *keyLengths;
const char *key;
uint32_t keyLength;
const char *version;
uint32_t versionLength;
const char *filter;
uint32_t filterLength;
uint32_t skip;
uint32_t limit;
uint32_t fetchArraySize;
const char *hint;
uint32_t hintLength;
int lock;
};
// structure used for transferring statement information from ODPI-C
struct dpiStmtInfo {
int isQuery;
int isPLSQL;
int isDDL;
int isDML;
dpiStatementType statementType;
int isReturning;
};
// callback for subscriptions
typedef void (*dpiSubscrCallback)(void* context, dpiSubscrMessage *message);
// structure used for creating subscriptions
struct dpiSubscrCreateParams {
dpiSubscrNamespace subscrNamespace;
dpiSubscrProtocol protocol;
dpiSubscrQOS qos;
dpiOpCode operations;
uint32_t portNumber;
uint32_t timeout;
const char *name;
uint32_t nameLength;
dpiSubscrCallback callback;
void *callbackContext;
const char *recipientName;
uint32_t recipientNameLength;
const char *ipAddress;
uint32_t ipAddressLength;
uint8_t groupingClass;
uint32_t groupingValue;
uint8_t groupingType;
uint64_t outRegId;
int clientInitiated;
};
// structure used for transferring messages in subscription callbacks
struct dpiSubscrMessage {
dpiEventType eventType;
const char *dbName;
uint32_t dbNameLength;
dpiSubscrMessageTable *tables;
uint32_t numTables;
dpiSubscrMessageQuery *queries;
uint32_t numQueries;
dpiErrorInfo *errorInfo;
const void *txId;
uint32_t txIdLength;
int registered;
const char *queueName;
uint32_t queueNameLength;
const char *consumerName;
uint32_t consumerNameLength;
const void *aqMsgId;
uint32_t aqMsgIdLength;
};
// structure used for transferring query information in messages in
// subscription callbacks (continuous query notification)
struct dpiSubscrMessageQuery {
uint64_t id;
dpiOpCode operation;
dpiSubscrMessageTable *tables;
uint32_t numTables;
};
// structure used for transferring row information in messages in
// subscription callbacks
struct dpiSubscrMessageRow {
dpiOpCode operation;
const char *rowid;
uint32_t rowidLength;
};
// structure used for transferring table information in messages in
// subscription callbacks
struct dpiSubscrMessageTable {
dpiOpCode operation;
const char *name;
uint32_t nameLength;
dpiSubscrMessageRow *rows;
uint32_t numRows;
};
// structure used for transferring version information
struct dpiVersionInfo {
int versionNum;
int releaseNum;
int updateNum;
int portReleaseNum;
int portUpdateNum;
uint32_t fullVersionNum;
};
// union used for providing a buffer for vector dimensions
union dpiVectorDimensionBuffer {
void* asPtr;
int8_t* asInt8;
float* asFloat;
double* asDouble;
};
// structure used for transferring vector information
struct dpiVectorInfo {
uint8_t format;
uint32_t numDimensions;
uint8_t dimensionSize;
dpiVectorDimensionBuffer dimensions;
};
// structure used for defining two-phase commit transaction ids (XIDs)
struct dpiXid {
long formatId;
const char *globalTransactionId;
uint32_t globalTransactionIdLength;
const char *branchQualifier;
uint32_t branchQualifierLength;
};
//-----------------------------------------------------------------------------
// Context Methods (dpiContext)
//-----------------------------------------------------------------------------
// define macro for backwards compatibility
#define dpiContext_create(majorVersion, minorVersion, context, errorInfo) \
dpiContext_createWithParams(majorVersion, minorVersion, NULL, context, \
errorInfo)
// create a context handle and validate the version information (with params)
DPI_EXPORT int dpiContext_createWithParams(unsigned int majorVersion,
unsigned int minorVersion, dpiContextCreateParams *params,
dpiContext **context, dpiErrorInfo *errorInfo);
// destroy context handle
DPI_EXPORT int dpiContext_destroy(dpiContext *context);
// free string list contents
DPI_EXPORT int dpiContext_freeStringList(dpiContext *context,
dpiStringList *list);
// return the OCI client version in use
DPI_EXPORT int dpiContext_getClientVersion(const dpiContext *context,
dpiVersionInfo *versionInfo);
// get error information
DPI_EXPORT void dpiContext_getError(const dpiContext *context,
dpiErrorInfo *errorInfo);
// initialize context parameters to default values
DPI_EXPORT int dpiContext_initCommonCreateParams(const dpiContext *context,
dpiCommonCreateParams *params);
// initialize connection create parameters to default values
DPI_EXPORT int dpiContext_initConnCreateParams(const dpiContext *context,
dpiConnCreateParams *params);
// initialize pool create parameters to default values
DPI_EXPORT int dpiContext_initPoolCreateParams(const dpiContext *context,
dpiPoolCreateParams *params);
// initialize SODA operation options to default values
DPI_EXPORT int dpiContext_initSodaOperOptions(const dpiContext *context,
dpiSodaOperOptions *options);
// initialize subscription create parameters to default values
DPI_EXPORT int dpiContext_initSubscrCreateParams(const dpiContext *context,