Skip to content

Commit

Permalink
Merge a few minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wiltsecarpenter committed Nov 8, 2023
1 parent fe05138 commit 84c7036
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/oracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};

Expand Down
12 changes: 9 additions & 3 deletions lib/snowflake.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}) =>
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 84c7036

Please sign in to comment.