diff --git a/lib/oracle.js b/lib/oracle.js index 477dd43..967b68b 100644 --- a/lib/oracle.js +++ b/lib/oracle.js @@ -238,8 +238,8 @@ export default async ({url, username, password}) => { // We do not want to import the oracledb library until we are sure that the user is looking to use Oracle. // Installing the oracledb library is a pain, so we want to avoid it if possible. const config = { - username: username, - password: password, + username, + password, connectionString: decodeURI(url), }; diff --git a/lib/snowflake.js b/lib/snowflake.js index 4e2273a..8c787bb 100644 --- a/lib/snowflake.js +++ b/lib/snowflake.js @@ -6,7 +6,7 @@ import {Transform} from "stream"; import Pools from "./pools.js"; import {validateQueryPayload} from "./validate.js"; -import {badRequest, failedCheck} from "./errors.js"; +import {badRequest, failedCheck, notFound} from "./errors.js"; export const pools = new Pools( ({host, user, password, database, schema, warehouse, role}) => @@ -57,11 +57,12 @@ export default (url) => async (req, res) => { }); connecting.add(connection); }); - if (req.url === "/query") return query(req, res, client); if (req.url === "/query-stream") return queryStream(req, res, client); if (req.url === "/check") return check(req, res, client); } + + throw notFound(); }; export async function query(req, res, client) { @@ -263,7 +264,12 @@ function dataTypeSchema(column) { return {type: boolean}; case "fixed": case "real": - return {type: column.getScale() ? number : integer}; + return { + type: + column.getScale() === null || column.getScale() > 0 + ? number + : integer, + }; case "date": case "timestamp_ltz": case "timestamp_ntz": diff --git a/lib/validate.js b/lib/validate.js index 35cf042..75d2892 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -8,7 +8,7 @@ export const validateQueryPayload = ajv.compile({ required: ["sql"], properties: { sql: {type: "string", minLength: 1, maxLength: 32 * 1000}, - params: {anyOf: [{type: ["object"]}, {type: ["array"]}]} + params: {anyOf: [{type: ["object"]}, {type: ["array"]}]}, }, }); export const validateDescribeColumnsPayload = ajv.compile({