=head1 NAME
-SL::DBUTils.pm: All about database connections in kivitendo
+SL::DBUtils.pm: All about database connections in kivitendo
=head1 SYNOPSIS
conv_dateq($str)
quote_db_date($date)
+ my $dbh = SL::DB->client->dbh;
+
do_query($form, $dbh, $query)
do_statement($form, $sth, $query)
my $all_results_ref = selectall_hashref_query($form, $dbh, $query)
my $first_result_hash_ref = selectfirst_hashref_query($form, $dbh, $query);
- my @first_result = selectfirst_array_query($form, $dbh, $query); # ==
+ my @first_result = selectfirst_array_query($form, $dbh, $query);
my @first_result = selectrow_query($form, $dbh, $query);
my %sort_spec = create_sort_spec(%params);
C<DBH> is a handle to the database, as returned by the C<DBI::connect> routine.
If you don't have an active connection, you can use
-C<<$::form->get_standard_dbh>> to get a generic no_auto connection or get a
-C<Rose::DB::Object> handle from any RDBO class with
-C<<SL::DB::Part->new->db->dbh>>. The former will be without autocommit, the
-latter with autocommit.
+C<SL::DB->client->dbh> or get a C<Rose::DB::Object> handle from any RDBO class with
+C<<SL::DB::Part->new->db->dbh>>. In both cases the handle will have AutoCommit set.
See C<PITFALLS AND CAVEATS> for common errors.
selectall_hashref_query(...)
-=head2 Peformance
+=head2 Performance
Since it is really easy to write something like
people do so from time to time. When writing code, consider this a ticking
timebomb. Someone out there has a database with 1mio parts in it, and this
-statement just shovelled ate 2GB of memory and timeouted the request.
+statement just gobbled up 2GB of memory and timeouted the request.
Parts may be the obvious example, but the same applies to customer, vendors,
records, projects or custom variables.