Last active
August 29, 2015 14:05
-
-
Save marciojrtorres/1cde5167d425a73fe0ca to your computer and use it in GitHub Desktop.
if vazio para usar else
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pesq.vazio()) { | |
} else { | |
sql = "WHERE descricao LIKE '%" + pesq.palavras() + "%'"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! pesq.vazio()) { | |
sql = "WHERE descricao LIKE '%" + pesq.palavras() + "%'"; | |
} | |
// ou ainda melhor se o objeto possuir um método temPalavras(), assim elimina o teste negativo | |
if (pesq.temPalavras()) { | |
sql = "WHERE descricao LIKE '%" + pesq.palavras() + "%'"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment