X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDBUtils.pm;h=9dfe2715392671da3b882c875e9e7d12d8b44f42;hb=8e0f6e70;hp=200f421e6acb469e83f360f3b0bfd6efe3f1f8c2;hpb=bed19453fb654f69ad972911a4533ca89f8ae0c9;p=kivitendo-erp.git diff --git a/SL/DBUtils.pm b/SL/DBUtils.pm index 200f421e6..9dfe27153 100644 --- a/SL/DBUtils.pm +++ b/SL/DBUtils.pm @@ -348,9 +348,9 @@ sub add_token { id => \&conv_i, bool => \&conv_b, date => \&conv_date, - start => sub { $_[0] . '%' }, - end => sub { '%' . $_[0] }, - substr => sub { '%' . $_[0] . '%' }, + start => sub { trim($_[0]) . '%' }, + end => sub { '%' . trim($_[0]) }, + substr => sub { like($_[0]) }, ); my $_long_token = sub { @@ -397,6 +397,8 @@ sub like { __END__ +=encoding utf-8 + =head1 NAME SL::DBUTils.pm: All about database connections in kivitendo @@ -426,23 +428,100 @@ SL::DBUTils.pm: All about database connections in kivitendo =head1 DESCRIPTION -DBUtils is the attempt to reduce the amount of overhead it takes to retrieve information from the database in kivitendo. Previously it would take about 15 lines of code just to get one single integer out of the database, including failure procedures and importing the necessary packages. Debugging would take even more. +DBUtils provides wrapper functions for low level database retrieval. It saves +you the trouble of mucking around with statement handles for small databse +queries and does exception handling in the common cases for you. + +Query and retrieval function share the parameter scheme: + + query_or_retrieval(C