|
@@ -65,6 +65,7 @@ type
|
|
|
function CheckError(const Ret: RETCODE): RETCODE;
|
|
|
procedure Execute(const cmd: string); overload;
|
|
|
procedure ExecuteDirectSQL(const Query: string);
|
|
|
+ procedure CancelQuery;
|
|
|
procedure GetParameters(cursor: TSQLCursor; AParams: TParams);
|
|
|
function TranslateFldType(SQLDataType: integer): TFieldType;
|
|
|
function AutoCommit: boolean;
|
|
@@ -226,9 +227,9 @@ var
|
|
|
ParamBinding : TParamBinding;
|
|
|
begin
|
|
|
if assigned(AParams) and (AParams.Count > 0) then
|
|
|
- FQuery:=AParams.ParseSQL(Buf, false, sqEscapeSlash in FConnection.ConnOptions, sqEscapeRepeat in FConnection.ConnOptions, psSimulated, ParamBinding, FParamReplaceString)
|
|
|
+ FQuery := AParams.ParseSQL(Buf, False, sqEscapeSlash in FConnection.ConnOptions, sqEscapeRepeat in FConnection.ConnOptions, psSimulated, ParamBinding, FParamReplaceString)
|
|
|
else
|
|
|
- FQuery:=Buf;
|
|
|
+ FQuery := Buf;
|
|
|
FPrepared := True;
|
|
|
end;
|
|
|
|
|
@@ -346,6 +347,17 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+procedure TMSSQLConnection.CancelQuery;
|
|
|
+begin
|
|
|
+ // Cancel the query currently being retrieved, discarding all pending rows and all remaining resultsets
|
|
|
+ if Fstatus = MORE_ROWS then begin
|
|
|
+ repeat
|
|
|
+ dbcanquery(FDBProc);
|
|
|
+ until dbresults(FDBProc) <> SUCCEED;
|
|
|
+ Fstatus := NO_MORE_ROWS;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
function TMSSQLConnection.GetHandle: pointer;
|
|
|
begin
|
|
|
Result:=FDBProc;
|
|
@@ -575,8 +587,8 @@ end;
|
|
|
|
|
|
procedure TMSSQLConnection.UnPrepareStatement(cursor: TSQLCursor);
|
|
|
begin
|
|
|
- if assigned(FDBProc) and (Fstatus <> NO_MORE_ROWS) then
|
|
|
- dbcanquery(FDBProc);
|
|
|
+ CancelQuery;
|
|
|
+ cursor.FPrepared := False;
|
|
|
end;
|
|
|
|
|
|
procedure TMSSQLConnection.Execute(const cmd: string);
|
|
@@ -923,7 +935,8 @@ end;
|
|
|
|
|
|
procedure TMSSQLConnection.FreeFldBuffers(cursor: TSQLCursor);
|
|
|
begin
|
|
|
- inherited FreeFldBuffers(cursor);
|
|
|
+ CancelQuery;
|
|
|
+ inherited;
|
|
|
end;
|
|
|
|
|
|
procedure TMSSQLConnection.UpdateIndexDefs(IndexDefs: TIndexDefs; TableName: string);
|