Revision bed19453
Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt
SL/DBUtils.pm | ||
---|---|---|
6 | 6 |
our @ISA = qw(Exporter); |
7 | 7 |
|
8 | 8 |
our @EXPORT = qw(conv_i conv_date conv_dateq do_query selectrow_query do_statement |
9 |
dump_query quote_db_date |
|
9 |
dump_query quote_db_date like
|
|
10 | 10 |
selectfirst_hashref_query selectfirst_array_query |
11 | 11 |
selectall_hashref_query selectall_array_query |
12 | 12 |
selectall_as_map |
... | ... | |
386 | 386 |
return ($token, @vals); |
387 | 387 |
} |
388 | 388 |
|
389 |
sub like { |
|
390 |
my ($string) = @_; |
|
391 |
|
|
392 |
return "%" . SL::Util::trim($string // '') . "%"; |
|
393 |
} |
|
394 |
|
|
389 | 395 |
1; |
390 | 396 |
|
391 | 397 |
|
... | ... | |
459 | 465 |
Treats STR as a database date, quoting it. If STR equals current_date returns an escaped version which is treated as the current date by Postgres. |
460 | 466 |
Returns 'NULL' if STR is empty. |
461 | 467 |
|
468 |
=item like STR |
|
469 |
|
|
470 |
Turns C<STR> into an argument suitable for SQL's C<LIKE> and C<ILIKE> |
|
471 |
operators by Trimming the string C<STR> (removes leading and trailing |
|
472 |
whitespaces) and prepending and appending C<%>. |
|
473 |
|
|
462 | 474 |
=back |
463 | 475 |
|
464 | 476 |
=head2 QUERY FUNCTIONS |
Auch abrufbar als: Unified diff
Funktion »like« von Form nach DBUtils verschoben
Das ist eine Datenbank-Quoting-Funktion und hat daher nichts mehr in
Form zu suchen.