cretz / node-tds

Pure JS implementation of TDS protocol for Microsoft SQL Server
http://cretz.github.com/node-tds
MIT License
104 stars 23 forks source link

statement.cancel seems to have no effect #31

Open tony-o opened 12 years ago

tony-o commented 12 years ago

Don't know if this project is being maintained anymore but canceling the statement seems to have no effect:

    var timeout;
    var done = function(d){
      clearTimeout(timeout);
      log(0,"rows:\t" + rows + "\t" + errors + "\t" + (rows+errors));
      log("statement closing, rows: " + rows);
      callback();
    };
    statement.on("row",function(row){
      try{
        rows++;
        clearTimeout(timeout);
        timeout = setTimeout(function(){
          statement.cancel();
          log(2,"timeout situation, attempting to kill");
        },1500);
      }catch(e){ log(2,e); }
    });
    log("executing");
    statement.on("error",function(e){
      log(2,e);
      errors++;
    });
    statement.on("done",function(d){
      done();
    });
    statement.execute();