Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

2014 error when calling multiple stored procedures #108

Closed
gitawego opened this Issue Dec 26, 2011 · 5 comments

Comments

Projects
None yet
2 participants

I got 2014 error when calling a stored procedure in multiple times:
I have script:


test = function(id,callback){
  conn.query('CALL getValues('+id+')',function(err,result){
    while (conn.multiMoreResultsSync()) {
          conn.multiNextResultSync();
     }
    var rows = result.fetchAllSync();
    result.freeSync();
    callback(rows);
  });
};

I don't have such problem in sync mode:


test('test1',function(res){
   console.log(res);
  test('test2',function(res){
    console.log(res);
    test('test3',function(res){
      console.log(res);
    })
  })
})

If I execute this code in async, I'm getting 2014 error.


['test1','test2','test3'].forEach(function(id){
  test(id,function(res){
   console.log(res);  
});
});

any idea ?

the only work around for now is open one connection per CALL then close it after being executed. but it's not a good practice of database... I suppose...

Owner

Sannis commented Dec 26, 2011

Looks very close to #106. I'll try to write a test for this and try to fix it ASAP. Thanks for your report, @gitawego.

thanks for your attention, just for info, it happens only when there is SELECT in stored procedure, I don't have such problem if my stored procedure uses only for INSERT or UPDATE.

my code has the similar function like your 2nd example, using SELECT without OUT parameter.

Owner

Sannis commented Mar 31, 2012

I'll add some new tests with proper CALL results handling in next commit.

@ghost ghost assigned Sannis Mar 31, 2012

@Sannis Sannis closed this Mar 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment