bin/alasql-cli.js
function execute(sql, params) {

	if (0 === sql.trim().length) {
		console.error("\nNo SQL to process\n");
		yargs.showHelp();
		process.exit(1);
	}

	for (var i = 1; i < params.length; i++) {
		var a = params[i];
		if (a[0] !== '"' && a[0] !== "'") {
			if (+a == a) { // jshint ignore:line
				params[i] = +a;
			}
		}
	}

	alasql.promise(sql, params)
		.then(function (res) {
			if (!alasql.options.stdout) {
				console.log(formatOutput(res));
			}
			process.exit(0);
		}).catch(function (err) {
			let errorJsonObj = JSON.parse(JSON.stringify(err, Object.getOwnPropertyNames(err)));
			console.error(formatOutput({
				error: errorJsonObj
			}));
			process.exit(1);
		});
}
function execute(sql, params) {

	if (0 === sql.trim().length) {
		console.error("\nNo SQL to process\n");
		yargs.showHelp();
		process.exit(1);
	}

	for (var i = 1; i < params.length; i++) {
		var a = params[i];
		if (a[0] !== '"' && a[0] !== "'") {
			if (+a == a) { // jshint ignore:line
				params[i] = +a;
			}
		}
	}

	alasql.promise(sql, params)
		.then(function (res) {
			if (!alasql.options.stdout) {
				console.log(formatOutput(res));
			}
			process.exit(0);
		}).catch(function (err) {
			let errorJsonObj = JSON.parse(JSON.stringify(err, Object.getOwnPropertyNames(err)));
			console.error(formatOutput({
				error: errorJsonObj
			}));
			process.exit(1);
		});
}
function execute ( sql , params ) { if ( 0 === sql . trim ( ) . length ) { console . error ( "\nNo SQL to process\n" ) ; yargs . showHelp ( ) ; process . exit ( 1 ) ; } for ( var i = 1 ; i < params . length ; i ++ ) { var a = params [ i ] ; if ( a [ 0 ] !== '"' && a [ 0 ] !== "'" ) { if ( + a == a ) { // jshint ignore:line params [ i ] = + a ; } } } alasql . promise ( sql , params ) . then ( function ( res ) { if ( ! alasql . options . stdout ) { console . log ( formatOutput ( res ) ) ; } process . exit ( 0 ) ; } ) . catch ( function ( err ) { let errorJsonObj = JSON . parse ( JSON . stringify ( err , Object . getOwnPropertyNames ( err ) ) ) ; console . error ( formatOutput ( { error : errorJsonObj } ) ) ; process . exit ( 1 ) ; } ) ; }
Execute SQL query

@sql {String} SQL query
@param {String} Parameters
@returns {null} Result will be printet to console.log
Execute SQL query