Alexander Prinzhorn

Results 617 comments of Alexander Prinzhorn

> What am I doing wrong, or rather, not understanding correctly? User-defined functions in SQLite are _completely_ different from something like stored procedures in other database engines. The user-defined functions...

![image](https://user-images.githubusercontent.com/679144/229271313-c8faabd8-e3d5-4127-ac95-566f54bb1909.png) https://github.com/WiseLibs/better-sqlite3/blob/37b7714ace3792a9122ec7e67ceda5a28b1d00a3/src/objects/database.lzz#L285-L294 @JoshuaWise do you agree with ChatGPT?

Never mind, my repro above created a Buffer of size 0, this repros: ```js const Database = require('better-sqlite3'); const db = new Database(':memory:'); db.exec('CREATE TABLE foo (id)'); console.log(db.serialize()); ``` ```...

Also see https://github.com/electron/electron/issues/35801 (https://github.com/electron/electron/issues/35801#issuecomment-1264466677), because you're probably thinking "Great, now we need twice the memory in Node.js as well just to fix this for Electron"

```js db.function('snippet', {varargs: true}, (str, cssClass = 'hilite', substr) => str.replace(substr, `${substr}`)); ``` https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#functionname-options-function---this But it doesn't make sense to have a default for `cssClass` but not for `substr`, as...

> May it be that Electron 25 and 26 share the same NODE_MODULE_VERSION number, or at least the same number is resolved in the build process? Electron 25 and 26...

I opened https://github.com/prebuild/prebuild/issues/309 to have this discussion in the right place.

Looks like migrating to N-API (#271) could resolve these issue in the future, as pointed out by the [prebuild maintainer](https://github.com/prebuild/prebuild/issues/309#issuecomment-1725006008)

Your code works fine for me: ```js import Database from "better-sqlite3"; const db = new Database("./test.db", { verbose: console.log, readonly: true, }); const buffer = db.serialize(); db.close(); const HUB_DB =...

Yep, seems like this does not account for this case: https://github.com/WiseLibs/better-sqlite3/blob/007d43e229190618884a9f976909c0b14a17d82c/src/objects/database.lzz#L285-L290 So maybe the error message could be updated to be more generic. > some error like `schema not found`....