select * from users where username = :username or :username is null
That can be considered slightly better than two queries or slightly worse, depending on who you ask. And it is indeed the state of query reuse if you are not using at least decently smart query builder.
My impression is that many people simply don't have the kind of requirements that call for such advanced run-time query composition.
Comments
It's either two queries or something like this:
select * from users where username = :username or :username is null
That can be considered slightly better than two queries or slightly worse, depending on who you ask. And it is indeed the state of query reuse if you are not using at least decently smart query builder.
My impression is that many people simply don't have the kind of requirements that call for such advanced run-time query composition.