firebolt-db / firebolt-node-sdk Goto Github PK
View Code? Open in Web Editor NEWThe Official Node SDK for Firebolt
License: Apache License 2.0
The Official Node SDK for Firebolt
License: Apache License 2.0
In hydrateRow()
you are using for (... in ...)
to iterate an array (meta
). But that does not iterate the array indices, and instead iterates the object keys of the whole prototype chain (and causes an exception in case there is something there).
Could you please change that to an for (... of ...)
with meta.entries()
instead?
Example updated function (not tested):
export const hydrateRow = (
row: Row,
meta: Meta[],
executeQueryOptions: ExecuteQueryOptions
) => {
const isArray = Array.isArray(row);
const hydratedRow = isArray ? [] : {};
for (const [index, column] of meta.entries()) {
if (isArray) {
(hydratedRow as unknown[])[index] = getHydratedValue(
row[index],
column.type,
executeQueryOptions
);
} else {
const key = column.name;
(hydratedRow as Record<string, unknown>)[key] = getHydratedValue(
row[key],
column.type,
executeQueryOptions
);
}
}
return hydratedRow;
};
Noticed that escapes are not handled properly when comments are being removed.
For example running
select 'my string\' here'
gives you my string' here
as expected.
But running this query breaks:
select 'my string\' -- here'
Result:
Reason: Invalid input error: SQL query not valid.
SQL query:
==========
select 'my string\'
^=== ERROR HERE!
==========
Error line: 0
Error column: 19
Error message: syntax error, unexpected UNTERMINATED_STRING, expecting end of file
Response status: 500
Also that how strings are parsed by the server can be controlled by a setting standard_conforming_strings
doesn't make this easier. But at least the default setting (that allows escapes like in the example above) should work.
Referring to the line here, which converts array parameters to "[" instead of "(" as required for queries which include "in" clause.
I can supply example queries if required, but I believe this is pretty straightforward.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.