X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/600c47b8afb65850c2b574cb5f32a3bae8ac40ff..a45d8cbe5ee45a89a61465a1e2c4a43b74ed375d:/SL/DBUpgrade2/Base.pm diff --git a/SL/DBUpgrade2/Base.pm b/SL/DBUpgrade2/Base.pm index 9995215c3..2c1e11114 100644 --- a/SL/DBUpgrade2/Base.pm +++ b/SL/DBUpgrade2/Base.pm @@ -37,15 +37,15 @@ sub execute_script { sub db_error { my ($self, $msg) = @_; - die $self->locale->text("Database update error:") . "
$msg
" . $DBI::errstr; + die $::locale->text("Database update error:") . "
$msg
" . $DBI::errstr; } sub db_query { - my ($self, $query, $may_fail) = @_; + my ($self, $query, %params) = @_; - return if $self->dbh->do($query); + return if $self->dbh->do($query, undef, @{ $params{bind} || [] }); - $self->db_error($query) unless $may_fail; + $self->db_error($query) unless $params{may_fail}; $self->dbh->rollback; $self->dbh->begin_work; @@ -204,13 +204,24 @@ C<$coa_name>. Outputs an error message C<$message> to the user and aborts execution. -=item C +=item C -Executes an SQL query. What the method does if the query fails depends -on C<$may_fail>. If it is falsish then the method will simply die -outputting the error message via L. If C<$may_fail> is -trueish then the current transaction will be rolled back, a new one -will be started +Executes an SQL query. The following parameters are supported: + +=over 2 + +=item C + +What the method does if the query fails depends on this parameter. If +it is falsish (the default) then the method will simply die outputting +the error message via L. If C is trueish then the +current transaction will be rolled back, a new one will be started. + +=item C + +An optional array reference containing bind parameter for the query. + +=back =item C