ADO: Open RecordSet for each SelectSQL

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
LOTAS
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 09.06.2009, 14:57
Location: Germany
Contact:

ADO: Open RecordSet for each SelectSQL

Post by LOTAS »

Hi. I need very fast help!!

During some tests I did because of problems with transactions, I encountered that the ado-component opens a new session to the ms sql-db every time a select-statement is done.

Line 177 in ZDbcAdoStatement.pas

Code: Select all

if IsSelect(SQL) then
    begin
      AdoRecordSet := CoRecordSet.Create;
      AdoRecordSet.MaxRecords := MaxRows;
      AdoRecordSet.Open(SQL, (Connection as IZAdoConnection).GetAdoConnection,
        adOpenStatic, adLockOptimistic, adAsyncFetch);
    end
    else
      AdoRecordSet := (Connection as IZAdoConnection).GetAdoConnection.Execute(SQL, RC, adExecuteNoRecords);
Is this really needed? And most of all, WHY is it done?

Our problem is, that we want to set the lock_timeout, and as this is used for each session seperated, we have to set it manually befor each select sql.

That's not really as it should be. As we ported some programs to ms sql because a customer wants it, we are in a bit of hurry and don't have so much time to test and rebuild our program (till now we used BDE and Sybase-DB where everything worked fine).

Our ZEOSlib Version is 6.6.1 beta
Johannes
LOTAS
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 09.06.2009, 14:57
Location: Germany
Contact:

Post by LOTAS »

Noone who have any suggestions? Unfortunately there is no comment in code.
Johannes
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi, Are you sure this opens a new session or is it just opening a new resultset?
I'm not an ADO user, so I can't investigate myself. Just looking at it, seems to reuse the already existing connection/session. Am I wrong?

Mark
Image
LOTAS
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 09.06.2009, 14:57
Location: Germany
Contact:

Post by LOTAS »

Hi.
As on the sessioncounter, visible on the ms sql db it opens a new session.

This was what was so astonishing.

It may be, that it's a new resultset and the DB thinks it a new session and therefore handle it as one, that I don't know. Nevertheless the DB genereates a new session id.
Johannes
Post Reply