oracledb 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +174 -54
- package/LICENSE.md +52 -18
- package/README.md +35 -68
- package/binding.gyp +5 -4
- package/lib/connection.js +164 -14
- package/lib/oracledb.js +160 -11
- package/lib/pool.js +33 -22
- package/lib/querystream.js +3 -2
- package/lib/rel.txt +1 -1
- package/odpi/LICENSE.md +1 -1
- package/odpi/README.md +25 -84
- package/odpi/embed/README.md +1 -1
- package/odpi/include/dpi.h +51 -7
- package/odpi/src/dpiConn.c +78 -9
- package/odpi/src/dpiContext.c +24 -10
- package/odpi/src/dpiEnv.c +5 -1
- package/odpi/src/dpiError.c +4 -0
- package/odpi/src/dpiErrorMessages.h +6 -4
- package/odpi/src/dpiImpl.h +125 -68
- package/odpi/src/dpiMsgProps.c +33 -0
- package/odpi/src/dpiObject.c +17 -10
- package/odpi/src/dpiObjectType.c +1 -1
- package/odpi/src/dpiOci.c +55 -40
- package/odpi/src/dpiOracleType.c +2 -2
- package/odpi/src/dpiPool.c +88 -18
- package/odpi/src/dpiStmt.c +57 -36
- package/odpi/src/dpiSubscr.c +117 -9
- package/odpi/src/dpiUtils.c +20 -9
- package/odpi/src/dpiVar.c +504 -430
- package/package/MAKEPKG.BAT +64 -1
- package/package/README.md +9 -5
- package/package/createpackage.js +2 -2
- package/package/extractpackage.js +2 -1
- package/package/oracledbinstall.js +19 -19
- package/package/package.json +4 -4
- package/package.json +4 -4
- package/src/njsCommon.cpp +94 -10
- package/src/njsCommon.h +73 -21
- package/src/njsConnection.cpp +1425 -458
- package/src/njsConnection.h +68 -19
- package/src/njsIntLob.cpp +5 -1
- package/src/njsIntLob.h +1 -1
- package/src/njsMessages.cpp +9 -2
- package/src/njsMessages.h +9 -2
- package/src/njsOracle.cpp +213 -23
- package/src/njsOracle.h +18 -2
- package/src/njsPool.cpp +32 -14
- package/src/njsPool.h +4 -4
- package/src/njsResultSet.cpp +4 -3
- package/src/njsResultSet.h +1 -1
- package/src/njsSubscription.cpp +388 -0
- package/src/njsSubscription.h +111 -0
package/odpi/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ODPI-C version 2.
|
|
1
|
+
# ODPI-C version 2.4
|
|
2
2
|
|
|
3
3
|
Oracle Database Programming Interface for C (ODPI-C) is an open source library
|
|
4
4
|
of C code that simplifies access to Oracle Database for applications written in
|
|
@@ -6,110 +6,51 @@ C or C++. It is a wrapper over [Oracle Call Interface
|
|
|
6
6
|
(OCI)](http://www.oracle.com/technetwork/database/features/oci/index.html) that
|
|
7
7
|
makes applications and language interfaces easier to develop.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
- Dates, Timestamps, Intervals
|
|
17
|
-
- Binary types (BLOB, BFILE, RAW, LONG RAW)
|
|
18
|
-
- PL/SQL datatypes (PLS_INTEGER, BOOLEAN, Collections, Records)
|
|
19
|
-
- JSON
|
|
20
|
-
- User Defined Types
|
|
21
|
-
- REF CURSOR, Nested cursors, Implicit Result Sets
|
|
22
|
-
- Array fetch
|
|
23
|
-
- Array bind/execute
|
|
24
|
-
- Batch errors
|
|
25
|
-
- Array DML Row Counts
|
|
26
|
-
- Scrollable cursors
|
|
27
|
-
- DML RETURNING
|
|
28
|
-
- Query Result Caching
|
|
29
|
-
- Statement caching (with tagging)
|
|
30
|
-
- Query metadata
|
|
31
|
-
- Standalone connections
|
|
32
|
-
- Pooled connections via OCI session pools (Homogeneous and non-homogeneous with proxy authentication)
|
|
33
|
-
- Database Resident Connection Pooling (DRCP)
|
|
34
|
-
- External authentication
|
|
35
|
-
- Proxy authentication
|
|
36
|
-
- Privileged connection support (SYSDBA, SYSOPER, SYSASM, PRELIM_AUTH)
|
|
37
|
-
- Session tagging
|
|
38
|
-
- Connection validation (when acquired from session pool or DRCP)
|
|
39
|
-
- Password change
|
|
40
|
-
- End-to-end tracing, mid-tier authentication and auditing (action, module,
|
|
41
|
-
client identifier, client info, database operation)
|
|
42
|
-
- Edition Based Redefinition
|
|
43
|
-
- Database startup/shutdown
|
|
44
|
-
- Application Continuity
|
|
45
|
-
- Two Phase Commit
|
|
46
|
-
- Continuous Query Notification
|
|
47
|
-
- Advanced Queuing
|
|
48
|
-
- Sharded Databases
|
|
49
|
-
- Easily extensible via direct OCI calls
|
|
50
|
-
|
|
51
|
-
## Install
|
|
52
|
-
|
|
53
|
-
See
|
|
54
|
-
[ODPI-C Installation](https://oracle.github.io/odpi/doc/installation.html)
|
|
55
|
-
for detailed instructions.
|
|
56
|
-
|
|
57
|
-
A sample Makefile (Makefile.win32 for use with nmake on Windows) is provided if
|
|
58
|
-
you wish to build ODPI-C as a shared library. Otherwise, include the ODPI-C
|
|
59
|
-
source code in your project (see embed/dpi.c).
|
|
60
|
-
|
|
61
|
-
Oracle Client libraries are required. They are available in the free [Oracle
|
|
62
|
-
Instant
|
|
63
|
-
Client](http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html)
|
|
64
|
-
"Basic" and "Basic Light" packages, or available in any Oracle Database
|
|
65
|
-
installation or full Oracle Client installation.
|
|
66
|
-
|
|
67
|
-
ODPI-C uses the shared library loading mechanism available on each supported
|
|
68
|
-
platform to load the Oracle Client libraries at runtime. This allows code using
|
|
69
|
-
ODPI-C to be built only once, and then run using Oracle Client 11.2, 12.1 or
|
|
70
|
-
12.2 libraries. Oracle's standard client-server version interoperability allows
|
|
71
|
-
connection to both older and newer databases, for example Oracle 12.2 client
|
|
72
|
-
libraries can connect to Oracle Database 11.2 or later.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
ODPI-C has been tested on Linux, Windows and macOS. Other platforms should
|
|
76
|
-
also work but have not been tested. On Windows, Visual Studio 2008 or higher
|
|
77
|
-
is required. On macOS, Xcode 6 or higher is required. On Linux, GCC 4.4 or
|
|
78
|
-
higher is required.
|
|
9
|
+
ODPI-C supports basic and advanced features of Oracle Database and
|
|
10
|
+
Oracle Client. See the [homepage](https://oracle.github.io/odpi/) for
|
|
11
|
+
a list.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
See [ODPI-C Installation](https://oracle.github.io/odpi/doc/installation.html).
|
|
79
16
|
|
|
80
17
|
## Documentation
|
|
81
18
|
|
|
82
|
-
See [ODPI-C Documentation](https://oracle.github.io/odpi/doc/index.html) and
|
|
19
|
+
See the [ODPI-C Documentation](https://oracle.github.io/odpi/doc/index.html) and
|
|
83
20
|
[Release Notes](https://oracle.github.io/odpi/doc/releasenotes.html).
|
|
84
21
|
|
|
85
|
-
##
|
|
22
|
+
## Samples
|
|
86
23
|
|
|
87
|
-
|
|
24
|
+
See [/samples](https://github.com/oracle/odpi/tree/master/samples).
|
|
88
25
|
|
|
89
|
-
##
|
|
26
|
+
## Help
|
|
90
27
|
|
|
91
|
-
|
|
28
|
+
Please report bugs and ask questions using [GitHub issues](https://github.com/oracle/odpi/issues).
|
|
92
29
|
|
|
93
30
|
## Tests
|
|
94
31
|
|
|
95
|
-
See [/test](https://github.com/oracle/odpi/tree/master/test)
|
|
32
|
+
See [/test](https://github.com/oracle/odpi/tree/master/test).
|
|
96
33
|
|
|
97
34
|
## Contributing
|
|
98
35
|
|
|
99
|
-
See [CONTRIBUTING](https://github.com/oracle/odpi/blob/master/CONTRIBUTING.md)
|
|
36
|
+
See [CONTRIBUTING](https://github.com/oracle/odpi/blob/master/CONTRIBUTING.md).
|
|
100
37
|
|
|
101
38
|
## Drivers Using ODPI-C
|
|
102
39
|
|
|
103
|
-
Drivers
|
|
104
|
-
* [cx_Oracle](https://oracle.github.io/python-cx_Oracle)
|
|
105
|
-
* [node-oracledb](https://github.
|
|
106
|
-
Node.js.
|
|
40
|
+
Oracle Drivers:
|
|
41
|
+
* [cx_Oracle](https://oracle.github.io/python-cx_Oracle) Python interface.
|
|
42
|
+
* [node-oracledb](https://oracle.github.io/node-oracledb) Node.js module.
|
|
107
43
|
|
|
108
|
-
|
|
44
|
+
Third-party Drivers:
|
|
45
|
+
* [go-goracle](https://gopkg.in/goracle.v2) Go Driver.
|
|
46
|
+
* [mirmir](https://github.com/rustyhorde/mimir) Rust Bindings.
|
|
47
|
+
* [odpic-raw](https://github.com/leptonyu/odpic-raw) Haskell Raw Bindings.
|
|
48
|
+
* [ruby-ODPI ](https://github.com/kubo/ruby-odpi) Ruby Interface.
|
|
49
|
+
* [rust-oracle ](https://github.com/kubo/rust-oracle) Driver for Rust.
|
|
109
50
|
|
|
110
51
|
## License
|
|
111
52
|
|
|
112
|
-
Copyright (c) 2016,
|
|
53
|
+
Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved.
|
|
113
54
|
|
|
114
55
|
This program is free software: you can modify it and/or redistribute it under
|
|
115
56
|
the terms of:
|
package/odpi/embed/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
This directory contains the file dpi.c which can be used to embed ODPI-C
|
|
2
2
|
within your project without having to manage the individual files that make up
|
|
3
|
-
the library. The files can also be compiled independently
|
|
3
|
+
the library. The files can also be compiled independently if that is preferred.
|
|
4
4
|
|
package/odpi/include/dpi.h
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
// define ODPI-C version information
|
|
46
46
|
#define DPI_MAJOR_VERSION 2
|
|
47
|
-
#define DPI_MINOR_VERSION
|
|
47
|
+
#define DPI_MINOR_VERSION 4
|
|
48
48
|
#define DPI_PATCH_LEVEL 0
|
|
49
49
|
#define DPI_VERSION_SUFFIX
|
|
50
50
|
|
|
@@ -159,7 +159,8 @@ typedef enum {
|
|
|
159
159
|
DPI_EVENT_DROP_DB = 4, // OCI_EVENT_DROP_DB
|
|
160
160
|
DPI_EVENT_DEREG = 5, // OCI_EVENT_DEREG
|
|
161
161
|
DPI_EVENT_OBJCHANGE = 6, // OCI_EVENT_OBJCHANGE
|
|
162
|
-
DPI_EVENT_QUERYCHANGE = 7
|
|
162
|
+
DPI_EVENT_QUERYCHANGE = 7, // OCI_EVENT_QUERYCHANGE
|
|
163
|
+
DPI_EVENT_AQ = 100
|
|
163
164
|
} dpiEventType;
|
|
164
165
|
|
|
165
166
|
// statement execution modes
|
|
@@ -268,7 +269,8 @@ typedef enum {
|
|
|
268
269
|
typedef enum {
|
|
269
270
|
DPI_MODE_POOL_GET_WAIT = 0, // OCI_SPOOL_ATTRVAL_WAIT
|
|
270
271
|
DPI_MODE_POOL_GET_NOWAIT = 1, // OCI_SPOOL_ATTRVAL_NOWAIT
|
|
271
|
-
DPI_MODE_POOL_GET_FORCEGET = 2
|
|
272
|
+
DPI_MODE_POOL_GET_FORCEGET = 2, // OCI_SPOOL_ATTRVAL_FORCEGET
|
|
273
|
+
DPI_MODE_POOL_GET_TIMEDWAIT = 3 // OCI_SPOOL_ATTRVAL_TIMEDWAIT
|
|
272
274
|
} dpiPoolGetMode;
|
|
273
275
|
|
|
274
276
|
// purity values when acquiring a connection from a pool
|
|
@@ -297,6 +299,7 @@ typedef enum {
|
|
|
297
299
|
|
|
298
300
|
// statement types
|
|
299
301
|
typedef enum {
|
|
302
|
+
DPI_STMT_TYPE_UNKNOWN = 0,
|
|
300
303
|
DPI_STMT_TYPE_SELECT = 1, // OCI_STMT_SELECT
|
|
301
304
|
DPI_STMT_TYPE_UPDATE = 2, // OCI_STMT_UPDATE
|
|
302
305
|
DPI_STMT_TYPE_DELETE = 3, // OCI_STMT_DELETE
|
|
@@ -307,12 +310,23 @@ typedef enum {
|
|
|
307
310
|
DPI_STMT_TYPE_BEGIN = 8, // OCI_STMT_BEGIN
|
|
308
311
|
DPI_STMT_TYPE_DECLARE = 9, // OCI_STMT_DECLARE
|
|
309
312
|
DPI_STMT_TYPE_CALL = 10, // OCI_STMT_CALL
|
|
310
|
-
|
|
313
|
+
DPI_STMT_TYPE_EXPLAIN_PLAN = 15,
|
|
314
|
+
DPI_STMT_TYPE_MERGE = 16, // OCI_STMT_MERGE
|
|
315
|
+
DPI_STMT_TYPE_ROLLBACK = 17,
|
|
316
|
+
DPI_STMT_TYPE_COMMIT = 21
|
|
311
317
|
} dpiStatementType;
|
|
312
318
|
|
|
319
|
+
// subscription grouping classes
|
|
320
|
+
#define DPI_SUBSCR_GROUPING_CLASS_TIME 1
|
|
321
|
+
|
|
322
|
+
// subscription grouping types
|
|
323
|
+
#define DPI_SUBSCR_GROUPING_TYPE_SUMMARY 1
|
|
324
|
+
#define DPI_SUBSCR_GROUPING_TYPE_LAST 2
|
|
325
|
+
|
|
313
326
|
// subscription namespaces
|
|
314
327
|
typedef enum {
|
|
315
|
-
|
|
328
|
+
DPI_SUBSCR_NAMESPACE_AQ = 1, // OCI_SUBSCR_NAMESPACE_AQ
|
|
329
|
+
DPI_SUBSCR_NAMESPACE_DBCHANGE = 2 // OCI_SUBSCR_NAMESPACE_DBCHANGE
|
|
316
330
|
} dpiSubscrNamespace;
|
|
317
331
|
|
|
318
332
|
// subscription protocols
|
|
@@ -558,6 +572,9 @@ struct dpiPoolCreateParams {
|
|
|
558
572
|
dpiPoolGetMode getMode;
|
|
559
573
|
const char *outPoolName;
|
|
560
574
|
uint32_t outPoolNameLength;
|
|
575
|
+
uint32_t timeout;
|
|
576
|
+
uint32_t waitTimeout;
|
|
577
|
+
uint32_t maxLifetimeSession;
|
|
561
578
|
};
|
|
562
579
|
|
|
563
580
|
// structure used for transferring query metadata from ODPI-C
|
|
@@ -602,6 +619,11 @@ struct dpiSubscrCreateParams {
|
|
|
602
619
|
void *callbackContext;
|
|
603
620
|
const char *recipientName;
|
|
604
621
|
uint32_t recipientNameLength;
|
|
622
|
+
const char *ipAddress;
|
|
623
|
+
uint32_t ipAddressLength;
|
|
624
|
+
uint8_t groupingClass;
|
|
625
|
+
uint32_t groupingValue;
|
|
626
|
+
uint8_t groupingType;
|
|
605
627
|
};
|
|
606
628
|
|
|
607
629
|
// structure used for transferring messages in subscription callbacks
|
|
@@ -616,6 +638,11 @@ struct dpiSubscrMessage {
|
|
|
616
638
|
dpiErrorInfo *errorInfo;
|
|
617
639
|
const void *txId;
|
|
618
640
|
uint32_t txIdLength;
|
|
641
|
+
int registered;
|
|
642
|
+
const char *queueName;
|
|
643
|
+
uint32_t queueNameLength;
|
|
644
|
+
const char *consumerName;
|
|
645
|
+
uint32_t consumerNameLength;
|
|
619
646
|
};
|
|
620
647
|
|
|
621
648
|
// structure used for transferring query information in messages in
|
|
@@ -849,6 +876,13 @@ int dpiConn_shutdownDatabase(dpiConn *conn, dpiShutdownMode mode);
|
|
|
849
876
|
// startup the database
|
|
850
877
|
int dpiConn_startupDatabase(dpiConn *conn, dpiStartupMode mode);
|
|
851
878
|
|
|
879
|
+
// subscribe to events in the database
|
|
880
|
+
int dpiConn_subscribe(dpiConn *conn, dpiSubscrCreateParams *params,
|
|
881
|
+
dpiSubscr **subscr);
|
|
882
|
+
|
|
883
|
+
// unsubscribe from events in the database
|
|
884
|
+
int dpiConn_unsubscribe(dpiConn *conn, dpiSubscr *subscr);
|
|
885
|
+
|
|
852
886
|
|
|
853
887
|
//-----------------------------------------------------------------------------
|
|
854
888
|
// Data Methods (dpiData)
|
|
@@ -1312,6 +1346,9 @@ int dpiPool_getStmtCacheSize(dpiPool *pool, uint32_t *cacheSize);
|
|
|
1312
1346
|
// get the pool's timeout value
|
|
1313
1347
|
int dpiPool_getTimeout(dpiPool *pool, uint32_t *value);
|
|
1314
1348
|
|
|
1349
|
+
// get the pool's wait timeout value
|
|
1350
|
+
int dpiPool_getWaitTimeout(dpiPool *pool, uint32_t *value);
|
|
1351
|
+
|
|
1315
1352
|
// release a reference to the pool
|
|
1316
1353
|
int dpiPool_release(dpiPool *pool);
|
|
1317
1354
|
|
|
@@ -1327,6 +1364,9 @@ int dpiPool_setStmtCacheSize(dpiPool *pool, uint32_t cacheSize);
|
|
|
1327
1364
|
// set the pool's timeout value
|
|
1328
1365
|
int dpiPool_setTimeout(dpiPool *pool, uint32_t value);
|
|
1329
1366
|
|
|
1367
|
+
// set the pool's wait timeout value
|
|
1368
|
+
int dpiPool_setWaitTimeout(dpiPool *pool, uint32_t value);
|
|
1369
|
+
|
|
1330
1370
|
|
|
1331
1371
|
//-----------------------------------------------------------------------------
|
|
1332
1372
|
// Statement Methods (dpiStmt)
|
|
@@ -1485,13 +1525,17 @@ int dpiVar_addRef(dpiVar *var);
|
|
|
1485
1525
|
int dpiVar_copyData(dpiVar *var, uint32_t pos, dpiVar *sourceVar,
|
|
1486
1526
|
uint32_t sourcePos);
|
|
1487
1527
|
|
|
1488
|
-
//
|
|
1489
|
-
// this is needed for DML returning where the number of elements is modified
|
|
1528
|
+
// deprecated: use dpiVar_getReturnedData() instead
|
|
1490
1529
|
int dpiVar_getData(dpiVar *var, uint32_t *numElements, dpiData **data);
|
|
1491
1530
|
|
|
1492
1531
|
// return the number of elements in a PL/SQL index-by table
|
|
1493
1532
|
int dpiVar_getNumElementsInArray(dpiVar *var, uint32_t *numElements);
|
|
1494
1533
|
|
|
1534
|
+
// return pointer to array of dpiData structures for transferring data
|
|
1535
|
+
// this is needed for DML returning where the number of elements is modified
|
|
1536
|
+
int dpiVar_getReturnedData(dpiVar *var, uint32_t pos, uint32_t *numElements,
|
|
1537
|
+
dpiData **data);
|
|
1538
|
+
|
|
1495
1539
|
// return the size in bytes of the buffer used for fetching/binding
|
|
1496
1540
|
int dpiVar_getSizeInBytes(dpiVar *var, uint32_t *sizeInBytes);
|
|
1497
1541
|
|
package/odpi/src/dpiConn.c
CHANGED
|
@@ -416,7 +416,11 @@ static int dpiConn__get(dpiConn *conn, const char *userName,
|
|
|
416
416
|
externalAuth = pool->externalAuth;
|
|
417
417
|
if (userName && pool->homogeneous)
|
|
418
418
|
return dpiError__set(error, "check proxy", DPI_ERR_INVALID_PROXY);
|
|
419
|
-
|
|
419
|
+
|
|
420
|
+
// if the userName is provided but no password is provided and external
|
|
421
|
+
// authentication is not being used, proxy authentication is taking
|
|
422
|
+
// place
|
|
423
|
+
if (userName && !password && !externalAuth)
|
|
420
424
|
mode |= DPI_OCI_SESSGET_CREDPROXY;
|
|
421
425
|
if (createParams->matchAnyTag)
|
|
422
426
|
mode |= DPI_OCI_SESSGET_SPOOL_MATCHANY;
|
|
@@ -1168,7 +1172,6 @@ int dpiConn_create(const dpiContext *context, const char *userName,
|
|
|
1168
1172
|
dpiCommonCreateParams localCommonParams;
|
|
1169
1173
|
dpiConnCreateParams localCreateParams;
|
|
1170
1174
|
dpiConn *tempConn;
|
|
1171
|
-
size_t structSize;
|
|
1172
1175
|
dpiError error;
|
|
1173
1176
|
int status;
|
|
1174
1177
|
|
|
@@ -1187,10 +1190,10 @@ int dpiConn_create(const dpiContext *context, const char *userName,
|
|
|
1187
1190
|
commonParams = &localCommonParams;
|
|
1188
1191
|
}
|
|
1189
1192
|
if (!createParams || context->dpiMinorVersion == 0) {
|
|
1190
|
-
dpiContext__initConnCreateParams(
|
|
1191
|
-
&structSize);
|
|
1193
|
+
dpiContext__initConnCreateParams(&localCreateParams);
|
|
1192
1194
|
if (createParams)
|
|
1193
|
-
memcpy(&localCreateParams, createParams,
|
|
1195
|
+
memcpy(&localCreateParams, createParams,
|
|
1196
|
+
sizeof(dpiConnCreateParams__v20));
|
|
1194
1197
|
createParams = &localCreateParams;
|
|
1195
1198
|
}
|
|
1196
1199
|
|
|
@@ -1213,6 +1216,14 @@ int dpiConn_create(const dpiContext *context, const char *userName,
|
|
|
1213
1216
|
return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
|
|
1214
1217
|
}
|
|
1215
1218
|
|
|
1219
|
+
// newPassword and edition cannot be specified at the same time
|
|
1220
|
+
if (createParams->newPassword && createParams->newPasswordLength > 0 &&
|
|
1221
|
+
commonParams->edition && commonParams->editionLength > 0) {
|
|
1222
|
+
dpiError__set(&error, "check edition/new password",
|
|
1223
|
+
DPI_ERR_NO_EDITION_WITH_NEW_PASSWORD);
|
|
1224
|
+
return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1216
1227
|
// handle case where pool is specified
|
|
1217
1228
|
if (createParams->pool) {
|
|
1218
1229
|
if (dpiGen__checkHandle(createParams->pool, DPI_HTYPE_POOL,
|
|
@@ -1285,8 +1296,9 @@ int dpiConn_deqObject(dpiConn *conn, const char *queueName,
|
|
|
1285
1296
|
}
|
|
1286
1297
|
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1287
1298
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1299
|
+
if (dpiMsgProps__extractMsgId(props, ociMsgId, msgId, msgIdLength,
|
|
1300
|
+
&error) < 0)
|
|
1301
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1290
1302
|
return dpiGen__endPublicFn(conn, DPI_SUCCESS, &error);
|
|
1291
1303
|
}
|
|
1292
1304
|
|
|
@@ -1323,8 +1335,9 @@ int dpiConn_enqObject(dpiConn *conn, const char *queueName,
|
|
|
1323
1335
|
payload->type->tdo, &payload->instance, &payload->indicator,
|
|
1324
1336
|
&ociMsgId, &error) < 0)
|
|
1325
1337
|
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1326
|
-
|
|
1327
|
-
|
|
1338
|
+
if (dpiMsgProps__extractMsgId(props, ociMsgId, msgId, msgIdLength,
|
|
1339
|
+
&error) < 0)
|
|
1340
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1328
1341
|
return dpiGen__endPublicFn(conn, DPI_SUCCESS, &error);
|
|
1329
1342
|
}
|
|
1330
1343
|
|
|
@@ -1932,3 +1945,59 @@ int dpiConn_startupDatabase(dpiConn *conn, dpiStartupMode mode)
|
|
|
1932
1945
|
return dpiGen__endPublicFn(conn, status, &error);
|
|
1933
1946
|
}
|
|
1934
1947
|
|
|
1948
|
+
//-----------------------------------------------------------------------------
|
|
1949
|
+
// dpiConn_subscribe() [PUBLIC]
|
|
1950
|
+
// Subscribe to events in the database. A subscription is created and
|
|
1951
|
+
// returned. This replaces dpiConn_newSubscription().
|
|
1952
|
+
//-----------------------------------------------------------------------------
|
|
1953
|
+
int dpiConn_subscribe(dpiConn *conn, dpiSubscrCreateParams *params,
|
|
1954
|
+
dpiSubscr **subscr)
|
|
1955
|
+
{
|
|
1956
|
+
dpiSubscr *tempSubscr;
|
|
1957
|
+
dpiError error;
|
|
1958
|
+
|
|
1959
|
+
if (dpiConn__checkConnected(conn, __func__, &error) < 0)
|
|
1960
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1961
|
+
DPI_CHECK_PTR_NOT_NULL(conn, params)
|
|
1962
|
+
DPI_CHECK_PTR_NOT_NULL(conn, subscr)
|
|
1963
|
+
if (!conn->env->events) {
|
|
1964
|
+
dpiError__set(&error, "subscribe", DPI_ERR_EVENTS_MODE_REQUIRED);
|
|
1965
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1966
|
+
}
|
|
1967
|
+
if (dpiGen__allocate(DPI_HTYPE_SUBSCR, conn->env, (void**) &tempSubscr,
|
|
1968
|
+
&error) < 0)
|
|
1969
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1970
|
+
if (dpiSubscr__create(tempSubscr, conn, params, NULL, &error) < 0) {
|
|
1971
|
+
dpiSubscr__free(tempSubscr, &error);
|
|
1972
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
*subscr = tempSubscr;
|
|
1976
|
+
return dpiGen__endPublicFn(conn, DPI_SUCCESS, &error);
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
//-----------------------------------------------------------------------------
|
|
1981
|
+
// dpiConn_unsubscribe() [PUBLIC]
|
|
1982
|
+
// Unsubscribe from events in the database. Once this call completes
|
|
1983
|
+
// successfully no further notifications will be sent.
|
|
1984
|
+
//-----------------------------------------------------------------------------
|
|
1985
|
+
int dpiConn_unsubscribe(dpiConn *conn, dpiSubscr *subscr)
|
|
1986
|
+
{
|
|
1987
|
+
dpiError error;
|
|
1988
|
+
|
|
1989
|
+
if (dpiConn__checkConnected(conn, __func__, &error) < 0)
|
|
1990
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1991
|
+
if (dpiGen__checkHandle(subscr, DPI_HTYPE_SUBSCR, "check subscription",
|
|
1992
|
+
&error) < 0)
|
|
1993
|
+
return dpiGen__endPublicFn(conn, DPI_FAILURE, &error);
|
|
1994
|
+
if (subscr->registered) {
|
|
1995
|
+
if (dpiOci__subscriptionUnRegister(conn, subscr, &error) < 0)
|
|
1996
|
+
return dpiGen__endPublicFn(subscr, DPI_FAILURE, &error);
|
|
1997
|
+
subscr->registered = 0;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
dpiGen__setRefCount(subscr, &error, -1);
|
|
2001
|
+
return dpiGen__endPublicFn(subscr, DPI_SUCCESS, &error);
|
|
2002
|
+
}
|
|
2003
|
+
|
package/odpi/src/dpiContext.c
CHANGED
|
@@ -77,13 +77,9 @@ void dpiContext__initCommonCreateParams(dpiCommonCreateParams *params)
|
|
|
77
77
|
// the structure size as a convenience for calling functions which may have to
|
|
78
78
|
// differentiate between different ODPI-C application versions.
|
|
79
79
|
//-----------------------------------------------------------------------------
|
|
80
|
-
void dpiContext__initConnCreateParams(
|
|
81
|
-
dpiConnCreateParams *params, size_t *structSize)
|
|
80
|
+
void dpiContext__initConnCreateParams(dpiConnCreateParams *params)
|
|
82
81
|
{
|
|
83
|
-
|
|
84
|
-
if (context->dpiMinorVersion == 0)
|
|
85
|
-
*structSize = sizeof(dpiConnCreateParams__v20);
|
|
86
|
-
memset(params, 0, *structSize);
|
|
82
|
+
memset(params, 0, sizeof(dpiConnCreateParams));
|
|
87
83
|
}
|
|
88
84
|
|
|
89
85
|
|
|
@@ -112,6 +108,7 @@ void dpiContext__initSubscrCreateParams(dpiSubscrCreateParams *params)
|
|
|
112
108
|
{
|
|
113
109
|
memset(params, 0, sizeof(dpiSubscrCreateParams));
|
|
114
110
|
params->subscrNamespace = DPI_SUBSCR_NAMESPACE_DBCHANGE;
|
|
111
|
+
params->groupingType = DPI_SUBSCR_GROUPING_TYPE_SUMMARY;
|
|
115
112
|
}
|
|
116
113
|
|
|
117
114
|
|
|
@@ -223,14 +220,19 @@ int dpiContext_initCommonCreateParams(const dpiContext *context,
|
|
|
223
220
|
int dpiContext_initConnCreateParams(const dpiContext *context,
|
|
224
221
|
dpiConnCreateParams *params)
|
|
225
222
|
{
|
|
226
|
-
|
|
223
|
+
dpiConnCreateParams localParams;
|
|
227
224
|
dpiError error;
|
|
228
225
|
|
|
229
226
|
if (dpiGen__startPublicFn(context, DPI_HTYPE_CONTEXT, __func__, 0,
|
|
230
227
|
&error) < 0)
|
|
231
228
|
return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
|
|
232
229
|
DPI_CHECK_PTR_NOT_NULL(context, params)
|
|
233
|
-
|
|
230
|
+
if (context->dpiMinorVersion > 0)
|
|
231
|
+
dpiContext__initConnCreateParams(params);
|
|
232
|
+
else {
|
|
233
|
+
dpiContext__initConnCreateParams(&localParams);
|
|
234
|
+
memcpy(params, &localParams, sizeof(dpiConnCreateParams__v20));
|
|
235
|
+
}
|
|
234
236
|
return dpiGen__endPublicFn(context, DPI_SUCCESS, &error);
|
|
235
237
|
}
|
|
236
238
|
|
|
@@ -242,13 +244,19 @@ int dpiContext_initConnCreateParams(const dpiContext *context,
|
|
|
242
244
|
int dpiContext_initPoolCreateParams(const dpiContext *context,
|
|
243
245
|
dpiPoolCreateParams *params)
|
|
244
246
|
{
|
|
247
|
+
dpiPoolCreateParams localParams;
|
|
245
248
|
dpiError error;
|
|
246
249
|
|
|
247
250
|
if (dpiGen__startPublicFn(context, DPI_HTYPE_CONTEXT, __func__, 0,
|
|
248
251
|
&error) < 0)
|
|
249
252
|
return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
|
|
250
253
|
DPI_CHECK_PTR_NOT_NULL(context, params)
|
|
251
|
-
|
|
254
|
+
if (context->dpiMinorVersion > 3)
|
|
255
|
+
dpiContext__initPoolCreateParams(params);
|
|
256
|
+
else {
|
|
257
|
+
dpiContext__initPoolCreateParams(&localParams);
|
|
258
|
+
memcpy(params, &localParams, sizeof(dpiPoolCreateParams__v23));
|
|
259
|
+
}
|
|
252
260
|
return dpiGen__endPublicFn(context, DPI_SUCCESS, &error);
|
|
253
261
|
}
|
|
254
262
|
|
|
@@ -260,13 +268,19 @@ int dpiContext_initPoolCreateParams(const dpiContext *context,
|
|
|
260
268
|
int dpiContext_initSubscrCreateParams(const dpiContext *context,
|
|
261
269
|
dpiSubscrCreateParams *params)
|
|
262
270
|
{
|
|
271
|
+
dpiSubscrCreateParams localParams;
|
|
263
272
|
dpiError error;
|
|
264
273
|
|
|
265
274
|
if (dpiGen__startPublicFn(context, DPI_HTYPE_CONTEXT, __func__, 0,
|
|
266
275
|
&error) < 0)
|
|
267
276
|
return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
|
|
268
277
|
DPI_CHECK_PTR_NOT_NULL(context, params)
|
|
269
|
-
|
|
278
|
+
if (context->dpiMinorVersion > 3)
|
|
279
|
+
dpiContext__initSubscrCreateParams(params);
|
|
280
|
+
else {
|
|
281
|
+
dpiContext__initSubscrCreateParams(&localParams);
|
|
282
|
+
memcpy(params, &localParams, sizeof(dpiSubscrCreateParams__v23));
|
|
283
|
+
}
|
|
270
284
|
return dpiGen__endPublicFn(context, DPI_SUCCESS, &error);
|
|
271
285
|
}
|
|
272
286
|
|
package/odpi/src/dpiEnv.c
CHANGED
|
@@ -153,9 +153,13 @@ int dpiEnv__init(dpiEnv *env, const dpiContext *context,
|
|
|
153
153
|
return DPI_FAILURE;
|
|
154
154
|
|
|
155
155
|
// set whether or not we are threaded
|
|
156
|
-
if (params->createMode &
|
|
156
|
+
if (params->createMode & DPI_MODE_CREATE_THREADED)
|
|
157
157
|
env->threaded = 1;
|
|
158
158
|
|
|
159
|
+
// set whether or not events mode has been set
|
|
160
|
+
if (params->createMode & DPI_MODE_CREATE_EVENTS)
|
|
161
|
+
env->events = 1;
|
|
162
|
+
|
|
159
163
|
return DPI_SUCCESS;
|
|
160
164
|
}
|
|
161
165
|
|
package/odpi/src/dpiError.c
CHANGED
|
@@ -38,6 +38,10 @@ int dpiError__check(dpiError *error, int status, dpiConn *conn,
|
|
|
38
38
|
return DPI_FAILURE;
|
|
39
39
|
else if (!error->handle)
|
|
40
40
|
return dpiError__set(error, action, DPI_ERR_ERR_NOT_INITIALIZED);
|
|
41
|
+
else if (status != DPI_OCI_ERROR && status != DPI_OCI_NO_DATA)
|
|
42
|
+
return dpiError__set(error, action,
|
|
43
|
+
DPI_ERR_UNEXPECTED_OCI_RETURN_VALUE, status,
|
|
44
|
+
error->buffer->fnName);
|
|
41
45
|
|
|
42
46
|
// fetch OCI error
|
|
43
47
|
error->buffer->action = action;
|
|
@@ -55,7 +55,6 @@ static const char* const dpiErrorMessages[DPI_ERR_MAX - DPI_ERR_NO_ERR] = {
|
|
|
55
55
|
"DPI-1035: size of the transaction ID is %u and cannot exceed %u", // DPI_ERR_TRANS_ID_TOO_LARGE
|
|
56
56
|
"DPI-1036: size of the branch ID is %u and cannot exceed %u", // DPI_ERR_BRANCH_ID_TOO_LARGE
|
|
57
57
|
"DPI-1037: column at array position %u fetched with error %u", // DPI_ERR_COLUMN_FETCH
|
|
58
|
-
"DPI-1038: Oracle client %u.%u cannot be used because ODPI-C was compiled with Oracle client %u.%u", // DPI_ERR_OCI_VERSION_NOT_SUPPORTED
|
|
59
58
|
"DPI-1039: statement was already closed", // DPI_ERR_STMT_CLOSED
|
|
60
59
|
"DPI-1040: LOB was already closed", // DPI_ERR_LOB_CLOSED
|
|
61
60
|
"DPI-1041: invalid character set id %d", // DPI_ERR_INVALID_CHARSET_ID
|
|
@@ -65,17 +64,20 @@ static const char* const dpiErrorMessages[DPI_ERR_MAX - DPI_ERR_NO_ERR] = {
|
|
|
65
64
|
"DPI-1045: strings converted to numbers can only be up to 172 characters long", // DPI_ERR_NUMBER_STRING_TOO_LONG
|
|
66
65
|
"DPI-1046: parameter %s cannot be a NULL pointer", // DPI_ERR_NULL_POINTER_PARAMETER
|
|
67
66
|
"DPI-1047: %s-bit Oracle Client library cannot be loaded: \"%s\". See https://oracle.github.io/odpi/doc/installation.html#%s for help", // DPI_ERR_LOAD_LIBRARY
|
|
68
|
-
"DPI-1048: unused 1", // DPI_ERR_UNUSED_1
|
|
69
67
|
"DPI-1049: symbol %s not found in OCI library", // DPI_ERR_LOAD_SYMBOL
|
|
70
68
|
"DPI-1050: Oracle Client library must be at version 11.2 or higher", // DPI_ERR_LIBRARY_TOO_OLD
|
|
71
|
-
"DPI-1051: conversion to %s results in overflow", // DPI_ERR_OVERFLOW
|
|
72
69
|
"DPI-1052: unable to get NLS environment variable", // DPI_ERR_NLS_ENV_VAR_GET,
|
|
73
70
|
"DPI-1053: parameter %s cannot be a NULL pointer while corresponding length parameter is non-zero", // DPI_ERR_PTR_LENGTH_MISMATCH
|
|
74
|
-
"DPI-1054: unused 2", // DPI_ERR_UNUSED_2
|
|
75
71
|
"DPI-1055: value is not a number (NaN) and cannot be used in Oracle numbers", // DPI_ERR_NAN
|
|
76
72
|
"DPI-1056: found object of type %.*s.%.*s when expecting object of type %.*s.%.*s", // DPI_ERR_WRONG_TYPE
|
|
77
73
|
"DPI-1057: buffer size of %u is too large (max %u)", // DPI_ERR_BUFFER_SIZE_TOO_LARGE
|
|
78
74
|
"DPI-1058: edition not supported with connection class", // DPI_ERR_NO_EDITION_WITH_CONN_CLASS
|
|
79
75
|
"DPI-1059: bind variables are not supported in DDL statements", // DPI_ERR_NO_BIND_VARS_IN_DDL
|
|
76
|
+
"DPI-1060: subscription was already closed", // DPI_ERR_SUBSCR_CLOSED
|
|
77
|
+
"DPI-1061: edition is not supported when a new password is specified", // DPI_ERR_NO_EDITION_WITH_NEW_PASSWORD
|
|
78
|
+
"DPI-1062: unexpected OCI return value %d in function %s", // DPI_ERR_UNEXPECTED_OCI_RETURN_VALUE
|
|
79
|
+
"DPI-1063: modes DPI_MODE_EXEC_BATCH_ERRORS and DPI_MODE_EXEC_ARRAY_DML_ROWCOUNTS can only be used with insert, update, delete and merge statements", // DPI_ERR_EXEC_MODE_ONLY_FOR_DML
|
|
80
|
+
"DPI-1064: array variables are not supported with dpiStmt_executeMany()", // DPI_ERR_ARRAY_VAR_NOT_SUPPORTED
|
|
81
|
+
"DPI-1065: events mode is required to subscribe to events in the database", // DPI_ERR_EVENTS_MODE_REQUIRED
|
|
80
82
|
};
|
|
81
83
|
|