Comments (3)
I'm becoming increasingly interested in implementing this feature and may start taking a crack at it in the next few weeks in my spare time.
from sqlite.
BTW, I personally think that not having a database/sql
driver is a selling point. Sure, you can add it and make it optional, but here are the reasons why I hate it.
- It implements connection pooling. By default, each sqlite query will go to a random connection in the pool, which may be in a different state.
- You lose the ability to set a lot of PRAGMA at proper times in the connection. Or really, you can do them, but they'll work only sometimes depending on the state of the connection in the pool.
- Since you lose your ability to create connections, you have to come up with your own connection string syntax to control sqlite.
- You must use their transactions. If some poor fool accidentally uses "BEGIN" and "COMMIT" for transactions, they'll be going into different connections. You must use
database/sql
transactions, which causes you to lose the ability to do things like "BEGIN EXCLUSIVE". - It adds a whole new layer of locks and pools which hurt performance.
- The mattn driver already exists
Check the last question on the mattn driver's FAQ:
https://github.com/mattn/go-sqlite3
If you start using their driver normally, you'll immediately start getting problems with locked databases. They suggest that you use their custom connection string to enable shared cache mode, and then reduce the connection pool to only 1 connection. That's the suggested way of using it apparently.
I honestly don't understand how anyone is using sqlite through database/sql
.
from sqlite.
A database/sql
driver certainly should live in a separate package (probably sqlite/driver). I'm not working on it right now because I wouldn't be using it day-to-day, so I wouldn't give it the workout it needs to be high quality.
I do believe connection pooling is possible with sqlite, though not in the default way database/sql
does it. This package includes a shared-cache based pool object. You just have to check out a connection to use it. (Because of src-string based caching of prepared statements, it's even safe to assume all of your statements have been prepared across the the pool.)
One of the big problems with that other driver that I wanted to address was lack of support for https://www.sqlite.org/unlock_notify.html, which I believe is important for using the shared cache effectively.
from sqlite.
Related Issues (20)
- Code generation? HOT 1
- doubled quoted key names as argument to json_object cause Prepare to fail HOT 1
- Multiple sqlitex.Pools giving off by 1 values HOT 2
- sqlitex.ExecScript fails to run scripts that include statements that cannot be executed within a transaction HOT 2
- API to retrieve column blob into slice of arbitrary length HOT 2
- BindBytes stores empty blobs as NULL HOT 2
- Pool.Close leaves behind WAL files HOT 8
- The state of the project. HOT 8
- No way to write blob in custom function
- Compile Time error HOT 5
- Compilation warning about memcpy with gcc 11.2.0 HOT 8
- sqlite.Stmt.Finalize should panic if called on a Stmt returned from Conn.Prepare HOT 5
- Running PRAGMA statments in sqlitex.OpenInit script
- sqlite3 math extension HOT 4
- Unable to build on Windows
- Build failure when using gcc 12. HOT 1
- ExecScript and Save panic on corrupt database
- sqlitex.ExecTransient and sqlitex.Exec not executing statements
- Support sqlite3_db_cacheflush HOT 5
- Blob struct should not have io interfaces as fields HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlite.