2020 *
2121 * DESCRIPTION
2222 * Show the auto commit behavior.
23- *
23+ *
2424 * By default, node-oracledb does not commit on execute.
2525 * The driver also has commit() and rollback() methods to explicitly control transactions.
26- *
26+ *
2727 * Note: when a connection is closed, any open transaction will be committed.
2828 *
2929 *****************************************************************************/
@@ -52,7 +52,7 @@ oracledb.getConnection(
5252 return ;
5353 }
5454 console . log ( "Table created" ) ;
55-
55+
5656 connection1 . execute (
5757 "INSERT INTO test VALUES (:id, :nm)" ,
5858 [ 1 , 'Chris' ] , // Bind values
@@ -61,7 +61,7 @@ oracledb.getConnection(
6161 {
6262 if ( err ) { console . error ( err . message ) ; return ; }
6363 console . log ( "Rows inserted: " + result . rowsAffected ) ; // 1
64-
64+
6565 connection1 . execute (
6666 "INSERT INTO test VALUES (:id, :nm)" ,
6767 [ 2 , 'Alison' ] , // Bind values
@@ -70,7 +70,7 @@ oracledb.getConnection(
7070 {
7171 if ( err ) { console . error ( err . message ) ; return ; }
7272 console . log ( "Rows inserted: " + result . rowsAffected ) ; // 1
73-
73+
7474 // Create a second connection
7575 oracledb . getConnection (
7676 {
@@ -95,14 +95,14 @@ oracledb.getConnection(
9595 // This will only show 'Chris' because inserting 'Alison' is not commited by default.
9696 // Uncomment the isAutoCommit option above and you will see both rows
9797 console . log ( result . rows ) ;
98-
98+
9999 connection1 . execute (
100100 "DROP TABLE test" ,
101101 function ( err )
102102 {
103103 if ( err ) { console . error ( err . message ) ; return ; }
104104 console . log ( "Table dropped" ) ;
105-
105+
106106 connection2 . release (
107107 function ( err )
108108 {
@@ -112,12 +112,12 @@ oracledb.getConnection(
112112 {
113113 if ( err ) { console . error ( err . message ) ; return ; }
114114 } ) ;
115-
115+
116116 } ) ;
117117 } ) ;
118118 } ) ;
119119 } ) ;
120120 } ) ;
121- } ) ;
121+ } ) ;
122122 } ) ;
123123 } ) ;
0 commit comments