Search
 
SCRIPT & CODE EXAMPLE
 

SQL

async await mysql nodejs

const mysql = require('mysql'); // or use import if you use TS
const util = require('util');
const conn = mysql.createConnection({yourHOST/USER/PW/DB});

// node native promisify
const query = util.promisify(conn.query).bind(conn);

(async () => {
  try {
    const rows = await query('select count(*) as count from file_managed');
    console.log(rows);
  } finally {
    conn.end();
  }
})()
Comment

PREVIOUS NEXT
Code Example
Sql :: update in sql 
Sql :: drop table if exists oracle 
Sql :: user privileges postgresql information_schema 
Sql :: search query in mysql 
Sql :: create database store 
Sql :: how to delete a column in sql 
Sql :: mysql tinyint max value 
Sql :: how to change owner in postgres 
Sql :: sql server count all tables rows 
Sql :: the package java.sql is not accessible 
Sql :: plsql code for deleting a row from nested table in oracle 
Sql :: update set with inner join oracle 
Sql :: reset sql auto increment 
Sql :: sqlite version check 
Sql :: datetime add 2 hours sql 
Sql :: difference between where and having clause 
Sql :: mysql set primary key 
Sql :: sql create table with datetime automatically 
Sql :: create table sql 
Sql :: oracle asynchronous query 
Sql :: create function in microsoft sql server 
Sql :: use of now() in mysql 
Sql :: sql select all from table 
Sql :: uppercase and lowercase in sql 
Sql :: mysql jdbc timezone 
Sql :: change old domain to new domain name wordpress 
Sql :: sql timestamp to date 
Sql :: mysql how to change default charset 
Sql :: ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails 
Sql :: SQL loop with cursor 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =