New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #5769: Sqlite support multi-value JSON insert #5782
base: master
Are you sure you want to change the base?
Conversation
b35e0f1
to
4e5c9a0
Compare
5616f55
to
128dde5
Compare
5a5251e
to
5db4d79
Compare
|
||
# Do not include .js files from .ts files | ||
util/version.js | ||
dialects/index.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this causes files not to be published either, I'd rather have them committed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhh! Good to know. There's a script generating these .gitignore
items . I can update it stop doing that and check in the generated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's ok to generate them prepublish too, to protect against someone forgetting to run it
returning, | ||
}; | ||
if ( | ||
!this.client._satisfiesVersion([3, 7, 11]) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather do this check once on driver instantiation and set a feature boolean flag for subsequent checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kibertoad what do you want to do if we initialize with the driver with a version below the 3.7.11 threshold? Throw an error and halt, forcing at least that version? Something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it break anyway if someone attempts a multi-value JSON insert anyway? Do we need to force-break anything?
// and better-sqlite3 1.0.0 shipped with 3.25.1 in 2016. | ||
// | ||
// Issue opened for this: https://github.com/WiseLibs/better-sqlite3/issues/1122 | ||
return [3, 25, 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we require minimum better-sqlite with support for multi-insert via peerDependencies? I'd rather force people to upgrade rather than lock out them out of the beneficial feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, two thoughts:
- If
better-sqlite3
users are using the bundledsqlite3
build then they're fine. The 1.0.0 version ofbetter-sqlite3
satisfies the 10+ year old requirement of being at least 3.11.7. - Technically the users of
better-sqlite3
(andsqlite3
for that matter) can use a different C compilation of the sqlite3 library. So the NPM package version doesn't guarantee the version ofsqlite3.c
they've compiled.
What would you like to do?
PS - I've opened a PR to better-sqlite3
to fix this: WiseLibs/better-sqlite3#1124
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After WiseLibs/better-sqlite3#1124 is merged we can do a more explicit check, but for older versions I would let user proceed by default and let them crash if their version is too old.
|
||
describe(`#5769 sqlite multi-insert uses standard syntax and supports JSON (does NOT include better-sqlite3)`, function () { | ||
it(`should JSON.stringify Sqlite multi-insert of Objects`, async function () { | ||
if (!isSQLite3(knex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does newer better-sqlite support this feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update the test and check. I think so, when I was originally authoring this I was just trying to focus on making sure that sqlite3
worked.
Issues:
Changes:
lib/util/version.ts
.test/unit/util/version.js
.lib/dialects/sqlite3/index.js
.lib/dialects/better-sqlite3/index.js
.lib/client.js
.lib/dialects/sqlite3/query/sqlite-querycompiler.js
.test/integration2/query/insert/inserts.spec.js
.test/
.