meteor-mssql icon indicating copy to clipboard operation
meteor-mssql copied to clipboard

Only 10 queries can be run without restarting your application

Open braydenhouston opened this issue 8 years ago • 4 comments

I have tried my application on a couple different servers and using this module you can only run a maximum of 10 queries to a mssql server before it stops working. There are no exceptions being thrown - it just seems to skip running the queries after #10. The only way to run addition queries is to restart the application.

braydenhouston avatar Aug 01 '16 17:08 braydenhouston

I'd need to see the code it's used in... it definitely lets you run more than 10 queries

emgee3 avatar Aug 01 '16 18:08 emgee3

I am calling a function that runs the query and returns the result. Name is passed in a parameter to the function. Am I missing something?

var opts = {
               query: "SELECT* FROM dbo.Incident RECORD WHERE RECORD.OwnerIdName = @name;",
               inputs: {
                    name: Sql.driver.NVarChar
               }
          }
          try {
               var query = Sql.ps(opts);
          } catch (e) {
               console.log(e);
               return e;
          }
          var result = query({
               name: name
          });
          query.unprepare();
          return result;

braydenhouston avatar Aug 01 '16 19:08 braydenhouston

I don't see anything here particularly wrong, though, if your SQL Server disconnects you'll have issues. If all you're doing is running that particular query once, you can still tokenize it using Sql.q(...) rather than prepare it. How to do this is in the docs. Preparation is only worth it when you run the query many times.

emgee3 avatar Aug 02 '16 06:08 emgee3

Awesome! Direct queries using Sql.q(...) work perfect. This should work for some of the statements I am running. Is there anyway to re-establish that connection when it is dropped when I run prepared statements?

braydenhouston avatar Aug 02 '16 16:08 braydenhouston