160 |
|
private |
161 |
|
FCaseSensitiveParameterNames: boolean; |
162 |
|
FMetaData: IMetaData; |
163 |
+ |
FScrollable: boolean; |
164 |
|
FSQLParams: ISQLParams; |
165 |
|
FStatement: IStatement; |
166 |
|
FOnSQLChanged: TNotifyEvent; |
167 |
|
FUniqueParamNames: Boolean; |
168 |
< |
FBOF: boolean; |
168 |
< |
FEOF: boolean; |
168 |
> |
function GetBOF: Boolean; |
169 |
|
function GetFieldCount: integer; |
170 |
|
function GetOpen: Boolean; |
171 |
|
function GetPrepared: Boolean; |
208 |
|
procedure Close; |
209 |
|
procedure ExecQuery; |
210 |
|
function HasField(FieldName: String): boolean; {Note: case sensitive match} |
211 |
+ |
function HasScollableCursors: boolean; |
212 |
|
function FieldByName(FieldName: String): ISQLData; |
213 |
|
function ParamByName(ParamName: String): ISQLParam; |
214 |
|
procedure FreeHandle; |
215 |
|
function Next: boolean; |
216 |
+ |
function FetchNext: boolean; {fetch next record} |
217 |
+ |
function FetchPrior: boolean; {fetch previous record} |
218 |
+ |
function FetchFirst:boolean; {fetch first record} |
219 |
+ |
function FetchLast: boolean; {fetch last record} |
220 |
+ |
function FetchAbsolute(position: Integer): boolean; {fetch record by its absolute position in result set} |
221 |
+ |
function FetchRelative(offset: Integer): boolean; {fetch record by position relative to current} |
222 |
|
procedure Prepare; |
223 |
|
function GetUniqueRelationName: String; |
224 |
< |
property Bof: Boolean read FBOF; |
224 |
> |
property Bof: Boolean read GetBOF; |
225 |
|
property Eof: Boolean read GetEOF; |
226 |
|
property Current: IResults read FResults; |
227 |
|
property Fields[const Idx: Integer]: ISQLData read GetFields; default; |
258 |
|
default True; |
259 |
|
property ParamCheck: Boolean read FParamCheck write FParamCheck; |
260 |
|
property SQL: TStrings read FSQL write SetSQL; |
261 |
+ |
property Scrollable: boolean read FScrollable write FScrollable; |
262 |
|
property Transaction: TIBTransaction read GetTransaction write SetTransaction; |
263 |
|
property OnSQLChanging: TNotifyEvent read FOnSQLChanging write FOnSQLChanging; |
264 |
|
property OnSQLChanged: TNotifyEvent read FOnSQLChanged write FOnSQLChanged; |
668 |
|
FResults.SetRetainInterfaces(false); |
669 |
|
FResultSet := nil; |
670 |
|
FResults := nil; |
663 |
– |
FBOF := false; |
664 |
– |
FEOF := false; |
671 |
|
FRecordCount := 0; |
672 |
|
end; |
673 |
|
|
682 |
|
Result := 0; |
683 |
|
end; |
684 |
|
|
685 |
+ |
function TIBSQL.GetBOF: Boolean; |
686 |
+ |
begin |
687 |
+ |
Result := (FResultSet = nil) or FResultSet.IsBof; |
688 |
+ |
end; |
689 |
+ |
|
690 |
|
function TIBSQL.GetOpen: Boolean; |
691 |
|
begin |
692 |
|
Result := FResultSet <> nil; |
735 |
|
{$ENDIF} |
736 |
|
if SQLStatementType = SQLSelect then |
737 |
|
begin |
738 |
< |
FResultSet := FStatement.OpenCursor; |
738 |
> |
FResultSet := FStatement.OpenCursor(Scrollable); |
739 |
|
FResults := FResultSet; |
740 |
|
FResults.SetRetainInterfaces(true); |
730 |
– |
FBOF := True; |
731 |
– |
FEOF := False; |
741 |
|
FRecordCount := 0; |
742 |
|
if not (csDesigning in ComponentState) then |
743 |
|
MonitorHook.SQLExecute(Self); |
779 |
|
end; |
780 |
|
end; |
781 |
|
|
782 |
+ |
function TIBSQL.HasScollableCursors: boolean; |
783 |
+ |
begin |
784 |
+ |
Result := Database.Attachment.HasScollableCursors; |
785 |
+ |
end; |
786 |
+ |
|
787 |
|
function TIBSQL.GetEOF: Boolean; |
788 |
|
begin |
789 |
< |
result := FEOF or (FResultSet = nil); |
789 |
> |
result := (FResultSet = nil) or FResultSet.IsEof; |
790 |
|
end; |
791 |
|
|
792 |
|
function TIBSQL.FieldByName(FieldName: String): ISQLData; |
831 |
|
|
832 |
|
function TIBSQL.Next: boolean; |
833 |
|
begin |
834 |
+ |
Result := FetchNext; |
835 |
+ |
end; |
836 |
+ |
|
837 |
+ |
function TIBSQL.FetchNext: boolean; |
838 |
+ |
begin |
839 |
|
result := false; |
840 |
< |
if not FEOF then |
840 |
> |
if not EOF then |
841 |
|
begin |
842 |
|
CheckOpen; |
843 |
|
try |
847 |
|
raise; |
848 |
|
end; |
849 |
|
|
850 |
< |
if Result then |
832 |
< |
begin |
850 |
> |
if Result and not Scrollable then |
851 |
|
Inc(FRecordCount); |
834 |
– |
FBOF := False; |
835 |
– |
end |
836 |
– |
else |
837 |
– |
FEOF := true; |
852 |
|
|
853 |
|
if not (csDesigning in ComponentState) then |
854 |
|
MonitorHook.SQLFetch(Self); |
855 |
|
end; |
856 |
|
end; |
857 |
|
|
858 |
+ |
function TIBSQL.FetchPrior: boolean; |
859 |
+ |
begin |
860 |
+ |
result := false; |
861 |
+ |
if not BOF then |
862 |
+ |
begin |
863 |
+ |
CheckOpen; |
864 |
+ |
try |
865 |
+ |
Result := FResultSet.FetchPrior; |
866 |
+ |
except |
867 |
+ |
Close; |
868 |
+ |
raise; |
869 |
+ |
end; |
870 |
+ |
|
871 |
+ |
if not (csDesigning in ComponentState) then |
872 |
+ |
MonitorHook.SQLFetch(Self); |
873 |
+ |
end; |
874 |
+ |
end; |
875 |
+ |
|
876 |
+ |
function TIBSQL.FetchFirst: boolean; |
877 |
+ |
begin |
878 |
+ |
result := false; |
879 |
+ |
CheckOpen; |
880 |
+ |
try |
881 |
+ |
Result := FResultSet.FetchFirst; |
882 |
+ |
except |
883 |
+ |
Close; |
884 |
+ |
raise; |
885 |
+ |
end; |
886 |
+ |
|
887 |
+ |
if not (csDesigning in ComponentState) then |
888 |
+ |
MonitorHook.SQLFetch(Self); |
889 |
+ |
end; |
890 |
+ |
|
891 |
+ |
function TIBSQL.FetchLast: boolean; |
892 |
+ |
begin |
893 |
+ |
result := false; |
894 |
+ |
CheckOpen; |
895 |
+ |
try |
896 |
+ |
Result := FResultSet.FetchLast; |
897 |
+ |
except |
898 |
+ |
Close; |
899 |
+ |
raise; |
900 |
+ |
end; |
901 |
+ |
|
902 |
+ |
if not (csDesigning in ComponentState) then |
903 |
+ |
MonitorHook.SQLFetch(Self); |
904 |
+ |
end; |
905 |
+ |
|
906 |
+ |
function TIBSQL.FetchAbsolute(position: Integer): boolean; |
907 |
+ |
begin |
908 |
+ |
result := false; |
909 |
+ |
CheckOpen; |
910 |
+ |
try |
911 |
+ |
Result := FResultSet.FetchAbsolute(position); |
912 |
+ |
except |
913 |
+ |
Close; |
914 |
+ |
raise; |
915 |
+ |
end; |
916 |
+ |
|
917 |
+ |
if not (csDesigning in ComponentState) then |
918 |
+ |
MonitorHook.SQLFetch(Self); |
919 |
+ |
end; |
920 |
+ |
|
921 |
+ |
function TIBSQL.FetchRelative(offset: Integer): boolean; |
922 |
+ |
begin |
923 |
+ |
result := false; |
924 |
+ |
CheckOpen; |
925 |
+ |
try |
926 |
+ |
Result := FResultSet.FetchRelative(offset); |
927 |
+ |
except |
928 |
+ |
Close; |
929 |
+ |
raise; |
930 |
+ |
end; |
931 |
+ |
|
932 |
+ |
if not (csDesigning in ComponentState) then |
933 |
+ |
MonitorHook.SQLFetch(Self); |
934 |
+ |
end; |
935 |
+ |
|
936 |
|
procedure TIBSQL.FreeHandle; |
937 |
|
begin |
938 |
|
if FStatement <> nil then |