Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 52683706

Von G. Richardson vor mehr als 5 Jahren hinzugefügt

  • ID 526837064c4c64cc1dd6e4cf87f5911e5ea26521
  • Vorgänger cdd986ac
  • Nachfolger 4b29b4b6

SL::DBUtils - POD zu AutoCommit aktualisiert + Typos

Unterschiede anzeigen:

SL/DBUtils.pm
408 408

  
409 409
=head1 NAME
410 410

  
411
SL::DBUTils.pm: All about database connections in kivitendo
411
SL::DBUtils.pm: All about database connections in kivitendo
412 412

  
413 413
=head1 SYNOPSIS
414 414

  
......
419 419
  conv_dateq($str)
420 420
  quote_db_date($date)
421 421

  
422
  my $dbh = SL::DB->client->dbh;
423

  
422 424
  do_query($form, $dbh, $query)
423 425
  do_statement($form, $sth, $query)
424 426

  
......
428 430
  my $all_results_ref       = selectall_hashref_query($form, $dbh, $query)
429 431
  my $first_result_hash_ref = selectfirst_hashref_query($form, $dbh, $query);
430 432

  
431
  my @first_result =  selectfirst_array_query($form, $dbh, $query);  # ==
433
  my @first_result =  selectfirst_array_query($form, $dbh, $query);
432 434
  my @first_result =  selectrow_query($form, $dbh, $query);
433 435

  
434 436
  my %sort_spec = create_sort_spec(%params);
......
454 456

  
455 457
C<DBH> is a handle to the database, as returned by the C<DBI::connect> routine.
456 458
If you don't have an active connection, you can use
457
C<<$::form->get_standard_dbh>> to get a generic no_auto connection or get a
458
C<Rose::DB::Object> handle from any RDBO class with
459
C<<SL::DB::Part->new->db->dbh>>. The former will be without autocommit, the
460
latter with autocommit.
459
C<SL::DB->client->dbh> or get a C<Rose::DB::Object> handle from any RDBO class with
460
C<<SL::DB::Part->new->db->dbh>>. In both cases the handle will have AutoCommit set.
461 461

  
462 462
See C<PITFALLS AND CAVEATS> for common errors.
463 463

  
......
514 514
  selectall_hashref_query(...)
515 515

  
516 516

  
517
=head2 Peformance
517
=head2 Performance
518 518

  
519 519
Since it is really easy to write something like
520 520

  
......
522 522

  
523 523
people do so from time to time. When writing code, consider this a ticking
524 524
timebomb. Someone out there has a database with 1mio parts in it, and this
525
statement just shovelled ate 2GB of memory and timeouted the request.
525
statement just gobbled up 2GB of memory and timeouted the request.
526 526

  
527 527
Parts may be the obvious example, but the same applies to customer, vendors,
528 528
records, projects or custom variables.

Auch abrufbar als: Unified diff