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 1 by tony, Mon Jul 31 16:43:00 2000 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;
35  
36   interface
37  
38 < uses Windows, SysUtils, Graphics, Classes, Controls, Db, StdVCL,
38 > {$Mode Delphi}
39 >
40 > uses
41 > {$IFDEF WINDOWS }
42 >  Windows,
43 > {$ELSE}
44 >  unix,
45 > {$ENDIF}
46 > SysUtils, Graphics, Classes, Controls, Db,
47       IBHeader, IB, IBCustomDataSet, IBSQL;
48  
49   type
# Line 61 | Line 74 | type
74  
75    protected
76      { IProviderSupport }
77 <    procedure PSExecute; override;
77 > (*    procedure PSExecute; override;
78      function PSGetParams: TParams; override;
79      function PSGetTableName: string; override;
80      procedure PSSetCommandText(const CommandText: string); override;
81 <    procedure PSSetParams(AParams: TParams); override;
81 >    procedure PSSetParams(AParams: TParams); override;  *)
82  
83      procedure DefineProperties(Filer: TFiler); override;
84      procedure InitFieldDefs; override;
# Line 81 | Line 94 | type
94      procedure BatchInput(InputObject: TIBBatchInput);
95      procedure BatchOutput(OutputObject: TIBBatchOutput);
96      procedure ExecSQL;
97 <    procedure GetDetailLinkFields(MasterFields, DetailFields: TList); override;
97 >    procedure GetDetailLinkFields(MasterFields, DetailFields: TList);(* override;*)
98      function ParamByName(const Value: string): TParam;
99      procedure Prepare;
100      procedure UnPrepare;
# Line 92 | 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 141 | Line 156 | end;
156  
157   procedure TIBQuery.InitFieldDefs;
158   begin
159 <  inherited;
159 >  inherited InitFieldDefs;
160   end;
161  
162   procedure TIBQuery.InternalOpen;
# Line 216 | 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 234 | 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 246 | 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 281 | Line 299 | procedure TIBQuery.SetParamsFromCursor;
299   var
300    I: Integer;
301    DataSet: TDataSet;
302 +  Field: TField;
303  
304    procedure CheckRequiredParams;
305    var
# Line 300 | 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;
# Line 470 | Line 492 | begin
492   end;
493  
494   { TIBQuery IProviderSupport }
495 <
495 > (*
496   function TIBQuery.PSGetParams: TParams;
497   begin
498    Result := Params;
# Line 498 | Line 520 | begin
520    if CommandText <> '' then
521      SQL.Text := CommandText;
522   end;
523 <
523 > *)
524   end.
525  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines