Questions tagged [node-mysql]

A pure node.js JavaScript Client implementing the MySql protocol. This is about the node package `mysql`, not `node-mysql` which is much less popular.

699 questions
0
votes
1 answer

Configure Different Node MySQL connections for different environments

I have 3 different MySQL database connections depending the environment (local, dev and live). Using node-mysql, how do I serve the correct connection details or detect the environment being used?
Asa Carter
  • 2,207
  • 5
  • 32
  • 62
0
votes
2 answers

Use node-mysql to execute additional queries from each result

I'm trying to get a node-mysql connection query to work in series with the result of the original query. After all the setup is done, this is the problematic part. It seems that the connection has already ended. How can I ensure that the query in…
4m1r
  • 12,234
  • 9
  • 46
  • 58
0
votes
1 answer

INSERT doesn't trigger right away

What I do: SELECT from database, if row does not exist INSERT row repeat step 1, SELECT the row from step 3 Expected result: after 4 steps there is a result in any case Result: there is no row in the select, but the row exists (see through…
Daniel W.
  • 31,164
  • 13
  • 93
  • 151
0
votes
1 answer

NODE.js working with update query at Server end

QUESTION: I am writing a node.js code on server which accepts multiple values from client on certain event var table = data['table']; var columnName = data['colName'] var columnValue = data['colValue'] var primary_id = data['pid'] var updateQuery…
Chetan T.
  • 3
  • 4
0
votes
0 answers

Queries inside of a connection query callback

I am trying to fetch a table, whose name is defined in another table and return the results. I have defined a database module with these methods: var mysql = require("mysql"); var config = require("../config/database.js"); module.exports = { …
Lerp
  • 2,957
  • 3
  • 24
  • 43
0
votes
1 answer

how to judge all callbacks end after a loop

I am using node-mysql to save data, after getting a pool there is an event loop running until pool.end() called. I connect to MySQL in a loop, get results in node-mysql callback function, I want to know when all connections completed so that I can…
Mil0R3
  • 3,876
  • 4
  • 33
  • 61
0
votes
1 answer

Pooling keeps incrementing connections and ends up in ER_CON_COUNT_ERROR

I have a class called Connection like one below. This only executes select statements. I have non pooling connection for insert or update. var _mysql = require('mysql'); function Connection() { //private variables and dependencies includes …
Karthik
  • 1,091
  • 1
  • 13
  • 36
0
votes
1 answer

How does node-mysql's queryFormat effect connections?

https://github.com/felixge/node-mysql#custom-format Does changing this method effect all connections in a pool? Does it effect only the current connection? If so, when I release it back into the pool, will it continue to have the modified method…
Sam
  • 6,414
  • 11
  • 46
  • 61
0
votes
2 answers

Writing to an array in a higher scope, from within a query's anonymous function

I need to return a value from a function, which gets its information from a query. I'm having some trouble passing information from the query's anonymous function to the container function. I tried creating an array in a higher scope (the container…
user2700923
0
votes
1 answer

Time Frame of the Current Workweek in Datetime

Javascript Time Frame I'm trying to write a Node app that grabs data entries from MySQL based on a time frame equal to the beginning and end of the current work week. Here's the Node-MySQL query: function retrieveSales(){ …
user2700923
0
votes
1 answer

Node MySQL query syntax error

I'm attempting to query my database, but am getting the error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near 'gr oup = 'new_fire', date…
user2700923
0
votes
0 answers

how to run a query SQL in node.js mysql

I have a syntax problem in a module, I fail to do the SQL query. I initialize the module database in file.js, it responds with console.log 'Connected to the database', then sends the data to the module in Database.newData(data), when it enters in…
user987055
  • 1,039
  • 4
  • 14
  • 25
0
votes
2 answers

Cannot connect to external mysql database using openshift node.js

I created a Node.js application on Openshift and the server does work. However, I have a mysql databse on another server that I would like to connect. I already gave permissions for remote mysql access to the openshift IP address. I keep receiving…
0
votes
1 answer

simple user login validation module with node

I'm writing my first (non tutorial) node application and am at a point where I'm writing a function that should take the username and password as parameters and query them against the user table of my database to return either true or false. The…
user2700923
0
votes
1 answer

node-mysql multiple instances is failing

For example, in a socket.io connection event handleServer is the callback function: function handleServer(s) { m = new mysql(); m.Query("blabla",function(r) { console.log(r) }); m.Close(); } mysql object is: m =…
user1629569
  • 661
  • 1
  • 4
  • 17