title: pass sql file to nodejs for execution as whole
body: <p>I am working on nodejs script that takes sql file containing large number of sql statements to be executed against mysql instance. Thus far, I've written two diff. nodejs functions that read-in sql statements one at a time from the specified sql file (storing each sql statement in nodejs object and iterating through to pass one statement at a time) and query those statements against the mysql instance. This methods works for simple sql queries, however, the queries I need to run are large and complex (and also written by multiple people, so the structure varies) so the one statement at a time approach fails when running these complex queries. </p>
  
  <p>I've stumbled across execsql package for nodejs, which I believe takes an entire sql file as argument rather than querying one statement at a time (please correct me if I am wrong), but have been unable to get this package to work (<a href="https://www.npmjs.com/package/execsql" rel="nofollow noreferrer">https://www.npmjs.com/package/execsql</a>). </p>
  
  <pre><code>var execsql = require('execsql'),
  dbConfig = {
      host: 'cloud-address',
      user: 'db-user',
      port: 3306,
      password: 'user-pass'
  },
  sql = 'use test-db;',
  sqlFile = __dirname + '/db.sql';
  execsql.config(dbConfig)
  .exec(sql)
  .execFile(sqlFile, function(err, results){
      console.log(results);
  }).end();
  
  callback(err, results);
      ^ TypeError: callback is not a function  
  </code></pre>
  
  <p>Any help is appreciated as to what nodejs packages should be achieved to do this (with the end goal of making it so that I can pass in a sql file that gets queried similar to if querying the file through a mysql-workbench shell). </p>