pg: Statement execution + better error reporting
This commit is contained in:
parent
922f19e39b
commit
711300b227
6 changed files with 124 additions and 26 deletions
10
FU/PG.pm
10
FU/PG.pm
|
|
@ -9,9 +9,7 @@ package FU::PG::conn {
|
|||
};
|
||||
|
||||
package FU::PG::error {
|
||||
use overload '""' => sub($e, @) {
|
||||
$e->{verbose_message} || "$e->{severity}: $e->{message}\n";
|
||||
};
|
||||
use overload '""' => sub($e, @) { $e->{full_message} };
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -100,9 +98,9 @@ of bind parameters. C<$sql> can only hold a single statement.
|
|||
Parameters can be referenced from C<$sql> with numbered placeholders, where
|
||||
C<$1> refers to the first parameter, C<$2> to the second, etc. Be careful to
|
||||
not accidentally interpolate perl's C<$1> and C<$2>. Using a question mark for
|
||||
placeholders, as is common with L<DBI>, is not supported. If a placeholder
|
||||
mentioned in C<$sql> is not present in C<@params>, I<NULL> is assumed instead.
|
||||
Excess C<@params> that are not referenced by C<$sql> are ignored.
|
||||
placeholders, as is common with L<DBI>, is not supported. An error is thrown
|
||||
when attempting to execute a query where the number of C<@params> does not
|
||||
match the number of placeholders in C<$sql>.
|
||||
|
||||
Note that this method just creates a statement object, the given query is not
|
||||
prepared or executed until the appropriate statement methods (see below) are
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue