fix(basic.gblib): Allow MERGE keyword in storage #380. @othonlima
This commit is contained in:
parent
86313b7684
commit
aa80f485c7
3 changed files with 22 additions and 10 deletions
3
boot.mjs
3
boot.mjs
|
@ -9,10 +9,11 @@ import { GBUtil } from './dist/src/util.js';
|
||||||
|
|
||||||
// Displays version of Node JS being used at runtime and others attributes.
|
// Displays version of Node JS being used at runtime and others attributes.
|
||||||
|
|
||||||
|
await GBUtil.sleep(80);
|
||||||
console.log(``);
|
console.log(``);
|
||||||
console.log(``);
|
console.log(``);
|
||||||
console.log(``);
|
console.log(``);
|
||||||
chalkAnimation.karaoke(`
|
await chalkAnimation.karaoke(`
|
||||||
█████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ®
|
█████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ®
|
||||||
██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █
|
██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █
|
||||||
██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██
|
██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██
|
||||||
|
|
|
@ -1205,8 +1205,7 @@ export class KeywordsExpressions {
|
||||||
/^\s*set\s*(.*)/gim,
|
/^\s*set\s*(.*)/gim,
|
||||||
($0, $1, $2) => {
|
($0, $1, $2) => {
|
||||||
const params = this.getParams($1, ['file', 'address', 'value']);
|
const params = this.getParams($1, ['file', 'address', 'value']);
|
||||||
const items = KeywordsExpressions.splitParamsButIgnoreCommasInDoublequotes($1);
|
return `await sys.set ({pid: pid, handle: page, ${params}})`;
|
||||||
return `${items[0]} = await sys.set ({pid: pid, handle: page, ${params}})`;
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
keywords[i++] = [
|
keywords[i++] = [
|
||||||
|
|
|
@ -738,10 +738,23 @@ export class SystemKeywords {
|
||||||
GBLog.info(`BASIC: Saving batch to storage '${table}' (SAVE).`);
|
GBLog.info(`BASIC: Saving batch to storage '${table}' (SAVE).`);
|
||||||
|
|
||||||
const definition = this.getTableFromName(table, min);
|
const definition = this.getTableFromName(table, min);
|
||||||
|
const rowsDest = [];
|
||||||
|
|
||||||
|
rows.forEach(row => {
|
||||||
|
|
||||||
|
const dst = {};
|
||||||
|
let i = 0;
|
||||||
|
Object.keys(row).forEach(column => {
|
||||||
|
const field = column.charAt(0).toUpperCase() + column.slice(1);
|
||||||
|
dst[field] = row[column];
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
rowsDest.push(dst);
|
||||||
|
});
|
||||||
|
|
||||||
await retry(
|
await retry(
|
||||||
async (bail) => {
|
async (bail) => {
|
||||||
await definition.bulkCreate(rows);
|
await definition.bulkCreate(GBUtil.caseInsensitive(rowsDest));
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
retries: 5,
|
retries: 5,
|
||||||
|
@ -2384,16 +2397,15 @@ export class SystemKeywords {
|
||||||
|
|
||||||
if (storage) {
|
if (storage) {
|
||||||
|
|
||||||
let dst = {};
|
|
||||||
|
|
||||||
// Uppercases fields.
|
// Uppercases fields.
|
||||||
|
|
||||||
|
const dst = {};
|
||||||
let i = 0;
|
let i = 0;
|
||||||
Object.keys(fieldsValues).forEach(fieldSrc => {
|
Object.keys(fieldsValues).forEach(fieldSrc => {
|
||||||
const field = fieldsNames[i].charAt(0).toUpperCase() + fieldsNames[i].slice(1);
|
const name = fieldsNames[i];
|
||||||
|
const field = name.charAt(0).toUpperCase() + name.slice(1);
|
||||||
dst[field] = fieldsValues[fieldSrc];
|
dst[field] = fieldsValues[fieldSrc];
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue