-
Notifications
You must be signed in to change notification settings - Fork 101
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
Connection settings are only set for some connections #28
Comments
Hey Nuno, thank you for pointing this out!
No idea how to fix this in a cross-driver-compatible way. Maybe I should just abandon the "any driver" approach and support only specific ones, using each one's features. |
Well, e.g. One way is to receive the Another is to allow configuring (RO and RW?) DSNs, as all drivers generally have a way to configure these things in the DSN, they're just incompatible. Both options push those decisions to the library users though. I don't know of a good option here. |
Oh, you can use the In order not to push the decisions to the library users, Redka needs to be aware of each driver specifics. I'll consider that. |
Then I guess users can already fix it themselves, if they know what settings they want to apply. The big problem is that the only reliable way to do this for mattn is: their custom URI parameters (like There's really no good options here. 😔 |
I'll think about it and hopefully come back with something. On a completely unrelated note, would you be interested in my feedback on working with your driver in Redka? |
Definitely, 100%. WAL was, IMO, the big blocker to adoption, but it works fine on 64-bit Linux/macOS, and OK on 64-bit BSD/illumos. Windows is missing but might be possible with some effort. I'm also more confident that it works because they guys at gotosocial have tried it and I've had good feedback over it (they may default to it). The big caveat now (besides ncruces/go-sqlite3#75) is ncruces/go-sqlite3#32. |
Okay, here is what I changed:
I think it should be enough for now. As for the ncruces driver, it does not work with Redka at this time. I see a couple of possible reasons, will report them later. |
Feel free to open an issue in my repo for that. |
Sure, will do it soon. |
In the code below, both
d.RW
andd.RO
are connection pools. The pragmas are only executed on one connection from each pool and not others.redka/internal/sqlx/db.go
Lines 105 to 125 in 72a3b9f
Some of the default pragmas (like
journal_mode=wal
) persist across connections; others might be the default values (synchronous=default
); others are harmless if not applied (mmap_size
); but others are a behaviour change (foreign_keys
).redka/internal/sqlx/db.go
Lines 20 to 26 in 72a3b9f
As the dev of an alternative SQLite driver, I appreciate redka being driver agnostic, but I don't know of a way to consistently specify pragmas in a portable way.
Mine is compatible with modernc (pragmas are URI parameters like
pragma=journal_mode(wal)
), but mattn takes a different route.The text was updated successfully, but these errors were encountered: