ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBQuery.pas
(Generate patch)

Comparing ibx/trunk/runtime/IBQuery.pas (file contents):
Revision 5 by tony, Fri Feb 18 16:26:16 2011 UTC vs.
Revision 7 by tony, Sun Aug 5 18:28:19 2012 UTC

# Line 24 | Line 24
24   {       Corporation. All Rights Reserved.                                }
25   {    Contributor(s): Jeff Overcash                                       }
26   {                                                                        }
27 + {    IBX For Lazarus (Firebird Express)                                  }
28 + {    Contributor: Tony Whyman, MWA Software http://www.mwasoftware.co.uk }
29 + {    Portions created by MWA Software are copyright McCallum Whyman      }
30 + {    Associates Ltd 2011                                                 }
31 + {                                                                        }
32   {************************************************************************}
33  
34   unit IBQuery;
# Line 33 | Line 38 | interface
38   {$Mode Delphi}
39  
40   uses
41 < {$IFDEF LINUX }
37 <  unix,
38 < {$ELSE}
41 > {$IFDEF WINDOWS }
42    Windows,
43 + {$ELSE}
44 +  unix,
45   {$ENDIF}
46   SysUtils, Graphics, Classes, Controls, Db,
47       IBHeader, IB, IBCustomDataSet, IBSQL;
# Line 100 | Line 105 | type
105      property Text: string read FText;
106      property RowsAffected: Integer read GetRowsAffected;
107      property GenerateParamNames: Boolean read FGenerateParamNames write FGenerateParamNames;
108 + //   property Params: TParams read FParams write SetParamsList;
109  
110    published
111      property Active;
112      property BufferChunks;
113      property CachedUpdates;
114      property DataSource read GetDataSource write SetDataSource;
115 <    property Constraints stored ConstraintsStored;
115 > //   property Constraints stored ConstraintsStored;
116 >    property GeneratorField;
117      property ParamCheck;
118      property SQL: TStrings read FSQL write SetQuery;
119 <    property Params: TParams read FParams write SetParamsList stored False;
119 >   property Params: TParams read FParams write SetParamsList;
120      property UniDirectional default False;
121      property UpdateObject;
122      property Filtered;
# Line 224 | Line 231 | begin
231        FText := SQL.Text;
232      DataEvent(dePropertyChange, 0);
233    end else
234 <    FText := FParams.ParseSQL(SQL.Text, False);
234 >    FText := FParams.ParseSQL(SQL.Text, true);
235    SelectSQL.Assign(SQL);
236   end;
237  
# Line 242 | Line 249 | procedure TIBQuery.DefineProperties(File
249  
250    function WriteData: Boolean;
251    begin
252 <    if Filer.Ancestor <> nil then
253 <      Result := not FParams.IsEqual(TIBQuery(Filer.Ancestor).FParams) else
252 >  {The following results in a stream read error with nested frames. Hence commented out until
253 >   someone fixes the LCL }
254 > {    if Filer.Ancestor <> nil then
255 >      Result := not FParams.IsEqual(TIBQuery(Filer.Ancestor).FParams) else}
256        Result := FParams.Count > 0;
257    end;
258  
# Line 254 | Line 263 | end;
263  
264   procedure TIBQuery.ReadParamData(Reader: TReader);
265   begin
266 +  FParams.Clear;
267    Reader.ReadValue;
268    Reader.ReadCollection(FParams);
269   end;
# Line 289 | Line 299 | procedure TIBQuery.SetParamsFromCursor;
299   var
300    I: Integer;
301    DataSet: TDataSet;
302 +  Field: TField;
303  
304    procedure CheckRequiredParams;
305    var
# Line 308 | Line 319 | begin
319      begin
320        DataSet.FieldDefs.Update;
321        for I := 0 to FParams.Count - 1 do
322 <        with FParams[I] do
323 <          if not Bound then
324 <          begin
325 <            AssignField(DataSet.FieldByName(Name));
326 <            Bound := False;
327 <          end;
322 >      if not FParams[I].Bound then
323 >      begin
324 >        Field := DataSet.FindField(FParams[I].Name);
325 >        if assigned(Field) then
326 >        begin
327 >            FParams[I].AssignField(Field);
328 >            FParams[I].Bound := False;
329 >        end;
330 >      end;
331      end
332      else
333        CheckRequiredParams;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines