Skip to content

Commit

Permalink
Apply the different-entity check as part of the SQL query rather than…
Browse files Browse the repository at this point in the history
… as part of local resultset filtering (#94)
  • Loading branch information
nevali committed Nov 16, 2016
1 parent 2d80ade commit 66c8e71
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions twine/generate/triggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,13 @@ spindle_trigger_apply(SPINDLEENTRY *entry)
{
return 0;
}
rs = sql_queryf(entry->generate->db, "SELECT \"id\", \"flags\", \"triggerid\" FROM \"triggers\" WHERE \"triggerid\" = %Q", entry->id);
rs = sql_queryf(entry->generate->db, "SELECT \"id\", \"flags\", \"triggerid\" FROM \"triggers\" WHERE \"triggerid\" = %Q AND \"triggerid\" <> \"id\"", entry->id);
if(!rs)
{
return -1;
}
for(; !sql_stmt_eof(rs); sql_stmt_next(rs))
{
/* Never apply a trigger to the entry itself */
if(!strcmp(sql_stmt_str(rs, 0), sql_stmt_str(rs, 2)))
{
continue;
}
flags = (int) sql_stmt_long(rs, 1);
if(!flags)
{
Expand Down

0 comments on commit 66c8e71

Please sign in to comment.