Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Params[].Size
Sun, Mar 6 2016 8:43 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I'm in the process of adding an extra function to my subclassed query

procedure TnlhQuery.AdjustParameters;
var
Cntr: integer;
begin
if FTruncate or FRTrimStrings or FNullEmptyStrings then begin
 for Cntr := 0 to ParamCount - 1 do begin
  if Params[Cntr].DataType = ftString then begin
   if not Params[Cntr].IsNull then begin
    if FRTrimStrings then Params[Cntr].AsString := TrimRight(Params[Cntr].AsString);
    if FNullEmptyStrings then if Params[Cntr].AsString = '' then Params[Cntr].Clear;
    if FTruncate and (Params[Cntr].Size > 0) and (Length(Params[Cntr].AsString) > Params[Cntr].Size)
     then Params[Cntr].AsString := Copy(Params[Cntr].AsString, 1, Params[Cntr].Size);
   end;
  end else if Params[Cntr].DataType in [ftMemo, ftFmtMemo] then begin
   if not Params[Cntr].IsNull then begin
    if FRTrimMemos then Params[Cntr].AsString := TrimRight(Params[Cntr].AsString);
    if FNullEmptyStrings then if Params[Cntr].AsString = '' then Params[Cntr].Clear;
   end;
  end else if Params[Cntr].DataType in [ftBlob, ftGraphic] then begin
   if (not Params[Cntr].IsNull) and FNullEmptyStrings and (Params[Cntr].AsString = '') then Params[Cntr].Clear;
  end;
 end;
end;
end;

I set the size property and ElevateDB works out the type so I thought I didn't need to set that up, but unless I specify ftString for the datatype the size parameter is being set back to 0.

Is this WAD?

Roy Lambert
Mon, Mar 7 2016 8:33 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< I set the size property and ElevateDB works out the type so I thought I didn't need to set that up, but unless I specify ftString for the datatype the size parameter is being set back to 0. >>

EDB doesn't handle the parameters functionality (TParams), they are handled by the DB unit in Delphi.  The only thing EDB does is initially populate/update them after a SQL text assignment or prepare.

Tim Young
Elevate Software
www.elevatesoft.com
Image