Test updates
This commit is contained in:
parent
d433c3df57
commit
db4c7ea2d3
|
@ -137,12 +137,12 @@ describe('8. autoCommitForSelect.js', function(){
|
|||
|
||||
afterEach(function(done){
|
||||
connection.execute(
|
||||
'DROP TABLE nodb_commit4_dept purge',
|
||||
function(err){
|
||||
if(err) { console.error(err.message); return; }
|
||||
done();
|
||||
}
|
||||
);
|
||||
'DROP TABLE nodb_commit4_dept purge',
|
||||
function(err){
|
||||
if(err) { console.error(err.message); return; }
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('8.1 should return previous value when autoCommit is false', function(done){
|
||||
|
|
|
@ -257,7 +257,7 @@ describe('102. bindTimestamp.js', function() {
|
|||
connection.execute(
|
||||
"insert into nodb_tab_tsbind values (:1, :2, :3) returning id, tstz into :4, :5",
|
||||
[id, bv, bv, { type: oracledb.NUMBER, dir: oracledb.BIND_OUT},
|
||||
{ type: oracledb.DATE, dir: oracledb.BIND_OUT} ],
|
||||
{ type: oracledb.DATE, dir: oracledb.BIND_OUT} ],
|
||||
{ autoCommit: true},
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
|
@ -330,7 +330,7 @@ describe('102. bindTimestamp.js', function() {
|
|||
connection.execute(
|
||||
"insert into nodb_tab_tsbind values (:1, :2, :3) returning id, tstz into :4, :5",
|
||||
[id, bv, bv, { type: oracledb.NUMBER, dir: oracledb.BIND_OUT},
|
||||
{ type: oracledb.NUMBER, dir: oracledb.BIND_OUT} ],
|
||||
{ type: oracledb.NUMBER, dir: oracledb.BIND_OUT} ],
|
||||
{ autoCommit: true},
|
||||
function(err) {
|
||||
should.exist(err);
|
||||
|
|
136
test/binding.js
136
test/binding.js
|
@ -676,15 +676,15 @@ describe('4. binding.js', function() {
|
|||
it('4.4.3 Negative - bind out data exceeds default length', function(done) {
|
||||
connection.execute(
|
||||
"BEGIN :o := lpad('A',201,'x'); END;",
|
||||
{ o: { type: oracledb.STRING, dir : oracledb.BIND_OUT } },
|
||||
function (err, result) {
|
||||
should.exist(err);
|
||||
// ORA-06502: PL/SQL: numeric or value error
|
||||
err.message.should.startWith('ORA-06502:');
|
||||
// console.log(result.outBinds.o.length);
|
||||
should.not.exist(result);
|
||||
done();
|
||||
}
|
||||
{ o: { type: oracledb.STRING, dir : oracledb.BIND_OUT } },
|
||||
function (err, result) {
|
||||
should.exist(err);
|
||||
// ORA-06502: PL/SQL: numeric or value error
|
||||
err.message.should.startWith('ORA-06502:');
|
||||
// console.log(result.outBinds.o.length);
|
||||
should.not.exist(result);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -805,47 +805,47 @@ describe('4. binding.js', function() {
|
|||
// Test cases involving JSON value as input
|
||||
describe ('4.7 Value as JSON named/unamed test cases', function () {
|
||||
it ( '4.7.1 valid case when numeric values are passed as it is',
|
||||
function (done ) {
|
||||
var sql = "SELECT SYSDATE FROM DUAL WHERE :b = 1 and :c = 456 ";
|
||||
var binds = [ 1, 456 ];
|
||||
function (done ) {
|
||||
var sql = "SELECT SYSDATE FROM DUAL WHERE :b = 1 and :c = 456 ";
|
||||
var binds = [ 1, 456 ];
|
||||
|
||||
oracledb.getConnection (
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
oracledb.getConnection (
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it ( '4.7.2 Valid values when one of the value is passed as JSON ',
|
||||
function (done ) {
|
||||
var sql = "SELECT SYSDATE FROM DUAL WHERE :b = 1 and :c = 456 ";
|
||||
var binds = [ 1, { val : 456 } ];
|
||||
function (done ) {
|
||||
var sql = "SELECT SYSDATE FROM DUAL WHERE :b = 1 and :c = 456 ";
|
||||
var binds = [ 1, { val : 456 } ];
|
||||
|
||||
oracledb.getConnection (
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
oracledb.getConnection (
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
} );
|
||||
});
|
||||
});
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
} );
|
||||
});
|
||||
});
|
||||
|
||||
it ( '4.7.3 Valid test case when one of the value is passed as JSON ',
|
||||
function (done ) {
|
||||
|
@ -853,19 +853,19 @@ describe('4. binding.js', function() {
|
|||
var binds = [ {val : 1}, 456 ];
|
||||
|
||||
oracledb.getConnection (
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
} );
|
||||
});
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
} );
|
||||
});
|
||||
});
|
||||
|
||||
it ( '4.7.4 Valid Test case when both values are passed as JSON',
|
||||
|
@ -874,19 +874,19 @@ describe('4. binding.js', function() {
|
|||
var binds = [ {val : 1}, {val : 456 } ];
|
||||
|
||||
oracledb.getConnection (
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
dbConfig,
|
||||
function (err, connection ){
|
||||
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
} );
|
||||
});
|
||||
should.not.exist ( err ) ;
|
||||
connection.execute (
|
||||
sql,
|
||||
binds,
|
||||
function ( err, result ) {
|
||||
(result.rows[0][0]).should.be.a.Date();
|
||||
should.not.exist ( err );
|
||||
done ();
|
||||
} );
|
||||
});
|
||||
});
|
||||
|
||||
it ( '4.7.5 Invalid Test case when value is passed as named JSON',
|
||||
|
|
|
@ -0,0 +1,272 @@
|
|||
/* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* You may not use the identified files except in compliance with the Apache
|
||||
* License, Version 2.0 (the "License.")
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
* http://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.
|
||||
*
|
||||
* The node-oracledb test suite uses 'mocha', 'should' and 'async'.
|
||||
* See LICENSE.md for relevant licenses.
|
||||
*
|
||||
* NAME
|
||||
* 127. blobStream.js
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Testing stream txt file into BLOB.
|
||||
*
|
||||
* NUMBERING RULE
|
||||
* Test numbers follow this numbering rule:
|
||||
* 1 - 20 are reserved for basic functional tests
|
||||
* 21 - 50 are reserved for data type supporting tests
|
||||
* 51 onwards are for other tests
|
||||
*
|
||||
*****************************************************************************/
|
||||
'use strict';
|
||||
|
||||
var oracledb = require('oracledb');
|
||||
var should = require('should');
|
||||
var async = require('async');
|
||||
var dbConfig = require('./dbconfig.js');
|
||||
var file = require('./file.js');
|
||||
var sql = require('./sql.js');
|
||||
var fs = require('fs');
|
||||
|
||||
describe('127.blobStream.js', function() {
|
||||
var connection = null;
|
||||
var fileRoot = ".";
|
||||
var insertID = 1;
|
||||
var inFileName;
|
||||
|
||||
var proc_blob_prepare_tab = "BEGIN \n" +
|
||||
" DECLARE \n" +
|
||||
" e_table_missing EXCEPTION; \n" +
|
||||
" PRAGMA EXCEPTION_INIT(e_table_missing, -00942); \n" +
|
||||
" BEGIN \n" +
|
||||
" EXECUTE IMMEDIATE('DROP TABLE nodb_tab_lobs_pre PURGE'); \n" +
|
||||
" EXCEPTION \n" +
|
||||
" WHEN e_table_missing \n" +
|
||||
" THEN NULL; \n" +
|
||||
" END; \n" +
|
||||
" EXECUTE IMMEDIATE (' \n" +
|
||||
" CREATE TABLE nodb_tab_lobs_pre ( \n" +
|
||||
" id NUMBER, \n" +
|
||||
" blob BLOB \n" +
|
||||
" ) \n" +
|
||||
" '); \n" +
|
||||
"END; ";
|
||||
|
||||
before(function(done) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
oracledb.getConnection(dbConfig, function(err, conn) {
|
||||
should.not.exist(err);
|
||||
connection = conn;
|
||||
|
||||
cb();
|
||||
});
|
||||
},
|
||||
function(cb) {
|
||||
setupAllTable(cb);
|
||||
}
|
||||
], done);
|
||||
}); // before
|
||||
|
||||
after(function(done) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
dropAllTable(cb);
|
||||
},
|
||||
function(cb) {
|
||||
connection.release(function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
], done);
|
||||
}); // after
|
||||
|
||||
beforeEach(function(done) {
|
||||
insertID++;
|
||||
done();
|
||||
});
|
||||
|
||||
describe('127.1 stream txt file into BLOB column', function() {
|
||||
it('127.1.1 works with 64K txt file', function(done) {
|
||||
inFileName = fileRoot + '/smallString.txt';
|
||||
var selectID = insertID + 100;
|
||||
var fileSize = 64 * 1024;
|
||||
var specialStr = '127.1.1';
|
||||
|
||||
bindSmallFile(inFileName, fileSize, selectID, insertID, specialStr, done);
|
||||
});
|
||||
|
||||
it('127.1.2 works with 64K+1 txt file', function(done) {
|
||||
inFileName = fileRoot + '/smallString.txt';
|
||||
var selectID = insertID + 100;
|
||||
var fileSize = 64 * 1024 + 1;
|
||||
var specialStr = '127.1.2';
|
||||
|
||||
bindSmallFile(inFileName, fileSize, selectID, insertID, specialStr, done);
|
||||
});
|
||||
|
||||
it('127.1.3 works with 1MB+1 txt file', function(done) {
|
||||
inFileName = fileRoot + '/smallString.txt';
|
||||
var selectID = insertID + 100;
|
||||
var fileSize = 1 * 1024 * 1024 + 1;
|
||||
var specialStr = '127.1.3';
|
||||
|
||||
bindSmallFile(inFileName, fileSize, selectID, insertID, specialStr, done);
|
||||
});
|
||||
|
||||
}); // 1.1
|
||||
|
||||
var bindSmallFile = function(inFileName, fileSize, selectID, insertID, specialStr, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
file.createFileInKB(inFileName, fileSize, specialStr);
|
||||
cb();
|
||||
},
|
||||
function(cb) {
|
||||
insetTableWithBlob(selectID, inFileName, cb);
|
||||
},
|
||||
function(cb) {
|
||||
verifyBlob(selectID, insertID, fileSize, cb);
|
||||
},
|
||||
function(cb) {
|
||||
file.delete(inFileName);
|
||||
cb();
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
var setupAllTable = function(callback) {
|
||||
connection.execute(
|
||||
proc_blob_prepare_tab,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
var dropAllTable = function(callback) {
|
||||
connection.execute(
|
||||
"DROP TABLE nodb_tab_lobs_pre PURGE",
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
var insetTableWithBlob = function(id, inFileName, callback) {
|
||||
var sql = "INSERT INTO nodb_tab_lobs_pre (id, blob) VALUES (:i, EMPTY_BLOB()) RETURNING blob INTO :lobbv";
|
||||
var bindVar = { i: id, lobbv: { type: oracledb.BLOB, dir: oracledb.BIND_OUT } };
|
||||
|
||||
connection.execute(
|
||||
sql,
|
||||
bindVar,
|
||||
{ autoCommit: false }, // a transaction needs to span the INSERT and pipe()
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
(result.outBinds.lobbv.length).should.be.exactly(1);
|
||||
|
||||
var inStream = fs.createReadStream(inFileName);
|
||||
var lob = result.outBinds.lobbv[0];
|
||||
|
||||
lob.on('error', function(err) {
|
||||
should.not.exist(err);
|
||||
});
|
||||
|
||||
inStream.on('error', function(err) {
|
||||
should.not.exist(err);
|
||||
});
|
||||
|
||||
lob.on('close', function() {
|
||||
connection.commit( function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
||||
inStream.pipe(lob); // copies the text to the BLOB
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var verifyBlob = function(selectID, insertID, lenExpected, callback) {
|
||||
var lob = {};
|
||||
var selectSql = "select blob from nodb_tab_lobs_pre where id = " + selectID;
|
||||
var insetSql = "INSERT INTO nodb_tab_lobs_pre (id, blob) VALUES (:i, :c)";
|
||||
var proc_compare_blob = "CREATE OR REPLACE PROCEDURE nodb_blob_compare(result OUT NUMBER, len OUT NUMBER) \n" +
|
||||
"IS \n" +
|
||||
" blob1 BLOB; \n" +
|
||||
" blob2 BLOB; \n" +
|
||||
"BEGIN \n" +
|
||||
" select blob into blob1 from nodb_tab_lobs_pre where id = " + selectID + "; \n" +
|
||||
" select blob into blob2 from nodb_tab_lobs_pre where id = " + insertID + "; \n" +
|
||||
" result := DBMS_LOB.COMPARE(blob1, blob2); \n" + // Zero if the comparison succeeds, nonzero if not.
|
||||
" len := length(blob1); \n" +
|
||||
"END nodb_blob_compare;";
|
||||
var sqlRunComparePorc = "begin nodb_blob_compare(:r, :l); end;";
|
||||
var sqlDropComparePorc = "DROP PROCEDURE nodb_blob_compare";
|
||||
|
||||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
selectSql,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
lob = result.rows[0][0];
|
||||
should.exist(lob);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = { i: insertID, c: { val: lob, type: oracledb.BLOB, dir: oracledb.BIND_IN } };
|
||||
connection.execute(
|
||||
insetSql,
|
||||
bindVar,
|
||||
{ autoCommit: true },
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
sql.executeSql(connection, proc_compare_blob, {}, {}, cb);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = {
|
||||
r: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT },
|
||||
l: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT }
|
||||
};
|
||||
connection.execute(
|
||||
sqlRunComparePorc,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
result.outBinds.r.should.eql(0);
|
||||
should.strictEqual(result.outBinds.l, lenExpected);
|
||||
cb();
|
||||
});
|
||||
},
|
||||
function(cb) {
|
||||
sql.executeSql(connection, sqlDropComparePorc, {}, {}, cb);
|
||||
}
|
||||
], callback);
|
||||
|
||||
};
|
||||
|
||||
});
|
|
@ -1283,7 +1283,7 @@ describe('75. clobPlsqlBindAsString_bindout.js', function() {
|
|||
bindVar,
|
||||
function(err) {
|
||||
should.exist(err);
|
||||
// ORA-06502: PL/SQL: numeric or value error
|
||||
// ORA-06502: PL/SQL: numeric or value error
|
||||
(err.message).should.startWith('ORA-06502:');
|
||||
cb();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,271 @@
|
|||
/* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* You may not use the identified files except in compliance with the Apache
|
||||
* License, Version 2.0 (the "License.")
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
* http://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.
|
||||
*
|
||||
* The node-oracledb test suite uses 'mocha', 'should' and 'async'.
|
||||
* See LICENSE.md for relevant licenses.
|
||||
*
|
||||
* NAME
|
||||
* 128. clobStream.js
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Testing stream txt file into CLOB.
|
||||
*
|
||||
* NUMBERING RULE
|
||||
* Test numbers follow this numbering rule:
|
||||
* 1 - 20 are reserved for basic functional tests
|
||||
* 21 - 50 are reserved for data type supporting tests
|
||||
* 51 onwards are for other tests
|
||||
*
|
||||
*****************************************************************************/
|
||||
'use strict';
|
||||
|
||||
var oracledb = require('oracledb');
|
||||
var should = require('should');
|
||||
var async = require('async');
|
||||
var dbConfig = require('./dbconfig.js');
|
||||
var file = require('./file.js');
|
||||
var sql = require('./sql.js');
|
||||
var fs = require('fs');
|
||||
|
||||
describe('128.clobStream.js', function() {
|
||||
var connection = null;
|
||||
var fileRoot = ".";
|
||||
var insertID = 1;
|
||||
var inFileName;
|
||||
|
||||
var proc_clob_prepare_tab = "BEGIN \n" +
|
||||
" DECLARE \n" +
|
||||
" e_table_missing EXCEPTION; \n" +
|
||||
" PRAGMA EXCEPTION_INIT(e_table_missing, -00942); \n" +
|
||||
" BEGIN \n" +
|
||||
" EXECUTE IMMEDIATE('DROP TABLE nodb_tab_lobs_pre PURGE'); \n" +
|
||||
" EXCEPTION \n" +
|
||||
" WHEN e_table_missing \n" +
|
||||
" THEN NULL; \n" +
|
||||
" END; \n" +
|
||||
" EXECUTE IMMEDIATE (' \n" +
|
||||
" CREATE TABLE nodb_tab_lobs_pre ( \n" +
|
||||
" id NUMBER, \n" +
|
||||
" clob CLOB \n" +
|
||||
" ) \n" +
|
||||
" '); \n" +
|
||||
"END; ";
|
||||
|
||||
before(function(done) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
oracledb.getConnection(dbConfig, function(err, conn) {
|
||||
should.not.exist(err);
|
||||
connection = conn;
|
||||
cb();
|
||||
});
|
||||
},
|
||||
function(cb) {
|
||||
setupAllTable(cb);
|
||||
}
|
||||
], done);
|
||||
}); // before
|
||||
|
||||
after(function(done) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
dropAllTable(cb);
|
||||
},
|
||||
function(cb) {
|
||||
connection.release(function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
], done);
|
||||
}); // after
|
||||
|
||||
beforeEach(function(done) {
|
||||
insertID++;
|
||||
done();
|
||||
});
|
||||
|
||||
describe('128.1 stream txt file into CLOB column', function() {
|
||||
it('128.1.1 works with 64KB txt file', function(done) {
|
||||
inFileName = fileRoot + '/smallString.txt';
|
||||
var selectID = insertID + 200;
|
||||
var specialStr = '128.1.1';
|
||||
var fileSize = 65536;
|
||||
|
||||
bindIn_small(inFileName, fileSize, selectID, insertID, specialStr, done);
|
||||
});
|
||||
|
||||
it('128.1.2 works with 64KB+1 txt file', function(done) {
|
||||
inFileName = fileRoot + '/smallString.txt';
|
||||
var selectID = insertID + 200;
|
||||
var specialStr = '128.1.2';
|
||||
var fileSize = 655376;
|
||||
|
||||
bindIn_small(inFileName, fileSize, selectID, insertID, specialStr, done);
|
||||
});
|
||||
|
||||
it('128.1.3 works with 1MB+1 txt file', function(done) {
|
||||
inFileName = fileRoot + '/smallString.txt';
|
||||
var selectID = insertID + 200;
|
||||
var specialStr = '128.1.3';
|
||||
var fileSize = 1 * 1024 * 1024;
|
||||
|
||||
bindIn_small(inFileName, fileSize, selectID, insertID, specialStr, done);
|
||||
});
|
||||
|
||||
}); // 4.1
|
||||
|
||||
var bindIn_small = function(inFileName, fileSize, selectID, insertID, specialStr, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
file.createFileInKB(inFileName, fileSize, specialStr);
|
||||
cb();
|
||||
},
|
||||
function(cb) {
|
||||
insetTableWithClob(selectID, inFileName, cb);
|
||||
},
|
||||
function(cb) {
|
||||
verifyClob(selectID, insertID, fileSize, cb);
|
||||
},
|
||||
function(cb) {
|
||||
file.delete(inFileName);
|
||||
cb();
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
var setupAllTable = function(callback) {
|
||||
connection.execute(
|
||||
proc_clob_prepare_tab,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
var dropAllTable = function(callback) {
|
||||
connection.execute(
|
||||
"DROP TABLE nodb_tab_lobs_pre PURGE",
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
var insetTableWithClob = function(id, inFileName, callback) {
|
||||
var sql = "INSERT INTO nodb_tab_lobs_pre (id, clob) VALUES (:i, EMPTY_CLOB()) RETURNING clob INTO :lobbv";
|
||||
var bindVar = { i: id, lobbv: { type: oracledb.CLOB, dir: oracledb.BIND_OUT } };
|
||||
|
||||
connection.execute(
|
||||
sql,
|
||||
bindVar,
|
||||
{ autoCommit: false }, // a transaction needs to span the INSERT and pipe()
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
(result.outBinds.lobbv.length).should.be.exactly(1);
|
||||
|
||||
var inStream = fs.createReadStream(inFileName);
|
||||
var lob = result.outBinds.lobbv[0];
|
||||
|
||||
lob.on('error', function(err) {
|
||||
should.not.exist(err);
|
||||
});
|
||||
|
||||
inStream.on('error', function(err) {
|
||||
should.not.exist(err);
|
||||
});
|
||||
|
||||
lob.on('close', function() {
|
||||
connection.commit( function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
||||
inStream.pipe(lob); // copies the text to the CLOB
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var verifyClob = function(selectID, insertID, lenExpected, callback) {
|
||||
var lob = {};
|
||||
var selectSql = "select clob from nodb_tab_lobs_pre where id = " + selectID;
|
||||
var insetSql = "INSERT INTO nodb_tab_lobs_pre (id, clob) VALUES (:i, :c)";
|
||||
var proc_compare_clob = "CREATE OR REPLACE PROCEDURE nodb_clob_compare(result OUT NUMBER, len OUT NUMBER) \n" +
|
||||
"IS \n" +
|
||||
" clob1 CLOB; \n" +
|
||||
" clob2 CLOB; \n" +
|
||||
"BEGIN \n" +
|
||||
" select clob into clob1 from nodb_tab_lobs_pre where id = " + selectID + "; \n" +
|
||||
" select clob into clob2 from nodb_tab_lobs_pre where id = " + insertID + "; \n" +
|
||||
" result := DBMS_LOB.COMPARE(clob1, clob2); \n" + // Zero if the comparison succeeds, nonzero if not.
|
||||
" len := length(clob1); \n" +
|
||||
"END nodb_clob_compare;";
|
||||
var sqlRunComparePorc = "begin nodb_clob_compare(:r, :l); end;";
|
||||
var sqlDropComparePorc = "DROP PROCEDURE nodb_clob_compare";
|
||||
|
||||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
selectSql,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
lob = result.rows[0][0];
|
||||
should.exist(lob);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = { i: insertID, c: { val: lob, type: oracledb.CLOB, dir: oracledb.BIND_IN } };
|
||||
connection.execute(
|
||||
insetSql,
|
||||
bindVar,
|
||||
{ autoCommit: true },
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
sql.executeSql(connection, proc_compare_clob, {}, {}, cb);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = {
|
||||
r: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT },
|
||||
l: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT }
|
||||
};
|
||||
connection.execute(
|
||||
sqlRunComparePorc,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
result.outBinds.r.should.eql(0);
|
||||
should.strictEqual(result.outBinds.l, lenExpected);
|
||||
cb();
|
||||
});
|
||||
},
|
||||
function(cb) {
|
||||
sql.executeSql(connection, sqlDropComparePorc, {}, {}, cb);
|
||||
}
|
||||
], callback);
|
||||
|
||||
};
|
||||
|
||||
});
|
|
@ -175,14 +175,18 @@ describe('52. connClose.js', function() {
|
|||
|
||||
connection.release(function(err) {
|
||||
should.not.exist(err);
|
||||
should.throws(
|
||||
function() {
|
||||
var sql = "select sysdate from dual";
|
||||
connection.execute(sql, function() {});
|
||||
},
|
||||
/NJS-003: invalid connection/
|
||||
connection.execute(
|
||||
"select sysdate from dual",
|
||||
function(err, result) {
|
||||
should.not.exist(result);
|
||||
should.exist(err);
|
||||
should.strictEqual(
|
||||
err.message,
|
||||
"NJS-003: invalid connection"
|
||||
);
|
||||
done();
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -124,13 +124,13 @@ describe('1. connection.js', function(){
|
|||
it('1.1.2 ARRAY format explicitly', function(done) {
|
||||
connection.should.be.ok();
|
||||
connection.execute(
|
||||
query, {id: 20}, {outFormat: oracledb.ARRAY},
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
(result.rows).should.eql([[ 20, 'Marketing' ]]);
|
||||
done();
|
||||
}
|
||||
);
|
||||
query, {id: 20}, {outFormat: oracledb.ARRAY},
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
(result.rows).should.eql([[ 20, 'Marketing' ]]);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('1.1.3 OBJECT format', function(done){
|
||||
|
|
|
@ -271,12 +271,12 @@ describe('123. dataTypeNclob.js', function() {
|
|||
var insertData = function(tableName, insertStr, callback) {
|
||||
var sql = "INSERT INTO " + tableName + "(num, content) VALUES(" + insertID + ", TO_NCLOB('" + insertStr + "'))";
|
||||
connection.execute(
|
||||
sql,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
sql,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var streamLob = function(tableName, originalStr, callback) {
|
||||
|
|
|
@ -125,7 +125,7 @@ describe('27. dataTypeNumber2.js', function() {
|
|||
if(Math.abs( numbers[rows[i].NUM] ) == 0.00000123)
|
||||
rows[i].CONTENT.should.be.exactly(0);
|
||||
else
|
||||
rows[i].CONTENT.should.be.exactly(numbers[rows[i].NUM]);
|
||||
rows[i].CONTENT.should.be.exactly(numbers[rows[i].NUM]);
|
||||
}
|
||||
return fetchRowsFromRS(rs);
|
||||
} else if(rows.length == 0) {
|
||||
|
|
|
@ -137,14 +137,14 @@ describe('42. dataTypeRaw.js', function() {
|
|||
it('42.1.5 a negative case which hits NJS-011 error', function(done) {
|
||||
connection.execute(
|
||||
"INSERT INTO " + tableName + " (content ) VALUES (:c)",
|
||||
{ c : { val: 1234, type: oracledb.BUFFER, dir:oracledb.BIND_IN } },
|
||||
function(err, result) {
|
||||
should.exist(err);
|
||||
{ c : { val: 1234, type: oracledb.BUFFER, dir:oracledb.BIND_IN } },
|
||||
function(err, result) {
|
||||
should.exist(err);
|
||||
// NJS-011: encountered bind value and type mismatch
|
||||
(err.message).should.startWith('NJS-011:');
|
||||
should.not.exist(result);
|
||||
done();
|
||||
}
|
||||
(err.message).should.startWith('NJS-011:');
|
||||
should.not.exist(result);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -415,7 +415,7 @@ describe('42. dataTypeRaw.js', function() {
|
|||
});
|
||||
}); // 42.4
|
||||
|
||||
describe('45.5 INSERT and SELECT', function() {
|
||||
describe('42.5 INSERT and SELECT', function() {
|
||||
before(function(done) {
|
||||
assist.createTable(connection, tableName, done);
|
||||
});
|
||||
|
@ -435,27 +435,27 @@ describe('42. dataTypeRaw.js', function() {
|
|||
done();
|
||||
});
|
||||
|
||||
it('45.5.1 works with data size 100', function(done) {
|
||||
it('42.5.1 works with data size 100', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
test1(insertedBuf, done);
|
||||
});
|
||||
|
||||
it('45.5.2 works with data size 2000', function(done) {
|
||||
it('42.5.2 works with data size 2000', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(2000);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
test1(insertedBuf, done);
|
||||
});
|
||||
|
||||
it('45.5.3 works with default type/dir', function(done) {
|
||||
it('42.5.3 works with default type/dir', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(2000);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
test1_default(insertedBuf, done);
|
||||
});
|
||||
|
||||
}); // 45.5
|
||||
}); // 42.5
|
||||
|
||||
describe('45.6 UPDATE', function() {
|
||||
describe('42.6 UPDATE', function() {
|
||||
before(function(done) {
|
||||
assist.createTable(connection, tableName, done);
|
||||
});
|
||||
|
@ -475,31 +475,31 @@ describe('42. dataTypeRaw.js', function() {
|
|||
done();
|
||||
});
|
||||
|
||||
it('45.6.1 works with data size 100', function(done) {
|
||||
it('42.6.1 works with data size 100', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(20);
|
||||
var updateStr = random.getRandomLengthString(100);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2(insertedBuf, updateBuf, done);
|
||||
});
|
||||
|
||||
it('45.6.2 works with data size 2000', function(done) {
|
||||
it('42.6.2 works with data size 2000', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(30);
|
||||
var updateStr = random.getRandomLengthString(2000);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2(insertedBuf, updateBuf, done);
|
||||
});
|
||||
|
||||
it('45.6.3 works with default type/dir', function(done) {
|
||||
it('42.6.3 works with default type/dir', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(30);
|
||||
var updateStr = random.getRandomLengthString(2000);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2_default(insertedBuf, updateBuf, done);
|
||||
});
|
||||
|
||||
}); // 45.6
|
||||
}); // 42.6
|
||||
|
||||
var test1 = function(content, callback) {
|
||||
async.series([
|
||||
|
|
|
@ -135,7 +135,7 @@ describe('3. examples.js', function(){
|
|||
},
|
||||
function(callback){
|
||||
connection.execute(
|
||||
"SELECT department_id, department_name "
|
||||
"SELECT department_id, department_name "
|
||||
+ "FROM nodb_eg_dept "
|
||||
+ "WHERE department_id = :did",
|
||||
[180],
|
||||
|
@ -194,7 +194,7 @@ describe('3. examples.js', function(){
|
|||
},
|
||||
function(callback){
|
||||
connection.execute(
|
||||
"SELECT location_id, city "
|
||||
"SELECT location_id, city "
|
||||
+ "FROM nodb_locations "
|
||||
+ "WHERE city LIKE 'S%' "
|
||||
+ "ORDER BY city",
|
||||
|
@ -209,7 +209,7 @@ describe('3. examples.js', function(){
|
|||
},
|
||||
function(callback){
|
||||
connection.execute(
|
||||
"SELECT location_id, city "
|
||||
"SELECT location_id, city "
|
||||
+ "FROM nodb_locations "
|
||||
+ "WHERE city LIKE 'S%' "
|
||||
+ "ORDER BY city",
|
||||
|
|
|
@ -161,7 +161,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, B1, B2 from nodb_blob2",
|
||||
"SELECT ID, B1, B2 from nodb_blob2",
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
|
@ -193,7 +193,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, B1 from nodb_blob2 where ID = :id",
|
||||
"SELECT ID, B1 from nodb_blob2 where ID = :id",
|
||||
{ id : id },
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
|
@ -207,7 +207,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
|
|||
oracledb.fetchAsBuffer = [];
|
||||
|
||||
connection.execute(
|
||||
"SELECT B2 from nodb_blob2 where ID = :id",
|
||||
"SELECT B2 from nodb_blob2 where ID = :id",
|
||||
{ id : id },
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
|
|
|
@ -312,7 +312,7 @@ describe('84. fetchClobAsString1.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
|
@ -345,7 +345,7 @@ describe('84. fetchClobAsString1.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, C AS C1, C AS C2 from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
"SELECT ID, C AS C1, C AS C2 from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
|
@ -382,7 +382,7 @@ describe('84. fetchClobAsString1.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id,
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id,
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
|
@ -518,7 +518,7 @@ describe('84. fetchClobAsString1.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
result.rows.length.should.eql(1);
|
||||
|
@ -553,7 +553,7 @@ describe('84. fetchClobAsString1.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
"SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " +id_2,
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
|
|
|
@ -140,7 +140,7 @@ describe('86. fetchClobAsString3.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, C1, C2 from nodb_clob2",
|
||||
"SELECT ID, C1, C2 from nodb_clob2",
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
var specialStrLen_1 = specialStr_1.length;
|
||||
|
@ -177,7 +177,7 @@ describe('86. fetchClobAsString3.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"SELECT ID, C1 from nodb_clob2 where ID = :id",
|
||||
"SELECT ID, C1 from nodb_clob2 where ID = :id",
|
||||
{ id: id },
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
|
@ -194,7 +194,7 @@ describe('86. fetchClobAsString3.js', function() {
|
|||
oracledb.fetchAsString = [];
|
||||
|
||||
connection.execute(
|
||||
"SELECT C2 from nodb_clob2 where ID = :id",
|
||||
"SELECT C2 from nodb_clob2 where ID = :id",
|
||||
{ id: id },
|
||||
function(err, result){
|
||||
should.not.exist(err);
|
||||
|
|
|
@ -589,22 +589,22 @@ describe('106. fetchRowidAsString.js', function() {
|
|||
async.forEach(array, function(element, cb) {
|
||||
var sql = "select content,rowid from " + tableName + " where num = " + element;
|
||||
connection.execute(
|
||||
sql,
|
||||
[],
|
||||
option,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal_1 = result.rows[0][0];
|
||||
var resultVal_2 = result.rows[0][1];
|
||||
if(object === true) {
|
||||
resultVal_1 = result.rows[0].CONTENT;
|
||||
resultVal_2 = result.rows[0].ROWID;
|
||||
}
|
||||
should.strictEqual(typeof resultVal_1, "string");
|
||||
should.strictEqual(resultVal_1, resultVal_2);
|
||||
cb();
|
||||
sql,
|
||||
[],
|
||||
option,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal_1 = result.rows[0][0];
|
||||
var resultVal_2 = result.rows[0][1];
|
||||
if(object === true) {
|
||||
resultVal_1 = result.rows[0].CONTENT;
|
||||
resultVal_2 = result.rows[0].ROWID;
|
||||
}
|
||||
);
|
||||
should.strictEqual(typeof resultVal_1, "string");
|
||||
should.strictEqual(resultVal_1, resultVal_2);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}, function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
|
@ -662,10 +662,10 @@ describe('106. fetchRowidAsString.js', function() {
|
|||
function testQueryStream(option, callback) {
|
||||
var sql = "select CONTENT from " + tableName;
|
||||
var stream = connection.queryStream(
|
||||
sql,
|
||||
[],
|
||||
option
|
||||
);
|
||||
sql,
|
||||
[],
|
||||
option
|
||||
);
|
||||
|
||||
var result = [];
|
||||
stream.on('data', function(data) {
|
||||
|
|
|
@ -479,10 +479,10 @@ describe('19. fetchTimestampAsString.js', function() {
|
|||
function test9(table, want, callback) {
|
||||
var sql = "select content from " + table + " order by num";
|
||||
var stream = connection.queryStream(
|
||||
sql,
|
||||
[],
|
||||
{ fetchInfo: { "CONTENT": { type: oracledb.STRING } } }
|
||||
);
|
||||
sql,
|
||||
[],
|
||||
{ fetchInfo: { "CONTENT": { type: oracledb.STRING } } }
|
||||
);
|
||||
|
||||
var result = [];
|
||||
stream.on('data', function(data) {
|
||||
|
|
|
@ -45,8 +45,8 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
|
||||
var connection = null;
|
||||
var tableName = "nodb_rowid";
|
||||
var array = random.getRandomNumArray(30);
|
||||
var numRows = array.length; // number of rows to return from each call to getRows()
|
||||
var dataArray = random.getRandomNumArray(30);
|
||||
var numRows = dataArray.length; // number of rows to return from each call to getRows()
|
||||
|
||||
var proc_create_table = "BEGIN \n" +
|
||||
" DECLARE \n" +
|
||||
|
@ -83,7 +83,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
});
|
||||
|
||||
var insertData = function(connection, tableName, callback) {
|
||||
async.forEach(array, function(element, cb) {
|
||||
async.forEach(dataArray, function(element, cb) {
|
||||
var sql = "INSERT INTO " + tableName + "(num) VALUES(" + element + ")";
|
||||
connection.execute(
|
||||
sql,
|
||||
|
@ -99,7 +99,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
};
|
||||
|
||||
var updateDate = function(connection, tableName, callback) {
|
||||
async.forEach(array, function(element, cb) {
|
||||
async.forEach(dataArray, function(element, cb) {
|
||||
var sql = "UPDATE " + tableName + " T SET content = T.ROWID where num = " + element;
|
||||
connection.execute(
|
||||
sql,
|
||||
|
@ -275,7 +275,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
describe('116.3 works with fetchInfo and outFormat = ARRAY', function() {
|
||||
var maxRowBak = oracledb.maxRows;
|
||||
var option = {
|
||||
outFormat: oracledb.OBJECT,
|
||||
outFormat: oracledb.ARRAY,
|
||||
fetchInfo: { "CONTENT": { type: oracledb.STRING } }
|
||||
};
|
||||
before(function(done) {
|
||||
|
@ -345,6 +345,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
it('116.3.8 fetchInfo, resultSet = true', function(done) {
|
||||
var option_rs = {
|
||||
resultSet: true,
|
||||
outFormat: oracledb.ARRAY,
|
||||
fetchInfo: { "CONTENT": { type: oracledb.STRING } }
|
||||
};
|
||||
test2(option_rs, false, true, done);
|
||||
|
@ -499,6 +500,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
it('116.5.8 resultSet = true', function(done) {
|
||||
var option_rs = {
|
||||
resultSet: true,
|
||||
outFormat: oracledb.OBJECT
|
||||
};
|
||||
test2(option_rs, true, false, done);
|
||||
});
|
||||
|
@ -507,7 +509,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
|
||||
describe('116.6 fetch as string by default with outFormat = ARRAY', function() {
|
||||
var maxRowBak = oracledb.maxRows;
|
||||
var option = { outFormat: oracledb.OBJECT };
|
||||
var option = { outFormat: oracledb.ARRAY };
|
||||
before(function(done) {
|
||||
async.series([
|
||||
function makeTable(callback) {
|
||||
|
@ -576,6 +578,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
it('116.6.8 resultSet = true', function(done) {
|
||||
var option_rs = {
|
||||
resultSet: true,
|
||||
outFormat: oracledb.ARRAY,
|
||||
};
|
||||
test2(option_rs, false, false, done);
|
||||
});
|
||||
|
@ -583,29 +586,25 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
});
|
||||
|
||||
function test1(option, object, array, callback) {
|
||||
async.forEach(array, function(element, cb) {
|
||||
async.forEach(dataArray, function(element, cb) {
|
||||
var sql = "select content,rowid from " + tableName + " where num = " + element;
|
||||
connection.execute(
|
||||
sql,
|
||||
[],
|
||||
option,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal_1 = result.rows[0][0];
|
||||
var resultVal_2 = result.rows[0][1];
|
||||
if(object === true) {
|
||||
resultVal_1 = result.rows[0].CONTENT;
|
||||
resultVal_2 = result.rows[0].ROWID;
|
||||
}
|
||||
if(array === true) {
|
||||
resultVal_1 = result.outBinds.CONTENT;
|
||||
resultVal_2 = result.outBinds.ROWID;
|
||||
}
|
||||
should.strictEqual(typeof resultVal_1, "string");
|
||||
should.strictEqual(resultVal_1, resultVal_2);
|
||||
cb();
|
||||
sql,
|
||||
[],
|
||||
option,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal_1 = result.rows[0][0];
|
||||
var resultVal_2 = result.rows[0][1];
|
||||
if(object === true) {
|
||||
resultVal_1 = result.rows[0].CONTENT;
|
||||
resultVal_2 = result.rows[0].ROWID;
|
||||
}
|
||||
);
|
||||
should.strictEqual(typeof resultVal_1, "string");
|
||||
should.strictEqual(resultVal_1, resultVal_2);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}, function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
|
@ -613,7 +612,7 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
}
|
||||
|
||||
function test2(option, object, array, callback) {
|
||||
async.forEach(array, function(element, cb) {
|
||||
async.forEach(dataArray, function(element, cb) {
|
||||
var sql = "select content,rowid from " + tableName + " where num = " + element;
|
||||
connection.execute(
|
||||
sql,
|
||||
|
@ -629,10 +628,6 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
resultVal_1 = row.CONTENT;
|
||||
resultVal_2 = row.ROWID;
|
||||
}
|
||||
if(array === true) {
|
||||
resultVal_1 = row.outBinds.CONTENT;
|
||||
resultVal_2 = row.outBinds.ROWID;
|
||||
}
|
||||
should.strictEqual(typeof resultVal_1, "string");
|
||||
should.strictEqual(resultVal_1, resultVal_2);
|
||||
result.resultSet.close(function(err) {
|
||||
|
@ -667,10 +662,10 @@ describe('116. fetchUrowidAsString.js', function() {
|
|||
function testQueryStream(option, callback) {
|
||||
var sql = "select CONTENT from " + tableName;
|
||||
var stream = connection.queryStream(
|
||||
sql,
|
||||
[],
|
||||
option
|
||||
);
|
||||
sql,
|
||||
[],
|
||||
option
|
||||
);
|
||||
|
||||
var result = [];
|
||||
stream.on('data', function(data) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* DESCRIPTION
|
||||
* Testing Oracle data type support - UROWID.
|
||||
* To fetch UROWID columns as strings.
|
||||
* Test UROWID greater than 200/500/4000 bytes.
|
||||
* Test UROWID greater than 200/500 bytes.
|
||||
*
|
||||
* NUMBERING RULE
|
||||
* Test numbers follow this numbering rule:
|
||||
|
@ -107,7 +107,7 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
done();
|
||||
});
|
||||
|
||||
describe('117.1 works with fetchInfo option and urowid length > 200/500/4000', function() {
|
||||
describe('117.1 works with fetchInfo option and urowid length > 200/500', function() {
|
||||
var option = { fetchInfo: { "content": { type: oracledb.STRING } } };
|
||||
var maxRowBak;
|
||||
|
||||
|
@ -187,7 +187,7 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('117.2 works with fetchInfo and outFormat = OBJECT, urowid length > 200/500/4000', function() {
|
||||
describe('117.2 works with fetchInfo and outFormat = OBJECT, urowid length > 200/500', function() {
|
||||
var option = {
|
||||
outFormat: oracledb.OBJECT,
|
||||
fetchInfo: { "content": { type: oracledb.STRING } }
|
||||
|
@ -271,7 +271,7 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('117.3 works with fetchInfo and outFormat = ARRAY, urowid length > 200/500/4000', function() {
|
||||
describe('117.3 works with fetchInfo and outFormat = ARRAY, urowid length > 200/500', function() {
|
||||
var option = {
|
||||
outFormat: oracledb.ARRAY,
|
||||
fetchInfo: { "content": { type: oracledb.STRING } }
|
||||
|
@ -355,7 +355,7 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('117.4 fetch as string by default, urowid length > 200/500/4000', function() {
|
||||
describe('117.4 fetch as string by default, urowid length > 200/500', function() {
|
||||
var option = {};
|
||||
var maxRowBak;
|
||||
|
||||
|
@ -434,7 +434,7 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('117.5 fetch as string by default with outFormat = OBJECT, urowid length > 200/500/4000', function() {
|
||||
describe('117.5 fetch as string by default with outFormat = OBJECT, urowid length > 200/500', function() {
|
||||
var option = { outFormat: oracledb.OBJECT };
|
||||
var maxRowBak;
|
||||
|
||||
|
@ -514,7 +514,7 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('117.6 fetch as string by default with outFormat = ARRAY, urowid length > 200/500/4000', function() {
|
||||
describe('117.6 fetch as string by default with outFormat = ARRAY, urowid length > 200/500', function() {
|
||||
var option = { outFormat: oracledb.ARRAY };
|
||||
var maxRowBak;
|
||||
|
||||
|
@ -609,13 +609,6 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
var id = insertID++;
|
||||
if(rsFlag === true) fetchRowid_rs(id, strLength, rowidLenExpected, option, object, cb);
|
||||
else fetchRowid(id, strLength, rowidLenExpected, option, object, cb);
|
||||
},
|
||||
function(cb) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
var id = insertID++;
|
||||
if(rsFlag === true) fetchRowid_rs(id, strLength, rowidLenExpected, option, object, cb);
|
||||
else fetchRowid(id, strLength, rowidLenExpected, option, object, cb);
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
|
@ -646,27 +639,19 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
option,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
if(rowidLenExpected < 4000) {
|
||||
urowid_2 = result.rows[0][0];
|
||||
if(object === true) {
|
||||
urowid_2 = result.rows[0].CONTENT;
|
||||
}
|
||||
should.strictEqual(typeof urowid_2, "string");
|
||||
} else {
|
||||
should.strictEqual(typeof urowid_2, "undefined");
|
||||
urowid_2 = result.rows[0][0];
|
||||
if(object === true) {
|
||||
urowid_2 = result.rows[0].CONTENT;
|
||||
}
|
||||
should.strictEqual(typeof urowid_2, "string");
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
if(rowidLenExpected < 4000) {
|
||||
urowid_1.length.should.above(rowidLenExpected);
|
||||
urowid_2.length.should.above(rowidLenExpected);
|
||||
should.strictEqual(urowid_1, urowid_2);
|
||||
} else {
|
||||
urowid_1.length.should.above(rowidLenExpected);
|
||||
}
|
||||
urowid_1.length.should.above(rowidLenExpected);
|
||||
urowid_2.length.should.above(rowidLenExpected);
|
||||
should.strictEqual(urowid_1, urowid_2);
|
||||
cb();
|
||||
}
|
||||
], callback);
|
||||
|
@ -701,15 +686,11 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
result.resultSet.getRow(
|
||||
function(error, row) {
|
||||
should.not.exist(error);
|
||||
if(rowidLenExpected < 4000) {
|
||||
urowid_2 = row[0];
|
||||
if(object === true) {
|
||||
urowid_2 = row.CONTENT;
|
||||
}
|
||||
should.strictEqual(typeof urowid_2, "string");
|
||||
} else {
|
||||
should.strictEqual(typeof urowid_2, "undefined");
|
||||
urowid_2 = row[0];
|
||||
if(object === true) {
|
||||
urowid_2 = row.CONTENT;
|
||||
}
|
||||
should.strictEqual(typeof urowid_2, "string");
|
||||
result.resultSet.close(function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
|
@ -720,13 +701,9 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
);
|
||||
},
|
||||
function(cb) {
|
||||
if(rowidLenExpected < 4000) {
|
||||
urowid_1.length.should.above(rowidLenExpected);
|
||||
urowid_2.length.should.above(rowidLenExpected);
|
||||
should.strictEqual(urowid_1, urowid_2);
|
||||
} else {
|
||||
urowid_1.length.should.above(rowidLenExpected);
|
||||
}
|
||||
urowid_1.length.should.above(rowidLenExpected);
|
||||
urowid_2.length.should.above(rowidLenExpected);
|
||||
should.strictEqual(urowid_1, urowid_2);
|
||||
cb();
|
||||
}
|
||||
], callback);
|
||||
|
@ -889,13 +866,8 @@ describe('117. fetchUrowidAsString_indexed.js', function() {
|
|||
connection.execute(
|
||||
"insert into " + tableName_normal + " (id, content) values (" + id + ", '" + urowid + "')",
|
||||
function(err, result) {
|
||||
if(urowidLen > 4000) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "ORA-01704: string literal too long");
|
||||
} else {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
}
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
'use strict';
|
||||
var should = require('should');
|
||||
var fs = require('fs');
|
||||
var random = require('./random.js');
|
||||
|
||||
var file = exports;
|
||||
module.exports = file;
|
||||
|
@ -48,3 +49,10 @@ file.delete = function(filePath) {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
file.createFileInKB = function(fileName, length, specialStr) {
|
||||
var bigStr = random.getRandomString(length, specialStr);
|
||||
var stream = fs.createWriteStream(fileName, { flags: 'w', defaultEncoding: 'utf8', autoClose: true });
|
||||
stream.write(bigStr);
|
||||
stream.end();
|
||||
};
|
|
@ -688,35 +688,35 @@ describe('80. lobBindAsStringBuffer.js', function() {
|
|||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var specStrLength = specialStr.length;
|
||||
var resultLength1 = result.outBinds.b.length;
|
||||
should.strictEqual(resultLength1, size);
|
||||
should.strictEqual(result.outBinds.b.toString('utf8', 0, specStrLength), specialStr);
|
||||
should.strictEqual(result.outBinds.b.toString('utf8', (resultLength1 - specStrLength), resultLength1), specialStr);
|
||||
var lob = result.outBinds.c;
|
||||
should.exist(lob);
|
||||
lob.setEncoding("utf8");
|
||||
var clobData = '';
|
||||
lob.on('data', function(chunk) {
|
||||
clobData += chunk;
|
||||
});
|
||||
sqlRun,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var specStrLength = specialStr.length;
|
||||
var resultLength1 = result.outBinds.b.length;
|
||||
should.strictEqual(resultLength1, size);
|
||||
should.strictEqual(result.outBinds.b.toString('utf8', 0, specStrLength), specialStr);
|
||||
should.strictEqual(result.outBinds.b.toString('utf8', (resultLength1 - specStrLength), resultLength1), specialStr);
|
||||
var lob = result.outBinds.c;
|
||||
should.exist(lob);
|
||||
lob.setEncoding("utf8");
|
||||
var clobData = '';
|
||||
lob.on('data', function(chunk) {
|
||||
clobData += chunk;
|
||||
});
|
||||
|
||||
lob.on('error', function(err) {
|
||||
should.not.exist(err, "lob.on 'error' event.");
|
||||
});
|
||||
lob.on('error', function(err) {
|
||||
should.not.exist(err, "lob.on 'error' event.");
|
||||
});
|
||||
|
||||
lob.on('end', function() {
|
||||
fs.readFile( inFileName, { encoding: 'utf8' }, function(err, originalData) {
|
||||
should.not.exist(err);
|
||||
should.strictEqual(clobData, originalData);
|
||||
cb();
|
||||
});
|
||||
lob.on('end', function() {
|
||||
fs.readFile( inFileName, { encoding: 'utf8' }, function(err, originalData) {
|
||||
should.not.exist(err);
|
||||
should.strictEqual(clobData, originalData);
|
||||
cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
], done);
|
||||
}); // 80.2.3
|
||||
|
|
|
@ -103,23 +103,23 @@ describe('125. longDMLBind.js', function() {
|
|||
|
||||
it('125.1.1 works with data size 64K - 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(65535);
|
||||
test1(insertedStr, done);
|
||||
test1(insertedStr, 65535, done);
|
||||
});
|
||||
|
||||
it('125.1.2 works with data size 64K', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(65536);
|
||||
test1(insertedStr, done);
|
||||
test1(insertedStr, 65536, done);
|
||||
});
|
||||
|
||||
it('125.1.3 works with data size 64K + 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(65537);
|
||||
test1(insertedStr, done);
|
||||
test1(insertedStr, 65537, done);
|
||||
});
|
||||
|
||||
it('125.1.4 works with data size 1MB + 1', function(done) {
|
||||
var size = 1 * 1024 * 1024 + 1;
|
||||
var insertedStr = random.getRandomLengthString(size);
|
||||
test1(insertedStr, done);
|
||||
test1(insertedStr, size, done);
|
||||
});
|
||||
|
||||
}); // 125.1
|
||||
|
@ -129,26 +129,26 @@ describe('125. longDMLBind.js', function() {
|
|||
it('125.2.1 works with data size 64K - 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var updateStr = random.getRandomLengthString(65535);
|
||||
test2(insertedStr, updateStr, done);
|
||||
test2(insertedStr, updateStr, 65535, done);
|
||||
});
|
||||
|
||||
it('125.2.2 works with data size 64K', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(200);
|
||||
var updateStr = random.getRandomLengthString(65536);
|
||||
test2(insertedStr, updateStr, done);
|
||||
test2(insertedStr, updateStr, 65536, done);
|
||||
});
|
||||
|
||||
it('125.2.3 works with data size 64K + 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(10);
|
||||
var updateStr = random.getRandomLengthString(65537);
|
||||
test2(insertedStr, updateStr, done);
|
||||
test2(insertedStr, updateStr, 65537, done);
|
||||
});
|
||||
|
||||
it('125.2.4 works with data size 1MB + 1', function(done) {
|
||||
var size = 1 * 1024 * 1024 + 1;
|
||||
var insertedStr = random.getRandomLengthString(65536);
|
||||
var updateStr = random.getRandomLengthString(size);
|
||||
test2(insertedStr, updateStr, done);
|
||||
test2(insertedStr, updateStr, size, done);
|
||||
});
|
||||
|
||||
}); // 125.3
|
||||
|
@ -163,10 +163,10 @@ describe('125. longDMLBind.js', function() {
|
|||
|
||||
}); // 125.3
|
||||
|
||||
var test1 = function(content, callback) {
|
||||
var test1 = function(content, maxsize, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
insert(content, cb);
|
||||
insert(content, maxsize, cb);
|
||||
},
|
||||
function(cb) {
|
||||
fetch(content, cb);
|
||||
|
@ -174,13 +174,13 @@ describe('125. longDMLBind.js', function() {
|
|||
], callback);
|
||||
};
|
||||
|
||||
var test2 = function(insertedStr, updateStr, callback) {
|
||||
var test2 = function(insertedStr, updateStr, maxsize, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
insert(insertedStr, cb);
|
||||
insert(insertedStr, insertedStr.length, cb);
|
||||
},
|
||||
function(cb) {
|
||||
update(updateStr, cb);
|
||||
update(updateStr, maxsize, cb);
|
||||
},
|
||||
function(cb) {
|
||||
fetch(updateStr, cb);
|
||||
|
@ -191,7 +191,7 @@ describe('125. longDMLBind.js', function() {
|
|||
var test3 = function(insertedStr, updateStr, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
insert(insertedStr, cb);
|
||||
insert(insertedStr, insertedStr.length, cb);
|
||||
},
|
||||
function(cb) {
|
||||
returning(updateStr, cb);
|
||||
|
@ -199,11 +199,11 @@ describe('125. longDMLBind.js', function() {
|
|||
], callback);
|
||||
};
|
||||
|
||||
var insert = function(content, callback) {
|
||||
var insert = function(content, maxsize, callback) {
|
||||
var sql = "insert into " + tableName + " (id, content) values (:i, :c)";
|
||||
var bindVar = {
|
||||
i: { val: insertID, dir: oracledb.BIND_IN, type: oracledb.NUMBER },
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.STRING }
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.STRING, maxSize: maxsize }
|
||||
};
|
||||
connection.execute(
|
||||
sql,
|
||||
|
@ -216,11 +216,11 @@ describe('125. longDMLBind.js', function() {
|
|||
);
|
||||
};
|
||||
|
||||
var update = function(content, callback) {
|
||||
var update = function(content, maxsize, callback) {
|
||||
var sql = "update " + tableName + " set content = :c where id = :i";
|
||||
var bindVar = {
|
||||
i: { val: insertID, dir: oracledb.BIND_IN, type: oracledb.NUMBER },
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.STRING }
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.STRING, maxSize: maxsize }
|
||||
};
|
||||
connection.execute(
|
||||
sql,
|
||||
|
@ -245,7 +245,8 @@ describe('125. longDMLBind.js', function() {
|
|||
bindVar,
|
||||
function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "ORA-22816: unsupported feature with RETURNING clause");
|
||||
// ORA-22816: unsupported feature with RETURNING clause
|
||||
(err.message).should.startWith("ORA-22816:");
|
||||
callback();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -108,33 +108,50 @@ describe('126. longrawDMLBind.js', function() {
|
|||
|
||||
it('126.1.1 works with data size 64K - 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(65535);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
test1(insertedBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var maxsize = 65535;
|
||||
test1(insertedBuf, maxsize, done);
|
||||
});
|
||||
|
||||
it('126.1.2 works with data size 64K', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(65536);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
test1(insertedBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var maxsize = 65536;
|
||||
test1(insertedBuf, maxsize, done);
|
||||
});
|
||||
|
||||
it('126.1.3 works with data size 64K + 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(65537);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
test1(insertedBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var maxsize = 65537;
|
||||
test1(insertedBuf, maxsize, done);
|
||||
});
|
||||
|
||||
it('126.1.4 works with data size 1MB + 1', function(done) {
|
||||
var size = 1 * 1024 * 1024 + 1;
|
||||
var insertedStr = random.getRandomLengthString(size);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
test1(insertedBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
test1(insertedBuf, size, done);
|
||||
});
|
||||
|
||||
it('126.1.5 works with data size 100', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
test1(insertedBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
test1(insertedBuf, 100, done);
|
||||
});
|
||||
|
||||
it('126.1.6 set maxSize to 2000', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var maxsize = 2000;
|
||||
test1(insertedBuf, maxsize, done);
|
||||
});
|
||||
|
||||
it('126.1.7 set maxSize to 4GB', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var maxsize = 4 * 1024 * 1024 * 1024;
|
||||
test1(insertedBuf, maxsize, done);
|
||||
});
|
||||
|
||||
}); // 126.1
|
||||
|
@ -144,34 +161,51 @@ describe('126. longrawDMLBind.js', function() {
|
|||
it('126.2.1 works with data size 64K - 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var updateStr = random.getRandomLengthString(65535);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
test2(insertedBuf, updateBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2(insertedBuf, updateBuf, 65535, done);
|
||||
});
|
||||
|
||||
it('126.2.2 works with data size 64K', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(200);
|
||||
var updateStr = random.getRandomLengthString(65536);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
test2(insertedBuf, updateBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2(insertedBuf, updateBuf, 65536, done);
|
||||
});
|
||||
|
||||
it('126.2.3 works with data size 64K + 1', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(10);
|
||||
var updateStr = random.getRandomLengthString(65537);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
test2(insertedBuf, updateBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2(insertedBuf, updateBuf, 65537, done);
|
||||
});
|
||||
|
||||
it('126.2.4 works with data size 1MB + 1', function(done) {
|
||||
var size = 1 * 1024 * 1024 + 1;
|
||||
var insertedStr = random.getRandomLengthString(65536);
|
||||
var updateStr = random.getRandomLengthString(size);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
test2(insertedBuf, updateBuf, done);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2(insertedBuf, updateBuf, size, done);
|
||||
});
|
||||
|
||||
it('126.2.5 set maxSize to 2000', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var updateStr = random.getRandomLengthString(500);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test2(insertedBuf, updateBuf, 2000, done);
|
||||
});
|
||||
|
||||
it('126.2.6 set maxSize to 4GB', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var updateStr = random.getRandomLengthString(500);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
var maxsize = 4 * 1024 * 1024 * 1024;
|
||||
test2(insertedBuf, updateBuf, maxsize, done);
|
||||
});
|
||||
|
||||
}); // 126.2
|
||||
|
@ -181,17 +215,17 @@ describe('126. longrawDMLBind.js', function() {
|
|||
it('126.3.1 do not support in returning into', function(done) {
|
||||
var insertedStr = random.getRandomLengthString(100);
|
||||
var updateStr = random.getRandomLengthString(65535);
|
||||
var insertedBuf = node6plus ? new Buffer(insertedStr) : Buffer.from(insertedStr);
|
||||
var updateBuf = node6plus ? new Buffer(updateStr) : Buffer.from(updateStr);
|
||||
var insertedBuf = node6plus ? Buffer.from(insertedStr) : new Buffer(insertedStr);
|
||||
var updateBuf = node6plus ? Buffer.from(updateStr) : new Buffer(updateStr);
|
||||
test3(insertedBuf, updateBuf, done);
|
||||
});
|
||||
|
||||
}); // 126.3
|
||||
|
||||
var test1 = function(content, callback) {
|
||||
var test1 = function(content, maxsize, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
insert(content, cb);
|
||||
insert(content, maxsize, cb);
|
||||
},
|
||||
function(cb) {
|
||||
fetch(content, cb);
|
||||
|
@ -199,13 +233,13 @@ describe('126. longrawDMLBind.js', function() {
|
|||
], callback);
|
||||
};
|
||||
|
||||
var test2 = function(insertedStr, updateStr, callback) {
|
||||
var test2 = function(insertedStr, updateStr, maxsize, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
insert(insertedStr, cb);
|
||||
insert(insertedStr, insertedStr.length, cb);
|
||||
},
|
||||
function(cb) {
|
||||
update(updateStr, cb);
|
||||
update(updateStr, maxsize, cb);
|
||||
},
|
||||
function(cb) {
|
||||
fetch(updateStr, cb);
|
||||
|
@ -216,7 +250,7 @@ describe('126. longrawDMLBind.js', function() {
|
|||
var test3 = function(insertedStr, updateStr, callback) {
|
||||
async.series([
|
||||
function(cb) {
|
||||
insert(insertedStr, cb);
|
||||
insert(insertedStr, insertedStr.length, cb);
|
||||
},
|
||||
function(cb) {
|
||||
returning(updateStr, cb);
|
||||
|
@ -224,11 +258,11 @@ describe('126. longrawDMLBind.js', function() {
|
|||
], callback);
|
||||
};
|
||||
|
||||
var insert = function(content, callback) {
|
||||
var insert = function(content, maxsize, callback) {
|
||||
var sql = "insert into " + tableName + " (id, content) values (:i, :c)";
|
||||
var bindVar = {
|
||||
i: { val: insertID, dir: oracledb.BIND_IN, type: oracledb.NUMBER },
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.BUFFER }
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.BUFFER, maxSize: maxsize }
|
||||
};
|
||||
connection.execute(
|
||||
sql,
|
||||
|
@ -241,11 +275,11 @@ describe('126. longrawDMLBind.js', function() {
|
|||
);
|
||||
};
|
||||
|
||||
var update = function(content, callback) {
|
||||
var update = function(content, maxsize, callback) {
|
||||
var sql = "update " + tableName + " set content = :c where id = :i";
|
||||
var bindVar = {
|
||||
i: { val: insertID, dir: oracledb.BIND_IN, type: oracledb.NUMBER },
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.BUFFER }
|
||||
c: { val: content, dir: oracledb.BIND_IN, type: oracledb.BUFFER, maxSize: maxsize }
|
||||
};
|
||||
connection.execute(
|
||||
sql,
|
||||
|
|
|
@ -144,12 +144,12 @@ describe('124. nclobDMLBindAsString.js', function() {
|
|||
var insertData = function(tableName, insertStr, callback) {
|
||||
var sql = "INSERT INTO " + tableName + "(num, content) VALUES(" + insertID + ", TO_NCLOB('" + insertStr + "'))";
|
||||
connection.execute(
|
||||
sql,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
sql,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var bindIn = function(tableName, insertStr, callback) {
|
||||
|
|
|
@ -34,17 +34,17 @@
|
|||
* 51 onwards are for other tests
|
||||
*
|
||||
*****************************************************************************/
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
var oracledb = require('oracledb');
|
||||
var should = require('should');
|
||||
var async = require('async');
|
||||
var dbConfig = require('./dbconfig.js');
|
||||
var oracledb = require('oracledb');
|
||||
var should = require('should');
|
||||
var async = require('async');
|
||||
var dbConfig = require('./dbconfig.js');
|
||||
|
||||
describe('57. nestedCursor.js', function() {
|
||||
describe('57. nestedCursor.js', function() {
|
||||
|
||||
var connection = null;
|
||||
var createParentTable =
|
||||
var connection = null;
|
||||
var createParentTable =
|
||||
"BEGIN \
|
||||
DECLARE \
|
||||
e_table_missing EXCEPTION; \
|
||||
|
@ -79,7 +79,7 @@
|
|||
'); \
|
||||
END; ";
|
||||
|
||||
var createChildTable =
|
||||
var createChildTable =
|
||||
"BEGIN \
|
||||
DECLARE \
|
||||
e_table_missing EXCEPTION; \
|
||||
|
@ -131,78 +131,78 @@
|
|||
'); \
|
||||
END; ";
|
||||
|
||||
before(function(done) {
|
||||
async.series([
|
||||
function(callback) {
|
||||
oracledb.getConnection(
|
||||
{
|
||||
user: dbConfig.user,
|
||||
password: dbConfig.password,
|
||||
connectString: dbConfig.connectString
|
||||
},
|
||||
before(function(done) {
|
||||
async.series([
|
||||
function(callback) {
|
||||
oracledb.getConnection(
|
||||
{
|
||||
user: dbConfig.user,
|
||||
password: dbConfig.password,
|
||||
connectString: dbConfig.connectString
|
||||
},
|
||||
function(err, conn) {
|
||||
connection = conn;
|
||||
callback();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(callback) {
|
||||
connection.should.be.ok();
|
||||
connection.execute(
|
||||
},
|
||||
function(callback) {
|
||||
connection.should.be.ok();
|
||||
connection.execute(
|
||||
createParentTable,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(callback) {
|
||||
connection.should.be.ok();
|
||||
connection.execute(
|
||||
},
|
||||
function(callback) {
|
||||
connection.should.be.ok();
|
||||
connection.execute(
|
||||
createChildTable,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
}
|
||||
], done);
|
||||
}
|
||||
], done);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
async.series([
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
after(function(done) {
|
||||
async.series([
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
"DROP TABLE nodb_child_tab PURGE",
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
},
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
"DROP TABLE nodb_parent_tab PURGE",
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(callback) {
|
||||
connection.release( function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
], done);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
connection.release( function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
], done);
|
||||
});
|
||||
|
||||
it('57.1 testing nested cursor support - result set', function(done) {
|
||||
connection.should.be.ok();
|
||||
it('57.1 testing nested cursor support - result set', function(done) {
|
||||
connection.should.be.ok();
|
||||
|
||||
var sql =
|
||||
var sql =
|
||||
"SELECT p.description, \
|
||||
CURSOR( \
|
||||
SELECT c.description \
|
||||
|
@ -211,7 +211,7 @@
|
|||
) children \
|
||||
FROM nodb_parent_tab p";
|
||||
|
||||
connection.execute(
|
||||
connection.execute(
|
||||
sql,
|
||||
[],
|
||||
{ resultSet: true },
|
||||
|
@ -224,10 +224,10 @@
|
|||
}
|
||||
);
|
||||
|
||||
}); // 57.1
|
||||
}); // 57.1
|
||||
|
||||
it('57.2 testing nested cursor support - REF Cursor', function(done) {
|
||||
var testproc =
|
||||
it('57.2 testing nested cursor support - REF Cursor', function(done) {
|
||||
var testproc =
|
||||
"CREATE OR REPLACE PROCEDURE nodb_get_family_tree(p_out OUT SYS_REFCURSOR) \
|
||||
AS \
|
||||
BEGIN \
|
||||
|
@ -241,22 +241,22 @@
|
|||
FROM nodb_parent_tab p; \
|
||||
END; ";
|
||||
|
||||
async.series([
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
async.series([
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
testproc,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(callback){
|
||||
connection.execute(
|
||||
},
|
||||
function(callback){
|
||||
connection.execute(
|
||||
"BEGIN nodb_get_family_tree(:out); END;",
|
||||
{
|
||||
out: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||
},
|
||||
{
|
||||
out: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||
},
|
||||
function(err, result) {
|
||||
should.exist(err);
|
||||
(err.message).should.startWith('NJS-010:');
|
||||
|
@ -265,17 +265,17 @@
|
|||
callback();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
},
|
||||
function(callback) {
|
||||
connection.execute(
|
||||
"DROP PROCEDURE nodb_get_family_tree",
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
}
|
||||
], done);
|
||||
}); // 57.2
|
||||
}
|
||||
], done);
|
||||
}); // 57.2
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -222,16 +222,16 @@ describe('10. nullColumnValues.js', function() {
|
|||
rdname: { type: oracledb.STRING, dir: oracledb.BIND_OUT },
|
||||
rmid: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT }
|
||||
},
|
||||
{ autoCommit: true },
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
//console.log(result);
|
||||
result.outBinds.should.eql({rdid: [90], rdname: [null], rmid: [null]});
|
||||
result.outBinds.rdid.should.eql( [90] );
|
||||
should.not.exist(result.outBinds.rdname[0]); // null
|
||||
should.not.exist(result.outBinds.rmid[0]); // null
|
||||
done();
|
||||
}
|
||||
{ autoCommit: true },
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
//console.log(result);
|
||||
result.outBinds.should.eql({rdid: [90], rdname: [null], rmid: [null]});
|
||||
result.outBinds.rdid.should.eql( [90] );
|
||||
should.not.exist(result.outBinds.rdname[0]); // null
|
||||
should.not.exist(result.outBinds.rmid[0]); // null
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
--require should
|
||||
--require async
|
||||
--reporter spec
|
||||
|
@ -124,5 +125,7 @@ test/urowidFunctionBindAsString_bind.js
|
|||
test/urowidFunctionBindAsString_bindinout.js
|
||||
test/dataTypeNclob.js
|
||||
test/nclobDMLBindAsString.js
|
||||
test/blobStream.js
|
||||
test/clobStream.js
|
||||
test/longDMLBind.js
|
||||
test/longrawDMLBind.js
|
||||
|
|
|
@ -326,7 +326,7 @@ describe('44. plsqlBindIndexedTable2.js', function() {
|
|||
"BEGIN nodb_beachpkg.array_in(:beach_in, :depth_in); END;",
|
||||
{
|
||||
beach_in: { //type: oracledb.STRING,
|
||||
//dir: oracledb.BIND_IN,
|
||||
//dir: oracledb.BIND_IN,
|
||||
val: ["Malibu Beach", "Bondi Beach", "Waikiki Beach"] },
|
||||
depth_in: { type: oracledb.NUMBER,
|
||||
dir: oracledb.BIND_IN,
|
||||
|
@ -400,7 +400,7 @@ describe('44. plsqlBindIndexedTable2.js', function() {
|
|||
"BEGIN nodb_beachpkg.array_in(:1, :2); END;",
|
||||
[
|
||||
{ type: oracledb.STRING,
|
||||
// dir: oracledb.BIND_IN,
|
||||
// dir: oracledb.BIND_IN,
|
||||
val: ["Malibu Beach", "Bondi Beach", "Waikiki Beach"] },
|
||||
{ type: oracledb.NUMBER,
|
||||
dir: oracledb.BIND_IN,
|
||||
|
|
|
@ -1029,12 +1029,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc508,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc508,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -1079,12 +1079,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc509,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc509,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -1129,12 +1129,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc510,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc510,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -1180,35 +1180,35 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc511,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc511,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
sqlrun511,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
// console.log(result);
|
||||
var resultVar = "Pack my bag with fiv";
|
||||
//var resultVar=strVar.substr(0,(strVar.length-1)/2);
|
||||
should.strictEqual(result.outBinds.p_inout, resultVar);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
sqlrun511,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
// console.log(result);
|
||||
var resultVar = "Pack my bag with fiv";
|
||||
//var resultVar=strVar.substr(0,(strVar.length-1)/2);
|
||||
should.strictEqual(result.outBinds.p_inout, resultVar);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
sqldrop,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
sqldrop,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
], done);
|
||||
}); // 70.5.11
|
||||
|
@ -1452,12 +1452,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc610,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc610,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -1502,12 +1502,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc611,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc611,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -1774,12 +1774,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc710,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc710,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -1824,12 +1824,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc711,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc711,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -3430,15 +3430,15 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
};
|
||||
|
||||
connection.execute(
|
||||
sqlrun_dt,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var expectDate = "2016-09-10 14:10:10.123000000";
|
||||
(result.outBinds.output).should.eql(expectDate);
|
||||
done();
|
||||
}
|
||||
);
|
||||
sqlrun_dt,
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var expectDate = "2016-09-10 14:10:10.123000000";
|
||||
(result.outBinds.output).should.eql(expectDate);
|
||||
done();
|
||||
}
|
||||
);
|
||||
}); // 70.12.1
|
||||
|
||||
it('70.12.2 val: null', function(done) {
|
||||
|
@ -3929,12 +3929,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc71410,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc71410,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -3978,12 +3978,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc71411,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc71411,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -4726,12 +4726,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc71810,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc71810,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -4775,12 +4775,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc71811,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc71811,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -5525,12 +5525,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc72210,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc72210,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
@ -5574,12 +5574,12 @@ describe('70. plsqlBindScalar.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
proc72211,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
proc72211,
|
||||
function(err) {
|
||||
should.not.exist(err);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
|
|
|
@ -74,7 +74,7 @@ describe('2. pool.js', function() {
|
|||
done();
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -613,7 +613,7 @@ describe('67. poolCache.js', function() {
|
|||
});
|
||||
}); // 67.2
|
||||
|
||||
// This suite extends 67.1.6 case with various types
|
||||
// This suite extends 67.1.6 case with various types
|
||||
describe('67.3 poolAlias attribute', function() {
|
||||
|
||||
it('67.3.1 throws an error if poolAttrs.poolAlias is an object', function(done) {
|
||||
|
|
|
@ -81,12 +81,10 @@ describe('51. poolClose.js', function(){
|
|||
);
|
||||
|
||||
var inUse;
|
||||
should.throws(
|
||||
function() {
|
||||
inUse = pool.connectionsInUse;
|
||||
},
|
||||
/NJS-002: invalid pool/
|
||||
);
|
||||
pool.terminate(function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "NJS-002: invalid pool");
|
||||
});
|
||||
should.not.exist(inUse);
|
||||
|
||||
done();
|
||||
|
@ -122,14 +120,15 @@ describe('51. poolClose.js', function(){
|
|||
function(err, pool) {
|
||||
should.not.exist(err);
|
||||
pool.should.be.ok();
|
||||
|
||||
pool.terminate(function(err) {
|
||||
should.not.exist(err);
|
||||
should.throws(
|
||||
function() {
|
||||
pool.terminate(function() {});
|
||||
},
|
||||
/NJS-002: invalid pool/
|
||||
);
|
||||
|
||||
pool.terminate(function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "NJS-002: invalid pool");
|
||||
});
|
||||
|
||||
done();
|
||||
}); // terminate()
|
||||
}
|
||||
|
@ -142,14 +141,15 @@ describe('51. poolClose.js', function(){
|
|||
function(err, pool) {
|
||||
should.not.exist(err);
|
||||
pool.should.be.ok();
|
||||
|
||||
pool.close(function(err) {
|
||||
should.not.exist(err);
|
||||
should.throws(
|
||||
function() {
|
||||
pool.close(function() {});
|
||||
},
|
||||
/NJS-002: invalid pool/
|
||||
);
|
||||
|
||||
pool.close(function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "NJS-002: invalid pool");
|
||||
});
|
||||
|
||||
done();
|
||||
}); // terminate()
|
||||
}
|
||||
|
@ -216,13 +216,11 @@ describe('51. poolClose.js', function(){
|
|||
});
|
||||
},
|
||||
function close2(cb) {
|
||||
should.throws(
|
||||
function() {
|
||||
conn.close(function() {});
|
||||
},
|
||||
/NJS-003: invalid connection/
|
||||
);
|
||||
cb();
|
||||
conn.close(function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, 'NJS-003: invalid connection');
|
||||
cb();
|
||||
});
|
||||
},
|
||||
function(cb) {
|
||||
pool.terminate(function(err) {
|
||||
|
@ -233,7 +231,7 @@ describe('51. poolClose.js', function(){
|
|||
], done);
|
||||
}); // 51.6
|
||||
|
||||
it.skip('51.7 can not get connection in promise version from the terminated pool', function(done) {
|
||||
it('51.7 can not get connection in promise version from the terminated pool', function(done) {
|
||||
oracledb.createPool(
|
||||
dbConfig,
|
||||
function(err, pool) {
|
||||
|
@ -243,16 +241,22 @@ describe('51. poolClose.js', function(){
|
|||
pool.terminate(function(err) {
|
||||
should.not.exist(err);
|
||||
|
||||
try {
|
||||
var conn = pool.getConnection();
|
||||
should.strictEqual(Object.prototype.toString.call(conn), "[object Promise]");
|
||||
} catch(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "NJS-002: invalid pool");
|
||||
}
|
||||
done();
|
||||
var promise = pool.getConnection();
|
||||
|
||||
promise
|
||||
.then(function(conn) {
|
||||
should.not.exist(conn);
|
||||
})
|
||||
.catch(function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "NJS-002: invalid pool");
|
||||
})
|
||||
.then(function() {
|
||||
done();
|
||||
});
|
||||
}); // terminate()
|
||||
}
|
||||
); // createPool()
|
||||
}); // 51.7
|
||||
|
||||
});
|
||||
|
|
|
@ -961,13 +961,11 @@ describe('12. resultSet1.js', function() {
|
|||
rs.close(function(err) {
|
||||
should.not.exist(err);
|
||||
accessCount.should.be.exactly(10);
|
||||
try {
|
||||
rs.close(function() {});
|
||||
} catch (err) {
|
||||
rs.close(function(err) {
|
||||
should.exist(err);
|
||||
(err.message).should.startWith('NJS-018:');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -997,13 +995,11 @@ describe('12. resultSet1.js', function() {
|
|||
} else {
|
||||
rs.close(function(err) {
|
||||
should.not.exist(err);
|
||||
try {
|
||||
rs.getRows(numRows, function() {});
|
||||
} catch (err) {
|
||||
rs.getRows(numRows, function(err) {
|
||||
should.exist(err);
|
||||
(err.message).should.startWith('NJS-018:');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1418,7 +1414,7 @@ describe('12. resultSet1.js', function() {
|
|||
should.strictEqual(
|
||||
err.message,
|
||||
'NJS-019: ResultSet cannot be returned for non-query statements'
|
||||
);
|
||||
);
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
|
1131
test/resultSet2.js
1131
test/resultSet2.js
File diff suppressed because it is too large
Load Diff
|
@ -119,32 +119,40 @@ describe('53. resultSetClose.js', function() {
|
|||
);
|
||||
}); // 53.1
|
||||
|
||||
it('53.2 can not call close() again', function() {
|
||||
should.throws(
|
||||
function() {
|
||||
resultSet.close(function() {});
|
||||
},
|
||||
/NJS-018: invalid ResultSet/
|
||||
);
|
||||
it('53.2 can not call close() again', function(done) {
|
||||
resultSet.close(function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(
|
||||
err.message,
|
||||
'NJS-018: invalid ResultSet'
|
||||
);
|
||||
done();
|
||||
});
|
||||
}); // 53.2
|
||||
|
||||
it('53.3 can not call getRow()', function() {
|
||||
should.throws(
|
||||
function() {
|
||||
resultSet.getRow(function() {});
|
||||
},
|
||||
/NJS-018: invalid ResultSet/
|
||||
);
|
||||
it('53.3 can not call getRow()', function(done) {
|
||||
resultSet.getRow(function(err, row) {
|
||||
should.exist(err);
|
||||
should.not.exist(row);
|
||||
should.strictEqual(
|
||||
err.message,
|
||||
'NJS-018: invalid ResultSet'
|
||||
);
|
||||
done();
|
||||
});
|
||||
}); // 53.3
|
||||
|
||||
it('53.4 can not call getRows()', function() {
|
||||
should.throws(
|
||||
function() {
|
||||
var numRows = 3;
|
||||
resultSet.getRows(numRows, function() {});
|
||||
},
|
||||
/NJS-018: invalid ResultSet/
|
||||
);
|
||||
it('53.4 can not call getRows()', function(done) {
|
||||
var numRows = 3;
|
||||
resultSet.getRows(numRows, function(err, rows) {
|
||||
should.exist(err);
|
||||
should.not.exist(rows);
|
||||
should.strictEqual(
|
||||
err.message,
|
||||
'NJS-018: invalid ResultSet'
|
||||
);
|
||||
done();
|
||||
});
|
||||
}); // 53.4
|
||||
|
||||
it('53.5 can not call toQueryStream()', function() {
|
||||
|
|
|
@ -569,44 +569,44 @@ describe('107. rowidDMLBindAsString.js', function() {
|
|||
async.series([
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"insert into " + tableName + " T (ID) values (" + insertID + ")",
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
"insert into " + tableName + " T (ID) values (" + insertID + ")",
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"UPDATE " + tableName + " T SET content = T.ROWID where ID = " + insertID,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
"UPDATE " + tableName + " T SET content = T.ROWID where ID = " + insertID,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"select content from " + tableName + " where ID = " + insertID,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][0];
|
||||
connection.execute(
|
||||
"select * from " + tableName + " where ROWID = CHARTOROWID(:c)",
|
||||
{ c: { val: resultVal, dir : oracledb.BIND_IN, type : oracledb.STRING } },
|
||||
function(err_1, result_1) {
|
||||
should.not.exist(err_1);
|
||||
var resultVal_1 = result_1.rows[0][0];
|
||||
var resultVal_2 = result_1.rows[0][1];
|
||||
should.strictEqual(resultVal_1, insertID);
|
||||
should.strictEqual(resultVal_2, resultVal);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
"select content from " + tableName + " where ID = " + insertID,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][0];
|
||||
connection.execute(
|
||||
"select * from " + tableName + " where ROWID = CHARTOROWID(:c)",
|
||||
{ c: { val: resultVal, dir : oracledb.BIND_IN, type : oracledb.STRING } },
|
||||
function(err_1, result_1) {
|
||||
should.not.exist(err_1);
|
||||
var resultVal_1 = result_1.rows[0][0];
|
||||
var resultVal_2 = result_1.rows[0][1];
|
||||
should.strictEqual(resultVal_1, insertID);
|
||||
should.strictEqual(resultVal_2, resultVal);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
|
|
@ -409,15 +409,15 @@ describe('111. rowidProcedureBindAsString_bindinout.js', function() {
|
|||
c: { val: content_in, type: oracledb.STRING, dir: oracledb.BIND_INOUT, maxSize: 1000 }
|
||||
};
|
||||
connection.execute(
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.c;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.c;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var procedureBindInout_update = function(proc_execute, content_1, content_2, expected, callback) {
|
||||
|
|
|
@ -417,15 +417,15 @@ describe('110. rowidProcedureBindAsString_bindout.js', function() {
|
|||
o: { type: oracledb.STRING, dir: oracledb.BIND_OUT }
|
||||
};
|
||||
connection.execute(
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.o;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.o;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var procedureBindOut_update = function(proc_execute, content_1, content_2, expected, callback) {
|
||||
|
|
|
@ -142,10 +142,10 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
testBigUROWID(strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
it.skip('115.1.3 get error when urowid length > 4000', function(done) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
testBigUROWID(strLength, rowidLenExpected, done);
|
||||
it('115.1.3 works with maxSize < 200', function(done) {
|
||||
var strLength = 300;
|
||||
var rowidLenExpected = 200;
|
||||
testBigUROWID_maxSize(strLength, rowidLenExpected, done);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -170,11 +170,11 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
testBigUROWID_update(rowid_org, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
it.skip('115.2.4 update with urowid length > 4000', function(done) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
it('115.2.4 works with maxSize < 200', function(done) {
|
||||
var strLength = 300;
|
||||
var rowidLenExpected = 200;
|
||||
var rowid_org = "00000DD5.0000.0001";
|
||||
testBigUROWID_update(rowid_org, strLength, rowidLenExpected, done);
|
||||
testBigUROWID_update_maxSize(rowid_org, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -193,12 +193,6 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
testBigUROWID_returning(strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
it.skip('115.3.3 urowid length > 4000', function(done) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
testBigUROWID_returning(strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('115.4 WHERE', function() {
|
||||
|
@ -215,12 +209,6 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
testBigUROWID_where(strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
it.skip('115.4.3 urowid length > 4000', function(done) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
testBigUROWID_where(strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('115.5 queryStream() and oracledb.maxRows = actual rows', function() {
|
||||
|
@ -239,13 +227,6 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
testBigUROWID_stream(maxRows, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
it.skip('115.5.3 urowid length > 4000', function(done) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
var maxRows = 2;
|
||||
testBigUROWID_stream(maxRows, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('115.6 queryStream() and oracledb.maxRows > actual rows', function() {
|
||||
|
@ -264,13 +245,6 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
testBigUROWID_stream(maxRows, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
it.skip('115.6.3 urowid length > 4000', function(done) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
var maxRows = 10;
|
||||
testBigUROWID_stream(maxRows, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('115.7 queryStream() and oracledb.maxRows < actual rows', function() {
|
||||
|
@ -289,13 +263,6 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
testBigUROWID_stream(maxRows, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
it.skip('115.7.3 urowid length > 4000', function(done) {
|
||||
var strLength = 3000;
|
||||
var rowidLenExpected = 4000;
|
||||
var maxRows = 1;
|
||||
testBigUROWID_stream(maxRows, strLength, rowidLenExpected, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
@ -384,6 +351,91 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
], callback);
|
||||
};
|
||||
|
||||
var testBigUROWID_maxSize = function(strLength, rowidLenExpected, callback) {
|
||||
var str = random.getRandomLengthString(strLength);
|
||||
var urowid, urowidLen;
|
||||
async.series([
|
||||
function(cb) {
|
||||
var sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
|
||||
sql.executeInsert(connection, sql_insert, {}, {}, cb);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"select ROWID from " + tableName_indexed + " where c1 = " + insertID,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
urowid = result.rows[0][0];
|
||||
urowidLen = urowid.length;
|
||||
urowidLen.should.be.above(rowidLenExpected);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = {
|
||||
i: { val : insertID, dir : oracledb.BIND_IN, type : oracledb.NUMBER },
|
||||
c: { val : urowid, dir : oracledb.BIND_IN, type : oracledb.STRING, maxSize: 100 }
|
||||
};
|
||||
connection.execute(
|
||||
"insert into " + tableName_normal + " (ID, content) values (:i, :c)",
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
if(urowidLen > 4000) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "ORA-01704: string literal too long");
|
||||
} else {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
}
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"select * from " + tableName_normal + " where ID = " + insertID,
|
||||
function(err, result) {
|
||||
if(urowidLen < 4000) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
should.strictEqual(resultVal, urowid);
|
||||
}
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
insertID++;
|
||||
connection.execute(
|
||||
"insert into " + tableName_normal + " (ID, content) values (" + insertID + ", '" + urowid + "')",
|
||||
function(err, result) {
|
||||
if(urowidLen > 4000) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "ORA-01704: string literal too long");
|
||||
} else {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
}
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"select * from " + tableName_normal + " where ID = " + insertID,
|
||||
function(err, result) {
|
||||
if(urowidLen < 4000) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
should.strictEqual(resultVal, urowid);
|
||||
}
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
var testBigUROWID_update = function(rowid_org, strLength, rowidLenExpected, callback) {
|
||||
var str = random.getRandomLengthString(strLength);
|
||||
var urowid, urowidLen;
|
||||
|
@ -486,6 +538,96 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
], callback);
|
||||
};
|
||||
|
||||
var testBigUROWID_update_maxSize = function(rowid_org, strLength, rowidLenExpected, callback) {
|
||||
var str = random.getRandomLengthString(strLength);
|
||||
var urowid, urowidLen;
|
||||
var id_1 = insertID++;
|
||||
var id_2 = insertID++;
|
||||
async.series([
|
||||
function(cb) {
|
||||
var sql_insert = "insert into " + tableName_normal + " (ID, content) values (:i, :c)";
|
||||
var bindVar = {
|
||||
i: { val : id_1, dir : oracledb.BIND_IN, type : oracledb.NUMBER },
|
||||
c: { val : rowid_org, dir : oracledb.BIND_IN, type : oracledb.STRING }
|
||||
};
|
||||
sql.executeInsert(connection, sql_insert, bindVar, {}, cb);
|
||||
},
|
||||
function(cb) {
|
||||
var sql_insert = "insert into " + tableName_normal + " (ID, content) values (:i, :c)";
|
||||
var bindVar = {
|
||||
i: { val : id_2, dir : oracledb.BIND_IN, type : oracledb.NUMBER },
|
||||
c: { val : rowid_org, dir : oracledb.BIND_IN, type : oracledb.STRING }
|
||||
};
|
||||
sql.executeInsert(connection, sql_insert, bindVar, {}, cb);
|
||||
},
|
||||
function(cb) {
|
||||
var sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
|
||||
sql.executeInsert(connection, sql_insert, {}, {}, cb);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"select ROWID from " + tableName_indexed + " where c1 = " + insertID,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
urowid = result.rows[0][0];
|
||||
urowidLen = urowid.length;
|
||||
urowidLen.should.be.above(rowidLenExpected);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = {
|
||||
c: { val : urowid, dir : oracledb.BIND_IN, type : oracledb.STRING },
|
||||
i: { val : id_1, dir : oracledb.BIND_IN, type : oracledb.NUMBER, maxSize: 100 }
|
||||
};
|
||||
connection.execute(
|
||||
"update " + tableName_normal + " set content = :c where ID = :i",
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"select * from " + tableName_normal + " where ID = " + id_1,
|
||||
function(err, result) {
|
||||
if(urowidLen < 4000) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
should.strictEqual(resultVal, urowid);
|
||||
}
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"update " + tableName_normal + " set content = '" + urowid + "' where ID = " + id_2,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
(result.rowsAffected).should.be.exactly(1);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
connection.execute(
|
||||
"select * from " + tableName_normal + " where ID = " + id_2,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.rows[0][1];
|
||||
should.strictEqual(resultVal, urowid);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
var testBigUROWID_returning = function(strLength, rowidLenExpected, callback) {
|
||||
var str = random.getRandomLengthString(strLength);
|
||||
var urowid, urowidLen;
|
||||
|
@ -516,16 +658,27 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
"insert into " + tableName_normal + " (ID, content) values (:i, :c) returning content into :o",
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
if(urowidLen > 4000) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "ORA-01704: string literal too long");
|
||||
} else {
|
||||
should.not.exist(err);
|
||||
var resultVal;
|
||||
if (typeof (result.outBinds.o) === 'undefined') resultVal = result.outBinds[0][0];
|
||||
else resultVal = result.outBinds.o[0];
|
||||
should.strictEqual(resultVal, urowid);
|
||||
}
|
||||
should.not.exist(err);
|
||||
var resultVal;
|
||||
if (typeof (result.outBinds.o) === 'undefined') resultVal = result.outBinds[0][0];
|
||||
else resultVal = result.outBinds.o[0];
|
||||
should.strictEqual(resultVal, urowid);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = {
|
||||
i: { val : insertID, dir : oracledb.BIND_IN, type : oracledb.NUMBER },
|
||||
c: { val : urowid, dir : oracledb.BIND_IN, type : oracledb.STRING },
|
||||
o: { dir : oracledb.BIND_OUT, type : oracledb.STRING, maxSize: 100 }
|
||||
};
|
||||
connection.execute(
|
||||
"insert into " + tableName_normal + " (ID, content) values (:i, :c) returning content into :o",
|
||||
bindVar,
|
||||
function(err) {
|
||||
should.exist(err);
|
||||
should.strictEqual(err.message, "NJS-016: buffer is too small for OUT binds");
|
||||
cb();
|
||||
}
|
||||
);
|
||||
|
@ -567,6 +720,21 @@ describe('115. urowidDMLBindAsString_indexed.js', function() {
|
|||
cb();
|
||||
}
|
||||
);
|
||||
},
|
||||
function(cb) {
|
||||
var bindVar = {
|
||||
c: { val : urowid, dir : oracledb.BIND_IN, type : oracledb.STRING, maxSize: 100 }
|
||||
};
|
||||
connection.execute(
|
||||
"select * from " + tableName_indexed + " where ROWID = :c",
|
||||
bindVar,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
should.strictEqual(result.rows[0][0], insertID);
|
||||
should.strictEqual(result.rows[0][1], str);
|
||||
cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
|
|
@ -409,15 +409,15 @@ describe('120. urowidProcedureBindAsString_bindinout.js', function() {
|
|||
c: { val: content_in, type: oracledb.STRING, dir: oracledb.BIND_INOUT, maxSize: 1000 }
|
||||
};
|
||||
connection.execute(
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.c;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.c;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var procedureBindInout_update = function(proc_execute, content_1, content_2, expected, callback) {
|
||||
|
|
|
@ -417,15 +417,15 @@ describe('119. urowidProcedureBindAsString_bindout.js', function() {
|
|||
o: { type: oracledb.STRING, dir: oracledb.BIND_OUT }
|
||||
};
|
||||
connection.execute(
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.o;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
proc_execute,
|
||||
bindVar_out,
|
||||
function(err, result) {
|
||||
should.not.exist(err);
|
||||
var resultVal = result.outBinds.o;
|
||||
should.strictEqual(resultVal, expected);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var procedureBindOut_update = function(proc_execute, content_1, content_2, expected, callback) {
|
||||
|
|
|
@ -155,7 +155,7 @@ describe('66. writableProperties.js', function() {
|
|||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -211,7 +211,7 @@ describe('66. writableProperties.js', function() {
|
|||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
});
|
||||
}); // 66.4
|
||||
|
||||
|
|
Loading…
Reference in New Issue