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

Comparing ibx/trunk/runtime/IBSQL.pas (file contents):
Revision 27 by tony, Tue Apr 14 13:10:23 2015 UTC vs.
Revision 35 by tony, Tue Jan 26 14:38:47 2016 UTC

# Line 76 | Line 76 | uses
76   {$ELSE}
77    baseunix, unix,
78   {$ENDIF}
79 <  SysUtils, Classes, Forms, Controls, IBHeader,
79 >  SysUtils, Classes, IBHeader,
80    IBErrorCodes, IBExternals, DB, IB, IBDatabase, IBUtils, IBXConst;
81  
82   const
# Line 328 | Line 328 | type
328    TIBSQL = class(TComponent)
329    private
330      FIBLoaded: Boolean;
331 +    FOnSQLChanged: TNotifyEvent;
332      FUniqueParamNames: Boolean;
333      function GetFieldCount: integer;
334      procedure SetUniqueParamNames(AValue: Boolean);
# Line 366 | Line 367 | type
367      procedure SetSQL(Value: TStrings);
368      procedure SetTransaction(Value: TIBTransaction);
369      procedure SQLChanging(Sender: TObject);
370 +    procedure SQLChanged(Sender: TObject);
371      procedure BeforeTransactionEnd(Sender: TObject; Action: TTransactionAction);
372    public
373      constructor Create(AOwner: TComponent); override;
# Line 412 | Line 414 | type
414      property SQL: TStrings read FSQL write SetSQL;
415      property Transaction: TIBTransaction read GetTransaction write SetTransaction;
416      property OnSQLChanging: TNotifyEvent read FOnSQLChanging write FOnSQLChanging;
417 +    property OnSQLChanged: TNotifyEvent read FOnSQLChanged write FOnSQLChanged;
418    end;
419  
420   implementation
# Line 2153 | Line 2156 | begin
2156    FRecordCount := 0;
2157    FSQL := TStringList.Create;
2158    TStringList(FSQL).OnChanging := SQLChanging;
2159 +  TStringList(FSQL).OnChange := SQLChanged;
2160    FProcessedSQL := TStringList.Create;
2161    FHandle := nil;
2162    FSQLParams := TIBXSQLDA.Create(self,daInput);
2163    FSQLRecord := TIBXSQLDA.Create(self,daOutput);
2164    FSQLType := SQLUnknown;
2165    FParamCheck := True;
2166 <  FCursor := Name + RandomString(8);
2166 >  FCursor := HexStr(self); //Name + RandomString(8);
2167    if AOwner is TIBDatabase then
2168      Database := TIBDatabase(AOwner)
2169    else
# Line 2311 | Line 2315 | begin
2315        FBOF := True;
2316        FEOF := False;
2317        FRecordCount := 0;
2318 +      if not (csDesigning in ComponentState) then
2319 +        MonitorHook.SQLExecute(Self);
2320        if FGoToFirstRecordOnExecute then
2321          Next;
2322      end;
# Line 2321 | Line 2327 | begin
2327                              Database.SQLDialect,
2328                              FSQLParams.AsXSQLDA,
2329                              FSQLRecord.AsXSQLDA), True);
2330 +      if not (csDesigning in ComponentState) then
2331 +        MonitorHook.SQLExecute(Self);
2332   (*      if (fetch_res <> 0) and (fetch_res <> isc_deadlock) then
2333        begin
2334           { Sometimes a prepared stored procedure appears to get
# Line 2344 | Line 2352 | begin
2352                             @FHandle,
2353                             Database.SQLDialect,
2354                             FSQLParams.AsXSQLDA), True);
2355 +      if not (csDesigning in ComponentState) then
2356 +        MonitorHook.SQLExecute(Self);
2357    end;
2348  if not (csDesigning in ComponentState) then
2349    MonitorHook.SQLExecute(Self);
2358    FBase.DoAfterExecQuery(self);
2359   //  writeln('Rows Affected = ',RowsAffected);
2360   end;
# Line 2812 | Line 2820 | begin
2820    if FHandle <> nil then FreeHandle;
2821   end;
2822  
2823 + procedure TIBSQL.SQLChanged(Sender: TObject);
2824 + begin
2825 +  if assigned(OnSQLChanged) then
2826 +    OnSQLChanged(self);
2827 + end;
2828 +
2829   procedure TIBSQL.BeforeTransactionEnd(Sender: TObject;
2830    Action: TTransactionAction);
2831   begin

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines