sqldb - TSQLQuery.ParamCheck:=False doesn't Clear Params-List
## Summary Setting explicitely ParamCheck to True/False doesn't clear the Params-List it might have cached from a previous usage ## System Information DB = SQLite Win64-Bit, Lazarus 4.3 (Fixes)-64-Bit, FPC3.2.3 (Fixes)-64-Bit Target: Win 64 ## Steps to reproduce 1) Use the sqldb-Trinity with normal set up (Connection, Transaction, Query) 2) After establishing connection: `MyQuery.Close;` `MyQuery.SQL.Clear;` `MyQuery.SQL.Text:=AnSQLStatementWithSingleParameter; //Count of Params doesn't really matter` `MyQuery.ParamByName(':pAParam').AsString:='Something';` `MyQuery.Open; //Do something or nothing with the Result` `MyQuery.Close;` `MyQuery.ParamCheck:=False; //<-----!!!!!` `MyQuery.SQL.Clear;` `MyQuery.SQL.Text:=AnSQLStatementWithTWOParametersAsLiterals;` `MyQuery.ExecSQL; //--> KABOOM!` ## What is the current bug behavior? Program throws Exception "Index out of Bounds", because despite ParamCheck:=False it still tries to Bind Params, because Params.Count\>0 ## What is the expected (correct) behavior? No Exception and Params are cleared ## Further Thought: Now imagine from the previous Usage Params.Count is EQUAL to the Count of Parameters you want to send as literals..... (untested, though) ## Possible fixes, though no Idea about breaking existing code relying on this `procedure TCustomSQLQuery.SetParamCheck(AValue: Boolean);` `begin` ` Params.Clear; //<---` ` FStatement.ParamCheck:=AValue;` `end;`
issue