File tree Expand file tree Collapse file tree
vertx-db2-client/src/main/java/examples
vertx-mssql-client/src/main/java/examples
vertx-mysql-client/src/main/java/examples
vertx-oracle-client/src/main/java/examples
vertx-pg-client/src/main/java/examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ public void usingCursors03(SqlConnection connection) {
322322 .prepare ("SELECT * FROM users WHERE first_name LIKE ?" )
323323 .onComplete (ar0 -> {
324324 if (ar0 .succeeded ()) {
325- PreparedStatement pq = ar0 .result ();
325+ PreparedStatement ps = ar0 .result ();
326326
327327 // Streams require to run within a transaction
328328 connection
@@ -332,15 +332,17 @@ public void usingCursors03(SqlConnection connection) {
332332 Transaction tx = ar1 .result ();
333333
334334 // Fetch 50 rows at a time
335- RowStream <Row > stream = pq .createStream (50 , Tuple .of ("julien" ));
335+ RowStream <Row > stream = ps .createStream (50 , Tuple .of ("julien" ));
336336
337337 // Use the stream
338338 stream .exceptionHandler (err -> {
339339 System .out .println ("Error: " + err .getMessage ());
340+ ps .close ();
340341 });
341342 stream .endHandler (v -> {
342343 tx .commit ();
343344 System .out .println ("End of stream" );
345+ ps .close ();
344346 });
345347 stream .handler (row -> {
346348 System .out .println ("User: " + row .getString ("last_name" ));
Original file line number Diff line number Diff line change @@ -341,17 +341,19 @@ public void usingCursors03(SqlConnection connection) {
341341 .prepare ("SELECT * FROM users WHERE age > @p1" )
342342 .onComplete (ar1 -> {
343343 if (ar1 .succeeded ()) {
344- PreparedStatement pq = ar1 .result ();
344+ PreparedStatement ps = ar1 .result ();
345345
346346 // Fetch 50 rows at a time
347- RowStream <Row > stream = pq .createStream (50 , Tuple .of (18 ));
347+ RowStream <Row > stream = ps .createStream (50 , Tuple .of (18 ));
348348
349349 // Use the stream
350350 stream .exceptionHandler (err -> {
351351 System .out .println ("Error: " + err .getMessage ());
352+ ps .close ();
352353 });
353354 stream .endHandler (v -> {
354355 System .out .println ("End of stream" );
356+ ps .close ();
355357 });
356358 stream .handler (row -> {
357359 System .out .println ("User: " + row .getString ("last_name" ));
Original file line number Diff line number Diff line change @@ -312,17 +312,19 @@ public void usingCursors03(SqlConnection connection) {
312312 .prepare ("SELECT * FROM users WHERE age > ?" )
313313 .onComplete (ar1 -> {
314314 if (ar1 .succeeded ()) {
315- PreparedStatement pq = ar1 .result ();
315+ PreparedStatement ps = ar1 .result ();
316316
317317 // Fetch 50 rows at a time
318- RowStream <Row > stream = pq .createStream (50 , Tuple .of (18 ));
318+ RowStream <Row > stream = ps .createStream (50 , Tuple .of (18 ));
319319
320320 // Use the stream
321321 stream .exceptionHandler (err -> {
322322 System .out .println ("Error: " + err .getMessage ());
323+ ps .close ();
323324 });
324325 stream .endHandler (v -> {
325326 System .out .println ("End of stream" );
327+ ps .close ();
326328 });
327329 stream .handler (row -> {
328330 System .out .println ("User: " + row .getString ("last_name" ));
Original file line number Diff line number Diff line change @@ -313,17 +313,19 @@ public void usingCursors03(SqlConnection connection) {
313313 .prepare ("SELECT * FROM users WHERE age > ?" )
314314 .onComplete (ar1 -> {
315315 if (ar1 .succeeded ()) {
316- PreparedStatement pq = ar1 .result ();
316+ PreparedStatement ps = ar1 .result ();
317317
318318 // Fetch 50 rows at a time
319- RowStream <Row > stream = pq .createStream (50 , Tuple .of (18 ));
319+ RowStream <Row > stream = ps .createStream (50 , Tuple .of (18 ));
320320
321321 // Use the stream
322322 stream .exceptionHandler (err -> {
323323 System .out .println ("Error: " + err .getMessage ());
324+ ps .close ();
324325 });
325326 stream .endHandler (v -> {
326327 System .out .println ("End of stream" );
328+ ps .close ();
327329 });
328330 stream .handler (row -> {
329331 System .out .println ("User: " + row .getString ("last_name" ));
Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ public void usingCursors03(SqlConnection connection) {
319319 .prepare ("SELECT * FROM users WHERE first_name LIKE $1" )
320320 .onComplete (ar0 -> {
321321 if (ar0 .succeeded ()) {
322- PreparedStatement pq = ar0 .result ();
322+ PreparedStatement ps = ar0 .result ();
323323
324324 // Streams require to run within a transaction
325325 connection
@@ -329,11 +329,12 @@ public void usingCursors03(SqlConnection connection) {
329329 Transaction tx = ar1 .result ();
330330
331331 // Fetch 50 rows at a time
332- RowStream <Row > stream = pq .createStream (50 , Tuple .of ("julien" ));
332+ RowStream <Row > stream = ps .createStream (50 , Tuple .of ("julien" ));
333333
334334 // Use the stream
335335 stream .exceptionHandler (err -> {
336336 System .out .println ("Error: " + err .getMessage ());
337+ ps .close ();
337338 });
338339 stream .endHandler (v -> {
339340 // Close the stream to release the resources in the database
@@ -342,7 +343,8 @@ public void usingCursors03(SqlConnection connection) {
342343 .onComplete (closed -> {
343344 tx .commit ()
344345 .onComplete (committed -> {
345- System .out .println ("End of stream" );
346+ System .out .println ("End of stream" );
347+ ps .close ();
346348 });
347349 });
348350 });
You can’t perform that action at this time.
0 commit comments