Skip to content

Commit

Permalink
Format src
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrw committed Feb 3, 2024
1 parent df396b6 commit 6db74fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
13 changes: 5 additions & 8 deletions src/38query.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Main query procedure
function queryfn(query, oldscope, cb, A, B) {

query.sourceslen = query.sources.length;
let slen = query.sourceslen;
query.query = query; // TODO Remove to prevent memory leaks
Expand Down Expand Up @@ -44,7 +43,6 @@ function queryfn(query, oldscope, cb, A, B) {
// console.log(query.queriesdata[0]);
}


query.scope = oldscope ? cloneDeep(oldscope) : {};

// First - refresh data sources
Expand Down Expand Up @@ -159,8 +157,9 @@ function queryfn3(query) {
var gfns = '';
query.aggrKeys.forEach(function (col) {
gfns += `
g[${JSON.stringify(col.nick)}] = alasql.aggr[${JSON.stringify(col.funcid)
}](undefined,g[${JSON.stringify(col.nick)}],3); `;
g[${JSON.stringify(col.nick)}] = alasql.aggr[${JSON.stringify(
col.funcid
)}](undefined,g[${JSON.stringify(col.nick)}],3); `;
});
var gfn = new Function('g,params,alasql', 'var y;' + gfns);
}
Expand Down Expand Up @@ -294,7 +293,6 @@ function queryfn3(query) {
// Reduce to limit and offset
doLimit(query);


// TODO: Check what artefacts rest from Angular.js
if (typeof angular != 'undefined') {
query.removeKeys.push('$$hashKey');
Expand Down Expand Up @@ -375,7 +373,6 @@ function queryfn3(query) {
res = query.data;
if (query.cb) res = query.cb(query.data, query.A, query.B);
return res;

}

// Limiting
Expand Down Expand Up @@ -436,7 +433,7 @@ var preIndex = function (query) {
// Check if index already exists
let ixx =
alasql.databases[source.databaseid].tables[source.tableid].indices[
hash(source.onrightfns + '`' + source.srcwherefns)
hash(source.onrightfns + '`' + source.srcwherefns)
];
if (!alasql.databases[source.databaseid].tables[source.tableid].dirty && ixx) {
source.ix = ixx;
Expand Down Expand Up @@ -489,7 +486,7 @@ var preIndex = function (query) {
// Check if index exists
ixx =
alasql.databases[source.databaseid].tables[source.tableid].indices[
hash(source.wxleftfns + '`')
hash(source.wxleftfns + '`')
];
}
if (!alasql.databases[source.databaseid].tables[source.tableid].dirty && ixx) {
Expand Down
8 changes: 0 additions & 8 deletions src/39dojoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function doJoin(query, scope, h) {
// Todo: check if this runs once too many
// Then apply where and select
if (query.wherefn(scope, query.params, alasql)) {

// If there is a GROUP BY then pipe to grouping function
if (query.groupfn) {
query.groupfn(scope, query.params, alasql);
Expand All @@ -35,14 +34,12 @@ function doJoin(query, scope, h) {
},
scope
);

} else {
// STEP 1

let source = query.sources[h];
let nextsource = query.sources[h + 1];


let tableid = source.alias || source.tableid;
let pass = false; // For LEFT JOIN
let data = source.data;
Expand All @@ -58,7 +55,6 @@ function doJoin(query, scope, h) {
) {
data = source.ix[source.onleftfn(scope, query.params, alasql)] || [];
opt = true;

}
}

Expand Down Expand Up @@ -112,8 +108,6 @@ function doJoin(query, scope, h) {
doJoin(query, scope, h + 1);
}



// STEP 2

if (h == 0) {
Expand Down Expand Up @@ -159,8 +153,6 @@ function doJoin(query, scope, h) {
}

scope[tableid] = undefined;


}
}

Expand Down
4 changes: 2 additions & 2 deletions src/40select.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ function modify(query, res) {
}

columns = Object.keys(allcol).map(function (columnid) {
return { columnid: columnid };
return {columnid: columnid};
});
} else {
// Cannot recognize columns
Expand Down Expand Up @@ -540,7 +540,7 @@ function modify(query, res) {
res = ar;
// res = arrayOfArrays(res);
} else if (modifier === 'RECORDSET') {
res = new alasql.Recordset({ columns: columns, data: res });
res = new alasql.Recordset({columns: columns, data: res});
// res = arrayOfArrays(res);
} else if (modifier === 'TEXTSTRING') {
var key;
Expand Down

0 comments on commit 6db74fc

Please sign in to comment.