Changeset 1733
- Timestamp:
- 03/04/16 10:28:11 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r1694 r1733 178 178 sub new { 179 179 my ($class, $base, $id) = @_; 180 my $sth = $base->db->prepare_cached( 181 sprintf(q{select 1 from %s where %s = ? %s}, 182 $base->db->quote_identifier($class->_object_table), 183 $base->db->quote_identifier($class->_key_field), 184 ($base->{wexported} ? '' : 'and exported = true'), 185 ), 186 ); 187 my $count = $sth->execute($id); 188 $sth->finish; 189 ($count || 0) == 1 or return; 180 181 my $__cache = $base->{__cache}{"_" . $class->type}; 182 183 if (!(exists($__cache->{$id}) 184 && $__cache->{$id}{__time} >= time - 1)) { 185 186 my $sth = $base->db->prepare_cached( 187 sprintf(q{select 1 from %s where %s = ? %s}, 188 $base->db->quote_identifier($class->_object_table), 189 $base->db->quote_identifier($class->_key_field), 190 ($base->{wexported} ? '' : 'and exported = true'), 191 ), 192 ); 193 my $count = $sth->execute($id); 194 $sth->finish; 195 ($count || 0) == 1 or return; 196 } 190 197 $class->SUPER::new($base, $id); 191 198 } … … 284 291 my ($class, $base, $id) = @_; 285 292 293 my $__cache = $base->{__cache}{"_" . $class->type}; 294 286 295 my $obj = $base->get_object($class->type, $id) 287 296 or return; … … 294 303 ) 295 304 ); 296 $sthd->execute($id); 305 my $res = $sthd->execute($id); 306 if ($res) { 307 delete($__cache->{$id}); 308 } 309 310 $res 297 311 } 298 312
Note: See TracChangeset
for help on using the changeset viewer.