Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1f932ad

Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt

  • ID d1f932ad48cf69e11e55d10d65fb6c5e528ea55e
  • Vorgänger 4efe2175
  • Nachfolger 7942a6ac

Die Rückgabewerte der Funktionen DBI::do und DBH::execute zurückgeben.

Unterschiede anzeigen:

SL/DBUtils.pm
37 37

  
38 38
  dump_query(LXDebug::QUERY, '', $query, @_);
39 39

  
40
  my $result;
40 41
  if (0 == scalar(@_)) {
41
    $dbh->do($query) || $form->dberror($query);
42
    $result = $dbh->do($query)            || $form->dberror($query);
42 43
  } else {
43
    $dbh->do($query, undef, @_) ||
44
      $form->dberror($query . " (" . join(", ", @_) . ")");
44
    $result = $dbh->do($query, undef, @_) || $form->dberror($query . " (" . join(", ", @_) . ")");
45 45
  }
46 46

  
47 47
  $main::lxdebug->leave_sub(2);
48

  
49
  return $result;
48 50
}
49 51

  
50 52
sub selectrow_query { &selectfirst_array_query }
......
56 58

  
57 59
  dump_query(LXDebug::QUERY, '', $query, @_);
58 60

  
61
  my $result;
59 62
  if (0 == scalar(@_)) {
60
    $sth->execute()   || $form->dberror($query);
63
    $result = $sth->execute()   || $form->dberror($query);
61 64
  } else {
62
    $sth->execute(@_) || $form->dberror($query . " (" . join(", ", @_) . ")");
65
    $result = $sth->execute(@_) || $form->dberror($query . " (" . join(", ", @_) . ")");
63 66
  }
64 67

  
65 68
  $main::lxdebug->leave_sub(2);
69

  
70
  return $result;
66 71
}
67 72

  
68 73
sub dump_query {
......
337 342

  
338 343
Uses DBI::do to execute QUERY on DBH using ARRAY for binding values. FORM is only needed for error handling, but should always be passed nevertheless. Use this for insertions or updates that don't need to be prepared.
339 344

  
345
Returns the result of DBI::do which is -1 in case of an error and the number of affected rows otherwise.
346

  
340 347
=item do_statement FORM,STH,QUERY,ARRAY
341 348

  
342 349
Uses DBI::execute to execute QUERY on DBH using ARRAY for binding values. As with do_query, FORM is only used for error handling. If you are unsure what to use, refer to the documentation of DBI::do and DBI::execute.
343 350

  
351
Returns the result of DBI::execute which is -1 in case of an error and the number of affected rows otherwise.
352

  
344 353
=item prepare_execute_query FORM,DBH,QUERY,ARRAY
345 354

  
346 355
Prepares and executes QUERY on DBH using DBI::prepare and DBI::execute. ARRAY is passed as binding values to execute.

Auch abrufbar als: Unified diff