Skip to content

Commit

Permalink
Fix issue with UPDATE FROM that selected random data.
Browse files Browse the repository at this point in the history
  • Loading branch information
schveiguy committed Sep 3, 2024
1 parent 8efbcb3 commit 3412ab6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions source/sqlbuilder/dialect/sqlite.d
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,18 @@ string sql(Item)(Update!Item upd)
altFrag.expr.data.append(upd.joins.expr.data[1 .. $]
.map!(x => getSpec(x) == Spec.tableid && x[2 .. $] == origTable[2 .. $] ? altTableName : x));
addFragment(altFrag, " FROM ");
put(app, ` WHERE "_"."id"=`);
app.sqlPut!(false, true)(origTable);
put(app, `."id"`);

// CONDITIONS
addFragment(upd.conditions, " AND (", ")");
}
else
{
// CONDITIONS
addFragment(upd.conditions, " WHERE (", ")");
}
// CONDITIONS
addFragment(upd.conditions, " WHERE (", ")");

return app.data;
}
Expand Down

0 comments on commit 3412ab6

Please sign in to comment.