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 26 by tony, Sat Mar 14 10:44:03 2015 UTC vs.
Revision 27 by tony, Tue Apr 14 13:10:23 2015 UTC

# Line 366 | Line 366 | type
366      procedure SetSQL(Value: TStrings);
367      procedure SetTransaction(Value: TIBTransaction);
368      procedure SQLChanging(Sender: TObject);
369 <    procedure BeforeTransactionEnd(Sender: TObject);
369 >    procedure BeforeTransactionEnd(Sender: TObject; Action: TTransactionAction);
370    public
371      constructor Create(AOwner: TComponent); override;
372      destructor Destroy; override;
# Line 2343 | Line 2343 | begin
2343                             TRHandle,
2344                             @FHandle,
2345                             Database.SQLDialect,
2346 <                           FSQLParams.AsXSQLDA), True)
2346 >                           FSQLParams.AsXSQLDA), True);
2347    end;
2348    if not (csDesigning in ComponentState) then
2349      MonitorHook.SQLExecute(Self);
2350 +  FBase.DoAfterExecQuery(self);
2351 + //  writeln('Rows Affected = ',RowsAffected);
2352   end;
2353  
2354   function TIBSQL.GetEOF: Boolean;
# Line 2458 | Line 2460 | begin
2460         SQLUpdate, SQLDelete])) then
2461      result := ''
2462    else begin
2463 <    info_request := Char(isc_info_sql_get_plan);
2463 >    info_request := isc_info_sql_get_plan;
2464      Call(isc_dsql_sql_info(StatusVector, @FHandle, 2, @info_request,
2465                             SizeOf(result_buffer), result_buffer), True);
2466 <    if (result_buffer[0] <> Char(isc_info_sql_get_plan)) then
2466 >    if (result_buffer[0] <> isc_info_sql_get_plan) then
2467        IBError(ibxeUnknownError, [nil]);
2468      result_length := isc_vax_integer(@result_buffer[1], 2);
2469      SetString(result, nil, result_length);
# Line 2478 | Line 2480 | end;
2480  
2481   function TIBSQL.GetRowsAffected: Integer;
2482   var
2481  result_buffer: array[0..1048] of Char;
2483    info_request: Char;
2484 +  RB: TResultBuffer;
2485   begin
2486    if not Prepared then
2487      result := -1
2488    else begin
2489 <    info_request := Char(isc_info_sql_records);
2490 <    if isc_dsql_sql_info(StatusVector, @FHandle, 1, @info_request,
2491 <                         SizeOf(result_buffer), result_buffer) > 0 then
2492 <      IBDatabaseError;
2493 <    if (result_buffer[0] <> Char(isc_info_sql_records)) then
2494 <      result := -1
2495 <    else
2496 <    case SQLType of
2497 <    SQLUpdate:   Result := isc_vax_integer(@result_buffer[6], 4);
2498 <    SQLDelete:   Result := isc_vax_integer(@result_buffer[13], 4);
2499 <    SQLInsert:   Result := isc_vax_integer(@result_buffer[27], 4);
2500 <    else         Result := -1 ;
2501 <    end ;
2489 >    RB := TResultBuffer.Create;
2490 >    try
2491 >      info_request := isc_info_sql_records;
2492 >      if isc_dsql_sql_info(StatusVector, @FHandle, 1, @info_request,
2493 >                         RB.Size, RB.buffer) > 0 then
2494 >        IBDatabaseError;
2495 >      case SQLType of
2496 >      SQLInsert, SQLUpdate: {Covers Insert or Update as well as individual update}
2497 >        Result := RB.GetValue(isc_info_sql_records, isc_info_req_insert_count)+
2498 >         RB.GetValue(isc_info_sql_records, isc_info_req_update_count);
2499 >      SQLDelete:
2500 >        Result := RB.GetValue(isc_info_sql_records, isc_info_req_delete_count);
2501 >      SQLExecProcedure:
2502 >        Result :=  RB.GetValue(isc_info_sql_records, isc_info_req_insert_count) +
2503 >                   RB.GetValue(isc_info_sql_records, isc_info_req_update_count) +
2504 >                   RB.GetValue(isc_info_sql_records, isc_info_req_delete_count);
2505 >      else
2506 >        Result := 0;
2507 >      end;
2508 >    finally
2509 >      RB.Free;
2510 >    end;
2511    end;
2512   end;
2513  
# Line 2548 | Line 2559 | const
2559    end;
2560  
2561   begin
2562 +  sParamName := '';
2563    slNames := TStringList.Create;
2564    try
2565      { Do some initializations of variables }
# Line 2708 | Line 2720 | begin
2720      { After preparing the statement, query the stmt type and possibly
2721        create a FSQLRecord "holder" }
2722      { Get the type of the statement }
2723 <    type_item := Char(isc_info_sql_stmt_type);
2723 >    type_item := isc_info_sql_stmt_type;
2724      Call(isc_dsql_sql_info(StatusVector, @FHandle, 1, @type_item,
2725                           SizeOf(res_buffer), res_buffer), True);
2726 <    if (res_buffer[0] <> Char(isc_info_sql_stmt_type)) then
2726 >    if (res_buffer[0] <> isc_info_sql_stmt_type) then
2727        IBError(ibxeUnknownError, [nil]);
2728      stmt_len := isc_vax_integer(@res_buffer[1], 2);
2729      FSQLType := TIBSQLTypes(isc_vax_integer(@res_buffer[3], stmt_len));
# Line 2800 | Line 2812 | begin
2812    if FHandle <> nil then FreeHandle;
2813   end;
2814  
2815 < procedure TIBSQL.BeforeTransactionEnd(Sender: TObject);
2815 > procedure TIBSQL.BeforeTransactionEnd(Sender: TObject;
2816 >  Action: TTransactionAction);
2817   begin
2818    if (FOpen) then
2819      Close;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines