Revision 8c7e4493
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/DBUtils.pm | ||
---|---|---|
7 | 7 |
dump_query quote_db_date |
8 | 8 |
selectfirst_hashref_query selectfirst_array_query |
9 | 9 |
selectall_hashref_query selectall_array_query |
10 |
selectall_as_map |
|
10 | 11 |
prepare_execute_query prepare_query); |
11 | 12 |
|
12 | 13 |
sub conv_i { |
... | ... | |
194 | 195 |
return @ret; |
195 | 196 |
} |
196 | 197 |
|
198 |
sub selectall_as_map { |
|
199 |
$main::lxdebug->enter_sub(2); |
|
200 |
|
|
201 |
my ($form, $dbh, $query, $key_col, $value_col) = splice(@_, 0, 5); |
|
202 |
|
|
203 |
my $sth = prepare_execute_query($form, $dbh, $query, @_); |
|
204 |
|
|
205 |
my %hash; |
|
206 |
if ('' eq ref $value_col) { |
|
207 |
while (my $ref = $sth->fetchrow_hashref()) { |
|
208 |
$hash{$ref->{$key_col}} = $ref->{$value_col}; |
|
209 |
} |
|
210 |
} else { |
|
211 |
while (my $ref = $sth->fetchrow_hashref()) { |
|
212 |
$hash{$ref->{$key_col}} = { map { $_ => $ref->{$_} } @{ $value_col } }; |
|
213 |
} |
|
214 |
} |
|
215 |
|
|
216 |
$sth->finish(); |
|
217 |
|
|
218 |
$main::lxdebug->leave_sub(2); |
|
219 |
|
|
220 |
return %hash; |
|
221 |
} |
|
222 |
|
|
197 | 223 |
1; |
198 | 224 |
|
199 | 225 |
|
... | ... | |
304 | 330 |
|
305 | 331 |
Prepares and executes a query using DBUtils functions, retireves all data from the database, and returns it in hashref mode. This is slightly confusing, as the data structure will actually be a reference to an array, containing hashrefs for each row. |
306 | 332 |
|
333 |
=item selectall_as_map FORM,DBH,QUERY,KEY_COL,VALUE_COL,ARRAY |
|
334 |
|
|
335 |
Prepares and executes a query using DBUtils functions, retireves all data from the database, and creates a hash from the results using KEY_COL as the column for the hash keys and VALUE_COL for its values. |
|
336 |
|
|
307 | 337 |
=back |
308 | 338 |
|
309 | 339 |
=head2 DEBUG FUNCTIONS |
Auch abrufbar als: Unified diff
Umstellung der Benutzerverwaltung von Dateien im Verzeichnis "users" auf die Verwendung einer Authentifizierungsdatenbank.
Es ist erforderlich, die Dateien doc/UPGRADE und doc/INSTALL/index.html zu lesen und die angesprochenen Punkte auszuführen, um nach einem Upgrade weiter arbeiten zu können.