Comments (9)
My recollection is that sqlite returns that error when the number of parameter bindings doesn't match the number the prepared statement is expecting. I see that the inputs are deterministic, so... maybe check whether there was an earlier failure when the statement was prepared?
from direct-sqlite.
Hi @IreneKnapp, thanks for the quick reply and suggestion! Though... I'm not sure how to do that?
Looking at https://github.com/nurpax/sqlite-simple/blob/master/Database/SQLite/Simple.hs#L195 it looks like there is already a runtime check that would throw a different sort of error if the number of parameter bindings doesn't match the number the prepared statement is expecting.
And preparing the statement with sqlite-simple's query
looks like it's calling direct-sqlite's prepare
, which should throw its own error if something failed when the statement was prepared, if I'm reading it right?
Do you know of any way to make sqlite chattier to maybe explain itself about this? :) Or did I overlook some other important thing? *pokes at sqlite3 C source*
Thanks in advance :)
from direct-sqlite.
Maybe I need to run with a version of sqlite3 that has SQLITE_DEBUG
enabled? Do you happen to know how to do that? direct-sqlite is kind of magic to me, just being a dependency of the sqlite-simple library I was directly using, and I have no common sense around how C libraries (like sqlite) maybe get bundled with Haskell libraries (like direct-sqlite). Ok thanks :)
from direct-sqlite.
from direct-sqlite.
Update: It wasn't that.
from direct-sqlite.
Or maybe I need to enable SQLITE_CONFIG_LOG
also? I'm trying to add an interface to sqlite3_config
to enable it; but don't hesitate to let me know if I'm headed in the wrong direction.
from direct-sqlite.
After [unsuccessfully?] adding support to direct-sqlite for providing a custom logging handler:
setLogger :: Maybe (Error -> Utf8 -> IO ()) -> IO Error
I changed tactics and added a printf to sqlite.c where it normally invokes the logging handler, and and found that I'm somehow sometimes using a connection after closing it. So that gives me something to go on, even though I'm not sure how it's happening so unpredictably.
Let me know if you'd want to end up with a PR for setLogger
, in which case I'd ask for your help to understand why my implementation doesn't actually log anything.
If not, feel free to close this, etc.
from direct-sqlite.
Glad you figured it out!
That PR sounds handy, I encourage you to send it. Note that I'm not the maintainer anymore, I just happened to see your issue and figured I'd try to help. @sigrlami will review the PR.
from direct-sqlite.
@IreneKnapp I appreciate it!
from direct-sqlite.
Related Issues (20)
- Enable math functions HOT 3
- Test suite depends on specific directory structure, doesn't always exist HOT 4
- SQLite Threading Mode HOT 5
- Test suite failure with GHC 8
- How to add FTS5? HOT 5
- Any need to apply stat64 workaround? HOT 4
- Unreliable sqlErrorDetails in parallelized environments HOT 5
- Inaccurate version bound / build failure for GHC < 7.10 HOT 1
- Upgrading SQLite to v3.27.2
- Add a flag for compiling sqlite in Multi-thread mode HOT 3
- Upgrade embedded SQLite library HOT 2
- Test failure with system sqlite 3.34.1 HOT 1
- Add Bindings to sqlite3_status and sqlite3_status64 HOT 1
- Slowness on `stepNoCB` HOT 1
- Updating test case for upgrading SQLite HOT 1
- Allow semigroup-0.20 HOT 1
- ICU extension flag HOT 3
- Allow opening sqllite from bytestring via sqllite3_deserialize directive HOT 4
- Can't use URI HOT 3
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 direct-sqlite.