Questions tagged [mysqljs]
62 questions
0
votes
1 answer
Mysql serial execution nodejs
mysqldb.js
const mysqlDatabasePool = mysql.createPool({
connectionLimit: 50,
host: process.env.MYSQL_HOST,
user: process.env.MYSQL_USERNAME,
password: process.env.MYSQL_PASSWORD,
port: process.env.MYSQL_PORT,
database:…

rishij
- 15
- 1
- 3
0
votes
2 answers
NodeJs + Mysql query execution too late (delays)
NodeJs + Mysql query execution too late (delays)
https://github.com/mysqljs/mysql
Hello guys, I need help with mysql js, when I do .query(); the callback always delaying and gives me empty result but if I put timer it will give me the results, how…

Eddy Blackpool
- 97
- 2
- 9
0
votes
0 answers
Node.js mysql createPool Deadlock sometimes... but why?
I have a problem: I changed mysql from createConnection to createPool. But sometimes when many queries will run, I get deadlocks.
Here's the pool
var db_config = {
connectionLimit : 1000,
host: 'localhost',
user: '******',
password:…

Reudiga
- 29
- 1
- 4
0
votes
2 answers
Error with HTTP header when submit twice the same request
Hi there I'm doing a very simple API using NodeJS, ExpressJS and MySQLJs. I have a little form that make the request login request to the server. The problem I have is when I'm trying to do the same request twice after the first has been finished,…

Ismael Moral
- 722
- 1
- 9
- 35
0
votes
0 answers
mysql-js how to insert bulk records with an inserted id
My use case.
First I insert a single record to the grn_master table.
Then I get that insertedId to insert multiple records to the grn_detail table.
This is my code.
async function create(req, res, next) {
const grn = req.body.grn;
…

margherita pizza
- 6,623
- 23
- 84
- 152
0
votes
2 answers
How to insert values into Mysql.js table in Node express project
This is my use case.
First I insert data to the customer table.
Then I get the insertId for the customer.
Then I try to insert data into address table using that id.
async function createCustomer(req, res, next) {
const customer = {
…

margherita pizza
- 6,623
- 23
- 84
- 152
0
votes
1 answer
Why can't mysqljs/mysql's .query callback access variables defined outside of its block?
I think this is easiest to explain with an example.
var my_variable = 10;
let my_sql = "select count(id) as id_count from table";
con.query(my_sql, function (err, my_result) {
if (my_result[0].id_count > 10) {
my_variable += 10;
…

Stiofán
- 453
- 5
- 17
0
votes
1 answer
x-devapi unable to connect to database in Google app-engine
I am deploying a simple nodejs server to App-engine which works well except for the database connection using the X-devapi. I am getting this error:
All routers failed.
Here is the code I use:
'use strict';
const express =…

Geek Guy
- 710
- 1
- 8
- 28
0
votes
2 answers
async await doesn't response in express.js with mysql.js
First I'm trying to insert data into the restaurant table.
After it finished (console log). It should call the second query (Insert audit). But it doesn't call that query and holds on the first function.
How do I fix this?
async function…

margherita pizza
- 6,623
- 23
- 84
- 152
0
votes
1 answer
How should I import a large amount of data to mysql via nodejs?
I am building a custom import tool and wondering what would be the best practice of importing a large amount of data. I have the following JSON data structure with a minimum of 500 products across 30 days per import.
"rows": [{
…

Jun
- 113
- 1
- 2
- 7
0
votes
0 answers
Node Streams to Mysql
I have to parse large csvs approx 1gb, map the header to the database columns, and format every row. I.E the csv has "Gender" Male but my database only accepts enum('M', 'F', 'U').
Since the files are so large I have to use node streams, to…

Yasin Yaqoobi
- 1,888
- 3
- 27
- 38
0
votes
1 answer
Node MySQL bulk insert with a sub query?
Is it possible with the node mysql library to bulk insert using a sub query?
Something like
var data = [[1,2],[3,4]];
var qry = 'insert into tableA select ? from tableB where id = ?';
connection.query(qry,[data]);

Michael
- 2,825
- 3
- 24
- 30
0
votes
1 answer
MySQL INSERT SET with PASSWORD()
req.body = {
username: 1,
password: 1
}
conn.query('INSERT INTO user SET username = ?, password = PASSWORD(?)',
[req.body.username, req.body.password])
When using MySQL for Nodejs, we can do the above to insert an user.
However, the…

Avery235
- 4,756
- 12
- 49
- 83
0
votes
1 answer
Fire passport.js callback after a Database fetch is done
I need to redirect a Passport.js Facebook login to a profile route that renders a EJS view feeding it the User object as well as some additional data (messages array) fetched asynchronously from a DB.
Unfortunately, I get this error
Cannot GET…

medunes
- 541
- 3
- 16
0
votes
1 answer
Nodejs async.waterfall callbacks argument mismatch?
I am trying to use async.waterfall to execute queries against a database sequentially so that I can rollback all of them if there is an error on one. Below is my code:
function _getDBConnection(callback) {
try {
…

legendofawesomeness
- 2,901
- 2
- 19
- 32