Skip to content

Commit b9d284d

Browse files
author
Christopher Jones
committed
Improve Lob bind test
1 parent 7c6562b commit b9d284d

File tree

2 files changed

+1
-111
lines changed

2 files changed

+1
-111
lines changed

test/list.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,6 @@ Overview of node-oracledb functional tests
12891289
72.2.4 Negative - not providing first parameter
12901290
72.2.5 promise test of createLob()
12911291
72.2.6 call lob.close() multiple times sequentially
1292-
72.2.7 BIND_INOUT, PL/SQL, needs to close out lob explicitly
12931292

12941293
73. poolPing.js
12951294
73.1 the default value of poolPingInterval is 60

test/lobBind2.js

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -894,115 +894,6 @@ describe("72. lobBind2.js", function() {
894894

895895
}); // 72.2.6
896896

897-
it("72.2.7 BIND_INOUT, PL/SQL, needs to close out lob explicitly", function(done) {
898-
899-
var seq = 7, outLobId = 77;
900-
var outFileName = './test/tree.jpg';
901-
var proc = "CREATE OR REPLACE PROCEDURE nodb_proc_blob_inout1 \n" +
902-
" (p_num IN NUMBER, p_from IN NUMBER, p_inout IN OUT BLOB) \n" +
903-
"AS \n" +
904-
"BEGIN \n" +
905-
" insert into nodb_tab_blob72 (id, content) values (p_num, p_inout); \n" +
906-
" select content into p_inout from nodb_tab_blob72 where id = p_from; \n" +
907-
"END nodb_proc_blob_inout1;";
908-
909-
var prepareOutBlob = function(callback) {
910-
911-
var buf = fs.readFileSync(outFileName);
912-
connection.execute(
913-
"INSERT INTO nodb_tab_blob72 (id, content) VALUES (:id, :b)",
914-
{ id: outLobId, b: buf },
915-
{ autoCommit: true },
916-
function(err, result) {
917-
should.not.exist(err);
918-
(result.rowsAffected).should.be.exactly(1);
919-
return callback();
920-
}
921-
);
922-
923-
};
924-
925-
var dotest = function(callback) {
926-
927-
connection.createLob(oracledb.BLOB, function(err, lob) {
928-
should.not.exist(err);
929-
930-
lob.on('error', function(err) {
931-
should.not.exist(err, "lob.on 'error' event.");
932-
});
933-
934-
lob.on('finish', function() {
935-
936-
connection.execute(
937-
"begin nodb_proc_blob_inout1(:id, :oid, :io); end;",
938-
{
939-
id: seq,
940-
oid: outLobId,
941-
io: { type: oracledb.BLOB, dir: oracledb.BIND_INOUT, val: lob }
942-
},
943-
{ autoCommit: true },
944-
function(err, result) {
945-
should.not.exist(err);
946-
var lobout = result.outBinds.io;
947-
948-
lobout.on('close', function(err) {
949-
should.not.exist(err);
950-
951-
return callback();
952-
});
953-
954-
lobout.on('error', function(err) {
955-
should.not.exist(err, "lob.on 'error' event.");
956-
});
957-
958-
var blobData;
959-
lobout.on('data', function(chunk) {
960-
blobData += chunk;
961-
});
962-
963-
lobout.on('finish', function() {
964-
965-
var buf = fs.readFileSync(outFileName);
966-
(blobData).should.eql(buf);
967-
968-
lobout.close(function(err) {
969-
should.not.exist(err);
970-
});
971-
});
972-
973-
}
974-
);
975-
976-
}); // finish event of lob
977-
978-
var inStream = fs.createReadStream(jpgFileName);
979-
inStream.pipe(lob);
980-
981-
inStream.on('error', function(err) {
982-
should.not.exist(err, "inStream.on 'error' event.");
983-
});
984-
985-
});
986-
987-
};
988-
989-
async.series([
990-
function(cb) {
991-
executeSQL(proc, cb);
992-
},
993-
prepareOutBlob,
994-
dotest,
995-
function(cb) {
996-
verifyBlobValue(seq, jpgFileName, cb);
997-
},
998-
function(cb) {
999-
var sql = "DROP PROCEDURE nodb_proc_blob_inout1";
1000-
executeSQL(sql, cb);
1001-
}
1002-
], done);
1003-
1004-
}); // 72.2.7
1005-
1006897
}); // 72.2
1007898

1008-
});
899+
});

0 commit comments

Comments
 (0)