Changeset 24500 for trunk/Nebulous-Server/lib/Nebulous/Server.pm
- Timestamp:
- Jun 18, 2009, 4:48:52 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r24412 r24500 1581 1581 TRANS: while (1) { 1582 1582 eval { 1583 my $instances; 1583 1584 my $so_id; 1584 my $ins tances;1585 # get so_id1585 my $ins_id; 1586 # find so_id for key and get count of instances 1586 1587 { 1587 my $query = $db->prepare_cached( $sql->get_object_from_uri ); 1588 my $rows = $query->execute( $uri ); 1589 1588 my $query = $db->prepare_cached( $sql->get_instance_count_by_ext_id ); 1589 my $rows = $query->execute($key->path); 1590 1590 unless ( $rows > 0 ) { 1591 1591 $query->finish; 1592 die( "$key has no associated instances - this should not happen" ); 1593 } 1594 1595 my $record = $query->fetchrow_hashref; 1596 $so_id = $record->{ 'so_id' }; 1597 $instances = $record->{ 'count(ins_id)' }; 1598 $query->finish; 1599 } 1600 1601 # find ins_id for uri 1602 { 1603 my $query = $db->prepare_cached( $sql->get_instance_by_uri ); 1604 my $rows = $query->execute($so_id, $uri); 1605 unless ( $rows > 0) { 1606 $query->finish; 1592 1607 die( "no instance is associated with uri" ); 1593 1608 } 1594 1609 1595 $so_id = $query->fetchrow_hashref->{ 'so_id' }; 1596 $query->finish; 1597 1598 } 1599 1600 { 1601 my $query = $db->prepare_cached( $sql->get_instance_count ); 1602 $query->execute( $so_id ); 1603 1604 $instances = $query->fetchrow_hashref->{ 'count(ins_id)' }; 1610 $ins_id = $query->fetchrow_hashref->{ 'ins_id' }; 1605 1611 $query->finish; 1606 1612 } … … 1608 1614 # remove instance 1609 1615 { 1610 my $query = $db->prepare_cached( $sql->delete_instance );1611 my $rows = $query->execute( $ uri);1616 my $query = $db->prepare_cached( $sql->delete_instance_by_ins_id ); 1617 my $rows = $query->execute( $ins_id ); 1612 1618 $query->finish; 1613 1619 1614 # if we affected something other then two rows something very bad1615 # has happened1620 # if we affected something other then one row something very 1621 # bad has happened 1616 1622 unless ( $rows == 1 ) { 1617 1623 die( "affected row count is $rows instead of 1" );
Note:
See TracChangeset
for help on using the changeset viewer.
