node-jt400
Version:
JT400 (IBM Toolbox) for NodeJS
18 lines • 551 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toInsertSql = toInsertSql;
function recordToValues(record) {
const str = Object.keys(record)
.map(() => '?')
.join(', ');
return '(' + str + ')';
}
function toInsertSql(tableName, records) {
const first = records[0];
const keys = Object.keys(first);
const sql = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES${records
.map(recordToValues)
.join(', ')}`;
return sql;
}
//# sourceMappingURL=sqlutil.js.map