Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fetch PQerrorMessage after connect failure

  • Loading branch information...
commit 7e8555ec4783b98387054974c51cc2133d86e3c1 1 parent f1f01bb
@cxreg cxreg authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/MiniDBD/Pg.pm6
View
10 lib/MiniDBD/Pg.pm6
@@ -17,6 +17,11 @@ sub PQresultStatus (OpaquePointer $result)
is native('libpq')
{ ... }
+sub PQerrorMessage (OpaquePointer $conn)
+ returns Str
+ is native('libpq')
+ { ... }
+
sub PQresultErrorMessage (OpaquePointer $result)
returns Str
is native('libpq')
@@ -84,6 +89,7 @@ class MiniDBD::Pg::StatementHandle does MiniDBD::StatementHandle {
has $!row_count;
has $!field_count;
has $!current_row;
+
method execute(*@params is copy) {
my $statement = $!statement;
@@ -404,6 +410,10 @@ class MiniDBD::Pg:auth<mberends>:ver<0.0.1> {
RaiseError => $RaiseError
);
}
+ else {
+ $!errstr = PQerrorMessage($pg_conn);
+ if $RaiseError { die $!errstr; }
+ }
return $connection;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.