rails-sqlserver/tiny_tds — pull request #160 by wbond (2014-05-01 00:26:29+00:00)
Title: Don't 'cancel' the request until dbresults is something other than SUCCEED

When running a backup or restore, SQL Server sends messages about the progress. Currently, tiny_tds would cancel as soon as the query first returned. This is presumably to clean things up and leave the connection in a good state. However, in this case we need to keep asking for results until we don't get any more. `SUCCEED` is returned repeatedly until the query completes.

Under normal circumstance, the query is done when signaled via `NO_MORE_RESULTS`. Obviously there can also be failure modes, such as `FAIL`, `BUF_FULL`, etc from https://github.com/veracross/freetds/blob/master/include/sybdb.h#L484-L488. Thus, we keep looping until we get something other than `SUCCEED`.