Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with mdbtools-win when app is packaged with vercel pkg #4

Open
orizzontiholding opened this issue Jun 20, 2023 · 0 comments
Open

Comments

@orizzontiholding
Copy link

I'm trying to use this package inside my nodejs application that will be compiled into an exe using pkg from vercel.
I've downloaded the mdbtools-win.zip and I've extreced all the files into a folder that will be packed inside the exe file. Anyway I have some troubles to run the app, If I try to run a query, the opened window will be closed and the app will stop working.

This is the code.

// Standalone tool da riga di comando per ricerca EAN
const readline = require('readline')
const { stdin, stdout } = require('process')
const path = require('path')
//const adodb = require('@el3um4s/node-adodb')
//const input = require('@inquirer/prompts')
const mdbTool = require('@el3um4s/mdbtools')
const windowsPath = './mdbtools-win'

//
const dbPath = path.join(__dirname, 'odbc/msaccess/products.mdb')
console.log(windowsPath)
const rl = readline.createInterface({
    input: stdin,
    output: stdout
})
//50332130074, 8000500021286, 8000920323403 EAN DEMO
rl.question('Insert EAN code to start searching the database:\n', (answer) => {
    //Debug
    console.log(answer)
    // SQL query
    const sql = `SELECT * FROM ANART00001 WHERE CEAN='${answer}'`
    
    mdbTool.sql( dbPath, windowsPath, sql)
        .then( (results) => {
            console.log(results)  
        })
    //db.query(`SELECT * FROM BPAOLILLO_ANART00001 WHERE CEAN='${answer}'`)
        //.then( (results) => {
        //    console.log(results)
        //}).catch( e => console.log(e) )
})

Any suggestion that can help me to fix the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant