ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/3.0/FB30Statement.pas
(Generate patch)

Comparing:
ibx/trunk/fbintf/client/3.0/FB30Statement.pas (file contents), Revision 350 by tony, Wed Oct 20 14:58:56 2021 UTC vs.
ibx/branches/udr/client/3.0/FB30Statement.pas (file contents), Revision 370 by tony, Wed Jan 5 14:59:15 2022 UTC

# Line 88 | Line 88 | type
88      FStatement: TFB30Statement;
89      FFirebird30ClientAPI: TFB30ClientAPI;
90      FBlob: IBlob;             {Cache references}
91    FArray: IArray;
91      FNullIndicator: short;
92      FOwnsSQLData: boolean;
93      FBlobMetaData: IBlobMetaData;
# Line 141 | Line 140 | type
140      procedure ColumnSQLDataInit;
141      procedure RowChange; override;
142      procedure FreeSQLData;
143 <    function GetAsArray(Array_ID: TISC_QUAD): IArray; override;
143 >    function GetAsArray: IArray; override;
144      function GetAsBlob(Blob_ID: TISC_QUAD; BPB: IBPB): IBlob; override;
145      function GetArrayMetaData: IArrayMetaData; override;
146      function GetBlobMetaData: IBlobMetaData; override;
# Line 290 | Line 289 | type
289      procedure CheckHandle; override;
290      procedure CheckBatchModeAvailable;
291      procedure GetDSQLInfo(info_request: byte; buffer: ISQLInfoResults); override;
292 +    function GetStatementIntf: IStatement; override;
293      procedure InternalPrepare(CursorName: AnsiString=''); override;
294      function InternalExecute(aTransaction: ITransaction): IResults; override;
295      function InternalOpenCursor(aTransaction: ITransaction; Scrollable: boolean
# Line 314 | Line 314 | type
314      function GetMetaData: IMetaData; override;
315      function GetPlan: AnsiString;
316      function IsPrepared: boolean;
317 +    function GetFlags: TStatementFlags; override;
318      function CreateBlob(column: TColumnMetaData): IBlob; override;
319      function CreateArray(column: TColumnMetaData): IArray; override;
320      procedure SetRetainInterfaces(aValue: boolean); override;
# Line 749 | Line 750 | procedure TIBXSQLVAR.RowChange;
750   begin
751    inherited;
752    FBlob := nil;
752  FArray := nil;
753   end;
754  
755   procedure TIBXSQLVAR.FreeSQLData;
# Line 760 | Line 760 | begin
760    FOwnsSQLData := true;
761   end;
762  
763 < function TIBXSQLVAR.GetAsArray(Array_ID: TISC_QUAD): IArray;
763 > function TIBXSQLVAR.GetAsArray: IArray;
764   begin
765    if SQLType <> SQL_ARRAY then
766      IBError(ibxeInvalidDataConversion,[nil]);
# Line 769 | Line 769 | begin
769      Result := nil
770    else
771    begin
772 <    if FArray = nil then
773 <      FArray := TFB30Array.Create(FStatement.GetAttachment as TFB30Attachment,
772 >    if FArrayIntf = nil then
773 >      FArrayIntf := TFB30Array.Create(FStatement.GetAttachment as TFB30Attachment,
774                                  TIBXSQLDA(Parent).GetTransaction,
775 <                                GetArrayMetaData,Array_ID);
776 <    Result := FArray;
775 >                                GetArrayMetaData,PISC_QUAD(SQLData)^);
776 >    Result := FArrayIntf;
777    end;
778   end;
779  
# Line 1142 | Line 1142 | begin
1142        else
1143          FSQLNullIndicator := nil;
1144        FBlob := nil;
1145 <      FArray := nil;
1145 >      FArrayIntf := nil;
1146      end;
1147    end;
1148    SetUniqueRelationName;
# Line 1324 | Line 1324 | begin
1324    end;
1325   end;
1326  
1327 + function TFB30Statement.GetStatementIntf: IStatement;
1328 + begin
1329 +  Result := self;
1330 + end;
1331 +
1332   procedure TFB30Statement.InternalPrepare(CursorName: AnsiString);
1333   var GUID : TGUID;
1334   begin
# Line 1442 | Line 1447 | function TFB30Statement.InternalExecute(
1447      end;
1448    end;
1449  
1450 + var Cursor: IResultSet;
1451  
1452   begin
1453    Result := nil;
# Line 1467 | Line 1473 | begin
1473      begin
1474        case FSQLStatementType of
1475        SQLSelect:
1476 <        IBError(ibxeIsAExecuteProcedure,[]);
1476 >       {e.g. Update...returning with a single row in Firebird 5 and later}
1477 >      begin
1478 >        Cursor := InternalOpenCursor(aTransaction,false);
1479 >        if not Cursor.IsEof then
1480 >          Cursor.FetchNext;
1481 >        Result := Cursor; {note only first row}
1482 >        FSingleResults := true;
1483 >      end;
1484  
1485        SQLExecProcedure:
1486        begin
# Line 1496 | Line 1509 | function TFB30Statement.InternalOpenCurs
1509   var flags: cardinal;
1510   begin
1511    flags := 0;
1512 <  if FSQLStatementType <> SQLSelect then
1512 >  if (FSQLStatementType <> SQLSelect) and not (stHasCursor in getFlags) then
1513     IBError(ibxeIsASelectStatement,[]);
1514  
1515    FBatchCompletion := nil;
# Line 1901 | Line 1914 | begin
1914    Result := FStatementIntf <> nil;
1915   end;
1916  
1917 + function TFB30Statement.GetFlags: TStatementFlags;
1918 + var flags: cardinal;
1919 + begin
1920 +  CheckHandle;
1921 +  Result := [];
1922 +  with FFirebird30ClientAPI do
1923 +  begin
1924 +    flags := FStatementIntf.getFlags(StatusIntf);
1925 +    Check4DataBaseError;
1926 +  end;
1927 +  if flags and Firebird.IStatement.FLAG_HAS_CURSOR <> 0 then
1928 +    Result := Result + [stHasCursor];
1929 +  if flags and Firebird.IStatement.FLAG_REPEAT_EXECUTE <> 0 then
1930 +    Result := Result + [stRepeatExecute];
1931 +  if flags and Firebird.IStatement.CURSOR_TYPE_SCROLLABLE <> 0 then
1932 +    Result := Result + [stScrollable];
1933 + end;
1934 +
1935   end.
1936  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines