Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Is there any way to simply execute a long MySQL query from node.js?

Is there any way to simply execute a long MySQL query from node.js?

Problem

The only reliable Mysql support I know of is through node-mysql and it specifically says in the documentation:

Warning: sql statements with multiple queries separated by semicolons are not supported yet.

Which kind of sucks... Because I need to insert or update a large number of rows at a time with some logic involved, and it's easily done with one large MySQL query containing IFs and ELSEs. I can't imagine how I'd simply move all the logic over to the node.js side without an enormous loss of performance and complexity in code. So I'm not ready to give up on the pure SQL solution.

Is there any way for me to execute a large SQL query from node.js relatively easily?

Problem courtesy of: Hubro

Solution

Can you define your logic within a stored procedure and then call that as your single statement instead (passing whatever parameters you need)?

Solution courtesy of: StudyOfCrying

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Is there any way to simply execute a long MySQL query from node.js?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×