Revision 2b664a1f
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/DBUtils.pm | ||
---|---|---|
3 | 3 |
require Exporter; |
4 | 4 |
@ISA = qw(Exporter); |
5 | 5 |
|
6 |
@EXPORT = qw(conv_i conv_date do_query dump_query); |
|
6 |
@EXPORT = qw(conv_i conv_date do_query selectrow_query dump_query);
|
|
7 | 7 |
|
8 | 8 |
sub conv_i { |
9 | 9 |
my ($value, $default) = @_; |
... | ... | |
26 | 26 |
} |
27 | 27 |
} |
28 | 28 |
|
29 |
sub selectrow_query { |
|
30 |
my ($form, $dbh, $query) = splice(@_, 0, 3); |
|
31 |
|
|
32 |
if (0 == scalar(@_)) { |
|
33 |
my @results = $dbh->selectrow_array($query); |
|
34 |
$form->dberror($query) if ($dbh->err); |
|
35 |
return @results; |
|
36 |
} else { |
|
37 |
my @results = $dbh->selectrow_array($query, undef, @_); |
|
38 |
$form->dberror($query . " (" . join(", ", @_) . ")") if ($dbh->err); |
|
39 |
return @results; |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
29 | 43 |
sub dump_query { |
30 | 44 |
my ($level, $msg, $query) = splice(@_, 0, 3); |
31 | 45 |
while ($query =~ /\?/) { |
Auch abrufbar als: Unified diff
Eine weitere Datenbankhilfsfunktion eingebaut.