Changeset 449
- Timestamp:
- 07/03/08 20:18:21 (4 years ago)
- Location:
- wiki-toolkit/trunk
- Files:
-
- 2 modified
-
Changes (modified) (1 diff)
-
lib/Wiki/Toolkit/Store/Database.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wiki-toolkit/trunk/Changes
r446 r449 7 7 Changed Wiki::Toolkit::Feed::Listing to use metadata_was instead of 8 8 metadata_wasnt, for efficiency reasons. 9 list_dangling_links, list_backlinks: don't return internal links 10 that are from a node which does not exist. This works around 11 database inconsistencies (introduced by manual deletion of nodes) 12 which should be fixed by adding constraints to the database (see #38) 9 13 10 14 0.75 11 May 2008 -
wiki-toolkit/trunk/lib/Wiki/Toolkit/Store/Database.pm
r441 r449 388 388 croak "Must supply a node name" unless $node; 389 389 my $dbh = $self->dbh; 390 my $sql = "SELECT link_from FROM internal_links WHERE link_to=" 390 # XXX see comment in list_dangling_links 391 my $sql = "SELECT link_from FROM internal_links INNER JOIN 392 node AS node_from ON node_from.name=internal_links.link_from 393 WHERE link_to=" 391 394 . $dbh->quote($node); 392 395 my $sth = $dbh->prepare($sql); … … 413 416 my $self = shift; 414 417 my $dbh = $self->dbh; 418 # XXX this is really hiding an inconsistency in the database; 419 # should really fix the constraints so that this inconsistency 420 # cannot be introduced; also rework this table completely so 421 # that it uses IDs, not node names (will simplify rename_node too) 415 422 my $sql = "SELECT DISTINCT internal_links.link_to 416 FROM internal_links LEFT JOIN node 417 ON node.name=internal_links.link_to 418 WHERE node.version IS NULL"; 423 FROM internal_links INNER JOIN node AS node_from ON 424 node_from.name=internal_links.link_from LEFT JOIN node 425 AS node_to ON node_to.name=internal_links.link_to 426 WHERE node_to.version IS NULL"; 419 427 my $sth = $dbh->prepare($sql); 420 428 $sth->execute or croak $dbh->errstr;
