Skip to content

Commit

Permalink
fix: use upstream node-sql-parser package
Browse files Browse the repository at this point in the history
This changes Yates to use the original upstream node-sql-parser package.
The only reason Yates uses my fork is because at the time the
`exprToSQL` method I contributed was not available in the general
release. Fast-forward to 10 months later and my fork is now 499 commits
behind master XD
The only real difference that has to be made is the way that `$n`
parameters are represented in the AST, but this is a simple change to
make.

Signed-off-by: Lucian Buzzo <lucian.buzzo@gmail.com>
  • Loading branch information
LucianBuzzo committed Dec 11, 2023
1 parent fcc8fcf commit cdb1d88
Show file tree
Hide file tree
Showing 4 changed files with 2,383 additions and 25 deletions.
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"uuid": "^9.0.0"
},
"dependencies": {
"@lucianbuzzo/node-sql-parser": "^4.6.6",
"node-sql-parser": "^4.12.0",
"lodash": "^4.17.21"
},
"peerDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions src/expressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Prisma, PrismaClient } from "@prisma/client";
import { Dictionary, get } from "lodash";
import random from "lodash/random";
import matches from "lodash/matches";
import { Parser } from "@lucianbuzzo/node-sql-parser";
import { Parser } from "node-sql-parser";
import { escapeIdentifier, escapeLiteral } from "./escape";
import { RuntimeDataModel } from "@prisma/client/runtime/library";

Expand Down Expand Up @@ -254,8 +254,9 @@ export const expressionToSQL = async (getExpression: Expression, table: string):

const parameterizedStatement = deepFind(ast, {
right: {
type: "origin",
value: `$${i + 1}`,
type: "var",
name: i + 1,
prefix: "$",
},
});

Expand Down
Loading

0 comments on commit cdb1d88

Please sign in to comment.