MSSQL FreeTDS OR Native Db Lib
Posted: 14.09.2020, 10:57
Hi
I have the problem with working mssql 2008. I can't control query timeout using freetds or native dblib.
I check the code and found problem. Not defined function dbsettime in ZPlainDbLibDriver.pas.
Why call to dbsettime redirecting to dbsetmaxprocs?
Both libraries ntwdblib.dll and libsybdb-5.dll has exports dbsettime function. But in zeos this method even not implemented in block of load dynamic functions. After implement this function i can to change query timeout value. It works.
But I have doubts. Is this just a mistake or made for some reason?
I have the problem with working mssql 2008. I can't control query timeout using freetds or native dblib.
I check the code and found problem. Not defined function dbsettime in ZPlainDbLibDriver.pas.
Why call to dbsettime redirecting to dbsetmaxprocs?
Code: Select all
function TZFreeTDSBasePlainDriver.dbsetmaxprocs(
MaxProcs: SmallInt): RETCODE;
begin
Result := FreeTDSAPI.dbsetmaxprocs(MaxProcs);
end;
function TZFreeTDSBasePlainDriver.dbSetTime(queryTime: Integer): RETCODE;
begin
Result := FreeTDSAPI.dbsetmaxprocs(queryTime);
end;
Code: Select all
Add to ZPlainDbLibConstants.pas:
type
.........
TFreeTDSdbsettime = function(QueryTime: DBINT): RETCODE; cdecl;
...........
TFreeTDSAPI = record
.......
dbsettime: TFreeTDSdbsettime;
end;
Add to ZPlainDbLibDriver.pas:
procedure TZFreeTDSBasePlainDriver.LoadApi;
begin
.................
@FreeTDSAPI.dbsettime := GetAddress('dbsettime');
................
end;
Set:
function TZFreeTDSBasePlainDriver.dbSetTime(queryTime: Integer): RETCODE;
begin
Result := FreeTDSAPI.dbsetmaxprocs(queryTime);
end;
To:
function TZFreeTDSBasePlainDriver.dbSetTime(queryTime: Integer): RETCODE;
begin
Result := FreeTDSAPI.dbsettime(queryTime);
end;
use as:
(AConnection.DbcConnection.GetIZPlainDriver as IZFreeTDSPlainDriver).dbSetTime(<You query timeout>);