nuintun / node-adodb

A node.js javascript client implementing the ADODB protocol on windows.
https://nuintun.github.io/node-adodb
MIT License
185 stars 51 forks source link

connection.query does not return #47

Closed icarus31 closed 5 years ago

icarus31 commented 6 years ago

Hi,

I developed an Angular 4+Electron application with node-adodb. It works perfectly in development mode, but when packaging everything (create the .exe and other electron files), the connection.query does not go to the 'then()' or the 'catch()'!

Using node-adodb version 4.0.6 Angular 4.3.6 electron 1.7.9 electron-packager: 10.1.1

main.js code

const ADODB = require('node-adodb');
const dbProvider = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=';
const databasePath = path.normalize('C:\\temp\\mydb.mdb');

ipcMain.on('select', (event, type, sql) => {

    const reply = 'reply-select-' + type;

    connection = ADODB.open(dbProvider + databasePath + ";");

    connection
      .query(sql)
      .then((data) => {
        event.sender.send(reply, { status: 0, message: '', data: data });
      })
      .catch((error) => {
        console.error('ERROR with select: ' + error);
        event.sender.send(reply, { status: 1, message: error.message, data: {} });
      });
  });

I know it enters in the ipcMain.on, execute the ADODB.open, but after, nothing.

Any clue why or some things that you could suggest me to try?

Thanks

nuintun commented 6 years ago

@icarus31 See #36

icarus31 commented 6 years ago

@nuintun, the solution is to use the 'hazardous' library instead, right? Have you tried it too? Would you mind to help me out how to do that? No too sure to understand. Thanks

AdrianCuartas commented 6 years ago

Same problem here. I tried installing hazrdous library and adding the require('hazardous') line in proxy.js file just as they say in #36 issue. It doesn't work.

I think our problem is a different issue because we don't get an error message. It's just the connection who doesn't return any values.

I'm using "node-adodb": "^4.0.7" "vue": "^2.3.3", "electron": "^1.7.5", "electron-packager": "^8.5.0",

@icarus31 Did you find a way to fix it? Thanks in advance.

icarus31 commented 6 years ago

Hi @AdrianCuartas, nothing new from my side :-(

nuintun commented 6 years ago

@AdrianCuartas @icarus31 Please upload a demo~

AdrianCuartas commented 6 years ago

I'm sorry, I changed it for another module. But I think the problem could be some dependency of a folder (if it exists).

When you pack an electron application, you are not longer able to read the content of a folder inside node_modules. That's because all is packed in a single file (.asar). You can read and import a file, of course, but not to read (fs.readdir) the content of a folder.