3
I’m making a connection to search for data inside the bank on one condition IN()
, but I had trouble implementing it between FDQuery
and the Firebird.
Analyzing the problem I realized that command SQL was arriving at the bank in a condition that was impossible to execute, or was not accepted by FDQuery
. I tried several forms of treatment and it didn’t work.
Then I appealed to what I consider a P.O.G. by creating a variable String
I inserted her in the middle of SQL with the data properly processed so that it is received in the bank in the form that the Firebird can perform.
FDconsult.SQL.Add('SELECT * FROM PED1A WHERE ID_LOJA IN (');
FDconsult.SQL.Add(consulta);
FDconsult.SQL.Add(')');
FDconsult.Open;
What risks do I offer my application by doing this type of P.O.G.?
Depends, how you get the contents of the variable
consulta
? You can put the way you were doing and how you were getting on the bench?– Roberto de Campos
For reasons of logic they would not have problems, but depending on the database used can lose a little in a matter of performance. I don’t know how Firebird treats this case, but in certain banks, when the query is executed with parameters the bank already saves the execution plan and the next time the query is executed it doesn’t need to be done again.
– Confundir