Well, I also wondered this and looked at this for a while. I considered returning `INT_EXIT` as I think you had suggested, but now I think that `INT_CANCEL` is appropriate.

Looking at various docs and at the actual code (https://gitorious.org/freetds/freetds/source/52e59affc0110c5ddd379ef1e45c4554123f27b5:src/dblib/dblib.c#L7976), there are 4 possible return values for an error handler:

1. `INT_CONTINUE` -- "The db-lib function will retry the operation." (https://gitorious.org/freetds/freetds/source/52e59affc0110c5ddd379ef1e45c4554123f27b5:src/dblib/dblib.c#L7826) -- clearly not what we want if `DBDEAD(dbproc)` is true.
2. `INT_TIMEOUT` -- "The db-lib function will cancel the operation and return FAIL.  \a dbproc remains useable." (https://gitorious.org/freetds/freetds/source/52e59affc0110c5ddd379ef1e45c4554123f27b5:src/dblib/dblib.c#L7825) -- We don't want the dbproc to remain useable if `DBDEAD(dbproc)` is true.
3. `INT_EXIT` -- this looks tempting initially. When running in Sybase compatibility mode, this calls `exit(3)`, which will kill the entire OS process, which is nice for a command-line program like `tsql`, but not so nice for a web server. When running in Microsoft compatibility mode (what we should be using), this simply gets converted to `INT_CANCEL` (see https://gitorious.org/freetds/freetds/source/52e59affc0110c5ddd379ef1e45c4554123f27b5:src/dblib/dblib.c#L7999)
"If Sybase semantics are used, this function notifies
 *     the user and calls exit(3).  If Microsoft semantics are used, this function returns INT_CANCEL." (https://gitorious.org/freetds/freetds/source/52e59affc0110c5ddd379ef1e45c4554123f27b5:src/dblib/dblib.c#L7828)
4. `INT_CANCEL` -- "The db-lib function that encountered the error will return FAIL." (https://gitorious.org/freetds/freetds/source/52e59affc0110c5ddd379ef1e45c4554123f27b5:src/dblib/dblib.c#L7824) -- This is what we want.