Re: FreeTDS and buffering on client side
Frediano Ziglio <[email protected]> Wed, 25 Oct 2017 15:11:30 +0100
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAHt6W4fDJ4VLAAsYh-R+BuoB9pmy9YeBPD4H=7frWdJe2Ge6hA@mail.gmail.com> |
2017-10-25 11:38 GMT+01:00 LacaK <[email protected]>: > Hi *, > > I would like to ask how FreeTDS performs buffering on client side. > I use dblib as my client library (I do not set there DBBUFFER using > "dbsetopt") > > I am trying simulate network failure in such way: > 1. connect to MS SQL Server using dbopen() > 2. I send SQL select using dbcmd(), dbsqlexec() > 3. then I call dbresults() > 4. here I pause program and unplug network cable to simulate network error > 5. next I process rows in loop calling dbnextrow() > > Strange thing is that I can perform step 5 also when network cable is > unpluged. So I have suspection, that all rows from select are already > somewhere on client side. Probably handled already by underlaying libtds ? > > What is going to happen? Why I can still read rows when there is already > broken network connection ? > Thanks > > -Laco. > There are a lot of caching in between. The server execute the query and starts sending back results. Probably the results you are expecting are already sent by the server when you disconnect the cable and are in the tcp socket buffer ready to be parsed from your program. Try to return 1000000 rows and at some point the program will fail (unless connection is really fast and network buffer is big enough!). Frediano