1
- /* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. */
1
+ /* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. */
2
2
3
3
/******************************************************************************
4
4
*
@@ -41,7 +41,7 @@ oracledb.getConnection(
41
41
42
42
connection . execute (
43
43
"INSERT INTO mylobs (id, c) VALUES (:id, EMPTY_CLOB()) RETURNING c INTO :lobbv" ,
44
- { id : 3 , lobbv : { type : oracledb . CLOB , dir : oracledb . BIND_OUT } } ,
44
+ { id : 2 , lobbv : { type : oracledb . CLOB , dir : oracledb . BIND_OUT } } ,
45
45
{ autoCommit : false } , // a transaction needs to span the INSERT and pipe()
46
46
function ( err , result )
47
47
{
@@ -52,14 +52,6 @@ oracledb.getConnection(
52
52
}
53
53
54
54
var lob = result . outBinds . lobbv [ 0 ] ;
55
- lob . on (
56
- 'error' ,
57
- function ( err )
58
- {
59
- console . log ( "lob.on 'error' event" ) ;
60
- console . error ( err ) ;
61
- } ) ;
62
-
63
55
lob . on (
64
56
'finish' ,
65
57
function ( )
@@ -72,8 +64,21 @@ oracledb.getConnection(
72
64
console . error ( err . message ) ;
73
65
else
74
66
console . log ( "Text inserted successfully." ) ;
67
+ connection . release ( function ( err ) {
68
+ if ( err ) console . error ( err ) ;
69
+ } ) ;
75
70
} ) ;
76
71
} ) ;
72
+ lob . on (
73
+ 'error' ,
74
+ function ( err )
75
+ {
76
+ console . log ( "lob.on 'error' event" ) ;
77
+ console . error ( err ) ;
78
+ connection . release ( function ( err ) {
79
+ if ( err ) console . error ( err . message ) ;
80
+ } ) ;
81
+ } ) ;
77
82
78
83
// See Node.js Streams examples for how to use 'drain' if write() returns false
79
84
lob . write ( 'Hello, ' , 'utf8' , function ( ) { console . log ( "lob.write callback" ) ; } ) ;
0 commit comments