Topic: for performance of requests
Prompt, in what side to look.
The example, is in a class methods for performance of requests.
procedure InitQuery (var Query: TIBQuery; ParamNames: string; ParamValues: array of Variant); var Par: TParam; pc, i:Integer; begin pc: = WordCount (ParamNames, '; ')-1; for i: = 0 to pc do begin par: = Query. Params. FindParam (ExtractWord (ParamNames, '; ', i+1)); par. Value: = ParamValues [i];
function QSelSQL (SQL, ParamNames: string; ParamValues: array of Variant): TIBQuery; begin IBQuery1.SQL.Add (SQL); InitQuery (IBQuery1, ParamNames, ParamValues); IBQuery1.Prepare; IBQuery1.Open; Result: = IBQuery1;
Q: = QSelSQL (' select * from table where field =:field ', ' field ', [' 1 '])
If in ParamValues to transfer it is more than 13 characters an error
EIBClientError with message Trying to store a string of length 14 into a field that can only contant 13
I understand that swears for length of a line but why so it turns out?
If simply to write
IBQuery1.Transaction. StartTransaction; IBQuery1.SQL.Clear; IBQuery1.SQL.Add (' select * from table where field =:field '); IBQuery1. ParamByName (' field ').asstring: ='11111111111111111 '; IBQuery1.Prepare; IBQuery1.Open;