CodeFoodPixels / node-promise-mysql

A wrapper for mysqljs/mysql that wraps function calls with Bluebird promises.
MIT License
338 stars 64 forks source link

await connection.query() never return completed #98

Closed vanerac closed 5 years ago

vanerac commented 5 years ago

Code

async function test(){
  let pConnection = await pool.getConnection()
  await sConnection.query(`SELECT * FROM users;`)
  console.log(`Single connection query end`)
  await pConnection.query(`SELECT * FROM users;`)
  await pConnection.release()
  console.log(`Pool connection end`)
}
  test().then(() =>{console.log(`Function ended`)})

Console output:

Single connection query end
Pool connection end

Expected console outut:

Single connection query end
Pool connection end
Function ended

I don't know if this is a bug or if im doing something wrong, but in case...

CodeFoodPixels commented 5 years ago

I'm going to guess that by closing this it means you figured out that you need to return a promise?

vanerac commented 5 years ago

yeah my bad