w1nk / node-odbc

unixODBC bindings for node
MIT License
90 stars 102 forks source link

Error '[node-odbc] Error in ODBCResult::MoreResultsSync', #104

Open aschwersenz opened 8 years ago

aschwersenz commented 8 years ago

I have set up unixODBC, MDBTools and node-odbc. Now I want to query something from an mdb file doing this:

    odbc.open('DRIVER=MDBTools;DBQ=<filename>;', function (err) {
      if (err) return console.log(err);

      odbc.query("SELECT * FROM testdata", function (err, rows, moreResultSets) {
        if (err) console.log(err);

        console.log(rows);

        odbc.close(function () {
          console.log('done');
        });
      });
    });

But all I get is an endless loop with this error:

{ [Error: [unixODBC][Driver Manager]Driver does not support this function]
  errors: 
   [ { message: '[unixODBC][Driver Manager]Driver does not support this function',
       state: 'IM001' } ],
  error: '[node-odbc] Error in ODBCResult::MoreResultsSync',
  message: '[unixODBC][Driver Manager]Driver does not support this function',
  state: 'IM001' }
[]
wankdanker commented 8 years ago

Wow. It seems like that particular driver doesn't support checking if there are more result sets.

You might have to go off the grid and do something like:

odbc.queryResult("select * from testdata", function (err, result) {
    //if (err) ... do stuff

    result.fetchAll(function (err, rows) {
        //if (err) ... do stuff

        odbc.close(function () {
            console.log('done'); 
        });
    });
});

This is unfortunately undocumented territory.