Node.js MySQL Multiple Statement Queries

Source: https://www.technicalkeeda.com/nodejs-tutorials/nodejs-mysql-multiple-statement-queries


  1. var mysql = require('mysql');
  2.  
  3. var connection = mysql.createConnection({
  4. host: 'localhost',
  5. user: 'root',
  6. password: '',
  7. database: 'technicalkeeda',
  8. debug: false,
  9. multipleStatements: true
  10. });
  11. connection.connect();
  12.  
  13. var sql = "SELECT * FROM trn_employee WHERE employee_id = ?;SELECT * FROM trn_person WHERE person_id = ?";
  14.  
  15. connection.query(sql, [2, 1], function(error, results, fields) {
  16. if (error) {
  17. throw error;
  18. }
  19. console.log(results[0]);
  20. console.log(results[1]);
  21. });
  22.  
  23. connection.end();

  1. [ { employee_id: 2, first_name: 'Dinesh', last_name: 'Patil' } ]
  2. [ { person_id: 1, first_name: 'Yashwant', last_name: 'Chavan', age: 10 } ]

Không có nhận xét nào:

‘Connection lost’ / ‘Invalid origin!’ Error with n8n >= 1.87.0 behind Cloudflare Tunnel

 https://community.n8n.io/t/solved-connection-lost-invalid-origin-error-with-n8n-1-87-0-behind-cloudflare-tunnel/99913/1 The Solution:  The ...