From 985656d04644dbcabdb5d9dc606b1029ad77eb7a Mon Sep 17 00:00:00 2001 From: Arne Johannessen Date: Sun, 17 Nov 2024 08:46:58 +0100 Subject: [PATCH] Force statement execution before execution error check It's necessary to call a method on the result within the try block. Any method will do; has_next() is one of the cheapest ones to call. Resolves #28. --- lib/REST/Neo4p/Agent/Neo4j/Driver.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/REST/Neo4p/Agent/Neo4j/Driver.pm b/lib/REST/Neo4p/Agent/Neo4j/Driver.pm index 31605b3..452a118 100644 --- a/lib/REST/Neo4p/Agent/Neo4j/Driver.pm +++ b/lib/REST/Neo4p/Agent/Neo4j/Driver.pm @@ -229,6 +229,7 @@ sub run_in_session { $params = {} unless defined $params; try { $self->{_last_result} = $self->session->run($qry, $params); + $self->{_last_result}->has_next; # Make sure the query has executed and any errors have been thrown } catch { $self->{_last_errors} = $_; }; @@ -243,6 +244,7 @@ sub run_in_transaction { $params = {} unless defined $params; try { $self->{_last_result} = $tx->run($qry, $params); + $self->{_last_result}->has_next; # Make sure the query has executed and any errors have been thrown } catch { $self->{_last_errors} = $_; };