Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f3c5ef3b

Von Bernd Bleßmann vor etwa 11 Jahren hinzugefügt

  • ID f3c5ef3b1eb1ca09d3821538500af85f3b1ffcd2
  • Vorgänger 03b6d9ab
  • Nachfolger e112111e

Row level lock statt table level lock verwenden.

Betrifft #2368.

Unterschiede anzeigen:

SL/TransNumber.pm
113 113
  my %filters = $self->_get_filters();
114 114

  
115 115
  $self->dbh->begin_work if $self->dbh->{AutoCommit};
116
  do_query($form, $self->dbh, qq|LOCK TABLE defaults|);
117
  do_query($form, $self->dbh, qq|LOCK TABLE business|) if $self->business_id;
118 116

  
119 117
  my $where = $filters{where} ? ' WHERE ' . $filters{where} : '';
120 118
  my $query = <<SQL;
......
126 124
  my %numbers_in_use = selectall_as_map($form, $self->dbh, $query, $filters{trans_number}, 'in_use');
127 125

  
128 126
  my $business_number;
129
  ($business_number) = selectfirst_array_query($form, $self->dbh, qq|SELECT customernumberinit FROM business WHERE id = ?|, $self->business_id) if $self->business_id;
127
  ($business_number) = selectfirst_array_query($form, $self->dbh, qq|SELECT customernumberinit FROM business WHERE id = ? FOR UPDATE|, $self->business_id) if $self->business_id;
130 128
  my $number         = $business_number;
131
  ($number)          = selectfirst_array_query($form, $self->dbh, qq|SELECT $filters{numberfield} FROM defaults|)                               if !$number;
129
  ($number)          = selectfirst_array_query($form, $self->dbh, qq|SELECT $filters{numberfield} FROM defaults FOR UPDATE|)                               if !$number;
132 130
  if ($filters{numberfield} eq 'assemblynumber' and length($number) < 1) {
133 131
    $filters{numberfield} = 'articlenumber';
134
    ($number)          = selectfirst_array_query($form, $self->dbh, qq|SELECT $filters{numberfield} FROM defaults|)                               if !$number;
132
    ($number)        = selectfirst_array_query($form, $self->dbh, qq|SELECT $filters{numberfield} FROM defaults FOR UPDATE|)                               if !$number;
135 133
  }
136 134
  $number          ||= '';
137 135
  my $sequence       = SL::PrefixedNumber->new(number => $number);

Auch abrufbar als: Unified diff