|
| 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. warning.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 | +var assist = require('./dataTypeAssist.js'); |
| 44 | + |
| 45 | +describe('64. warning.js', function() { |
| 46 | + |
| 47 | + if(dbConfig.externalAuth){ |
| 48 | + var credential = { externalAuth: true, connectString: dbConfig.connectString }; |
| 49 | + } else { |
| 50 | + var credential = dbConfig; |
| 51 | + } |
| 52 | + |
| 53 | + describe('64.1 Success With Info', function() { |
| 54 | + var connection = null; |
| 55 | + |
| 56 | + before('get one connection', function(done) { |
| 57 | + oracledb.getConnection(credential, function(err, conn) { |
| 58 | + should.not.exist(err); |
| 59 | + connection = conn; |
| 60 | + done(); |
| 61 | + }); |
| 62 | + }) |
| 63 | + |
| 64 | + after('release connection', function(done) { |
| 65 | + connection.release( function(err) { |
| 66 | + should.not.exist(err); |
| 67 | + done(); |
| 68 | + }); |
| 69 | + }) |
| 70 | + |
| 71 | + it('64.1 Execute SQL Statement to create PLSQL procedure with warnings', |
| 72 | + function(done) { |
| 73 | + connection.should.be.an.Object; |
| 74 | + |
| 75 | + connection.execute ( |
| 76 | + "CREATE OR REPLACE PROCEDURE get_emp_rs_inout " + |
| 77 | + "(p_in IN NUMBER, p_out OUT SYS_REFCURSOR ) AS " + |
| 78 | + "BEGIN " + |
| 79 | + " OPEN p_out FOR SELECT * FROM oracledb_employees " + |
| 80 | + "END;", |
| 81 | + { |
| 82 | + }, |
| 83 | + { |
| 84 | + }, |
| 85 | + function ( err, result ) |
| 86 | + { |
| 87 | + should.not.exist ( err ); |
| 88 | + done(); |
| 89 | + } |
| 90 | + ); |
| 91 | + }) |
| 92 | + }) // 64.1 |
| 93 | + |
| 94 | + |
| 95 | +}) |
0 commit comments