Posts

Showing posts with the label MySQL

MySQL - Good Habits

In this article, we are going to learn few good habits that we can consider important aspect while work with MySQL to improve performance & troubleshoot as following below: #1 - Do not use stored procedure & function parameters name same as WHERE clause field name It will be responding with all record of query because MySQL interprets field value as parameter value similar like 1=1. Example: -- Bad    CREATE   PROCEDURE  `getPersonById`( IN  id  INT (10))   BEGIN    -- return all record instead    SELECT  id, name   FROM  person  WHERE  id = id;   END    -- Good    CREATE   PROCEDURE  getPersonById( IN  personId  INT (10))   BEGIN    SELECT  id, name   FROM  person  WHERE  id = personId;   END      #2 - Use same data-type...

API Development Using Express.JS, Node.JS, MySQL

Image
In this article, we are looking into the introduction of Node.JS and Express.JS and then, I am going to create a simple MySQL data access API using Express.js, NodeJS. As we all know, Node.JS is the most trending open source technology that’s directly or indirectly partitioning into advanced web development, and let’s have lookup what is Node.JS? Node.JS Definition Node.JS is a platform that provides environment (outside the web browser) to execute JavaScript and which is built on Chrome's V8 JavaScript engine developed by Ryan Dahl. Why Node.JS? NodeJs processing model depends on a single thread with event looping. When clients send HTTP requests to NodeJs server, the Event loop is woken up by OS. It will pass the request and response objects as JavaScript closures to worker functions with callbacks. For long-running jobs like I/O operations running on non-blocking worker threads, when the job is complete, responses are sent to the main thread via a callback...