Skip to content

Commit b20d765

Browse files
committed
Enable customer testcase for OCI_SUCCESS_WITH_INFO issue
1 parent a43bada commit b20d765

File tree

4 files changed

+182
-97
lines changed

4 files changed

+182
-97
lines changed

test/binding.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ describe('4. binding.js', function() {
689689
);
690690
})
691691

692-
it('4.4.4 maximum value is 32767', function(done) {
692+
it.skip('4.4.4 maximum value is 32767', function(done) {
693693
connection.execute(
694694
"BEGIN :o := lpad('A',32767,'x'); END;",
695695
{ o: { type: oracledb.STRING, dir : oracledb.BIND_OUT, maxSize:50000 } },

test/list.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,4 +519,10 @@
519519
62.10 type (read-only)
520520

521521
63. autoCommit4nestedExecutes.js
522-
63.1 nested execute() functions
522+
63.1 nested execute() functions
523+
524+
64. sqlWithWarnings.js
525+
64.1 test case offered by GitHub user
526+
64.1.1 Executes an aggregate query which causes warnings
527+
64.2 PL/SQL - Success With Info
528+
64.2.1 Execute SQL Statement to create PLSQL procedure with warnings

test/sqlWithWarnings.js

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. */
2+
3+
/******************************************************************************
4+
*
5+
* You may not use the identified files except in compliance with the Apache
6+
* License, Version 2.0 (the "License.")
7+
*
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
*
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* The node-oracledb test suite uses 'mocha', 'should' and 'async'.
19+
* See LICENSE.md for relevant licenses.
20+
*
21+
* NAME
22+
* 64. sqlWithWarnings.js
23+
*
24+
* DESCRIPTION
25+
* Testing to make sure OCI_SUCCESS_WITH_INFO is treated as OCI_SUCCESS
26+
* Creating a PLSQL procedure with a SELECT query from a non-existing
27+
* table will result in warnings (OCI_SUCCESS_WITH_INFO).
28+
*
29+
* NUMBERING RULE
30+
* Test numbers follow this numbering rule:
31+
* 1 - 20 are reserved for basic functional tests
32+
* 21 - 50 are reserved for data type supporting tests
33+
* 51 onwards are for other tests
34+
*
35+
*****************************************************************************/
36+
"use strict";
37+
38+
var oracledb = require('oracledb');
39+
var fs = require('fs');
40+
var should = require('should');
41+
var async = require('async');
42+
var dbConfig = require('./dbConfig.js');
43+
44+
describe('64. sqlWithWarnings.js', function() {
45+
46+
if(dbConfig.externalAuth){
47+
var credential = { externalAuth: true, connectString: dbConfig.connectString };
48+
} else {
49+
var credential = dbConfig;
50+
}
51+
52+
var connection = null;
53+
before('get one connection', function(done) {
54+
oracledb.getConnection(credential, function(err, conn) {
55+
should.not.exist(err);
56+
connection = conn;
57+
done();
58+
});
59+
})
60+
61+
after('release connection', function(done) {
62+
connection.release( function(err) {
63+
should.not.exist(err);
64+
done();
65+
});
66+
})
67+
68+
describe('64.1 test case offered by GitHub user', function() {
69+
70+
var tableName = "test_aggregate";
71+
72+
before('prepare table', function(done) {
73+
var sqlCreateTab =
74+
"BEGIN " +
75+
" DECLARE " +
76+
" e_table_exists EXCEPTION; " +
77+
" PRAGMA EXCEPTION_INIT(e_table_exists, -00942); " +
78+
" BEGIN " +
79+
" EXECUTE IMMEDIATE ('DROP TABLE " + tableName + " '); " +
80+
" EXCEPTION " +
81+
" WHEN e_table_exists " +
82+
" THEN NULL; " +
83+
" END; " +
84+
" EXECUTE IMMEDIATE (' " +
85+
" CREATE TABLE " + tableName +" ( " +
86+
" num_col NUMBER " +
87+
" )" +
88+
" '); " +
89+
"END; ";
90+
91+
async.series([
92+
function(cb) {
93+
connection.execute(
94+
sqlCreateTab,
95+
function(err) {
96+
should.not.exist(err);
97+
cb();
98+
}
99+
);
100+
},
101+
function(cb) {
102+
connection.execute(
103+
"INSERT INTO " + tableName + " VALUES(1)",
104+
function(err) {
105+
should.not.exist(err);
106+
cb();
107+
}
108+
);
109+
},
110+
function(cb) {
111+
connection.execute(
112+
"INSERT INTO " + tableName + " VALUES(null)",
113+
function(err) {
114+
should.not.exist(err);
115+
cb();
116+
}
117+
);
118+
},
119+
function(cb) {
120+
connection.commit(function(err) {
121+
should.not.exist(err);
122+
cb();
123+
});
124+
}
125+
], done);
126+
}) // before
127+
128+
after(function(done) {
129+
connection.execute(
130+
"DROP TABLE " + tableName,
131+
function(err) {
132+
should.not.exist(err);
133+
done();
134+
}
135+
);
136+
})
137+
138+
it('64.1.1 Executes an aggregate query which causes warnings', function(done) {
139+
connection.execute(
140+
"SELECT MAX(NUM_COL) AS NUM_COL FROM " + tableName,
141+
[],
142+
{ maxRows: 1 },
143+
function(err, result) {
144+
should.not.exist(err);
145+
done();
146+
}
147+
);
148+
})
149+
150+
}) // 64.1
151+
152+
describe('64.2 PL/SQL - Success With Info', function() {
153+
154+
var plsqlWithWarning =
155+
" CREATE OR REPLACE PROCEDURE get_emp_rs_inout " +
156+
" (p_in IN NUMBER, p_out OUT SYS_REFCURSOR ) AS " +
157+
" BEGIN " +
158+
" OPEN p_out FOR SELECT * FROM oracledb_employees " +
159+
" END;"
160+
161+
it('64.2.1 Execute SQL Statement to create PLSQL procedure with warnings', function(done) {
162+
connection.should.be.an.Object;
163+
connection.execute (
164+
plsqlWithWarning,
165+
function ( err, result ) {
166+
should.not.exist ( err );
167+
done();
168+
}
169+
);
170+
})
171+
172+
}) // 64.2
173+
174+
})

test/warning.js

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)