Skip to content

Commit

Permalink
bugfix: sql.js v1.2+ don't support undefined parameters
Browse files Browse the repository at this point in the history
before sql.js 1.2 it seems undefined were treated as if they were null,
but as of 1.2 they cause a query error & fail to execute

this change swaps out any undefined parameters with `null`s

closes typeorm#5720
  • Loading branch information
imnotjames committed Sep 11, 2020
1 parent 7167903 commit d44b284
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 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
Expand Up @@ -97,7 +97,7 @@
"sinon": "^7.2.5",
"sinon-chai": "^3.3.0",
"source-map-support": "^0.5.10",
"sql.js": "^1.0.0",
"sql.js": "^1.3.0",
"sqlite3": "^4.0.9",
"ts-node": "^8.0.2",
"typeorm-aurora-data-api-driver": "^1.3.0",
Expand Down
2 changes: 2 additions & 0 deletions src/driver/sqljs/SqljsQueryRunner.ts
Expand Up @@ -53,6 +53,8 @@ export class SqljsQueryRunner extends AbstractSqliteQueryRunner {
try {
statement = databaseConnection.prepare(query);
if (parameters) {
parameters = parameters.map(p => typeof p !== 'undefined' ? p : null);

statement.bind(parameters);
}

Expand Down

0 comments on commit d44b284

Please sign in to comment.