鉴于:
"use strict"以及以下代码:
db.connect({
host: DB_HOST,
port: DB_PORT
}).then(function(dbConn) {
console.log('DBASE connected to ' + DB_HOST + ':' + DB_PORT);
db.dbList().run(dbConn).then(function(result) {
if (result.indexOf(SCRIPT_NAME) == -1) throw new Error('unable to locate database ' + SCRIPT_NAME);
dbConn.use(SCRIPT_NAME);
console.log('DBASE bound to ' + SCRIPT_NAME + ' on ' + DB_HOST + ':' + DB_PORT);
db.tableList().run(dbConn)
.then(function(result) {
if (!result) throw new Error(SCRIPT_NAME + ' unable to enumerate tables');
if (!result.length) throw new Error(SCRIPT_NAME + ' has …Run Code Online (Sandbox Code Playgroud)