Skip to content

Tag: node.js

UNION ALL Slower than N queries

This question is following this question where I wanted to select the MAX value of multiples fields while retrieving each row. The accepted answer with UNION ALL worked like a charm but I now have some scaling issues. To give some context, I have more than 3 million rows in my matches table and the filters us…

How to convert Buffer to base64 image in Node js

I am getting data from my SQL database like this: How can I convert result to a base64 image in Node.js? For Example: ‘data:image/png;base64,iVBORw0KGgoAAAANS’ Answer Since you’re receiving a Buffer back as output, Buffer.toString(‘base64’) will convert the raw binary data in the buffe…

use quotes in sql query node.js

I have my query like so: but when I insert the query into my database (I am storing the query for analytical purposes), it fails because of the quotes. how can I fix this? I tried converting thequery to toString(), but that was a useless attempt. Any other ideas? edit: error i am recieving is: Answer This is …