Closed joeyadams closed 12 years ago
Just for the record, if you use git mv in future, it preserves history on the file. I'm now reading through this all!
Just for the record, if you use git mv in future, it preserves history on the file.
Unfortunately, that's not true: http://stackoverflow.com/questions/1094269/whats-the-purpose-of-git-mv
That is, unless they changed it in a recent version of git. In any case, thanks for putting up with my shenanigans.
Just as a comment, we made a breaking API change so recently (the switch to Text, with 2.0) that I'm not worried about a second one. So you should probably go ahead and add any changes that you'd like to make "when we're ready to break things".
Just as a comment, we made a breaking API change so recently (the switch to Text, with 2.0)
Wow, only five days ago. I didn't realize it was that recent.
So you should probably go ahead and add any changes that you'd like to make "when we're ready to break things".
I'd be happy to. In any case, since no functions in Database.SQLite3 currently take or return an 'Error', I doubt changing it will cause compatibility issues.
I won't mind any API breaking changes in direct-sqlite, but if you do break the existing API, please bump up the version number to 2.1 so that I can protect sqlite-simple and snaplet-sqlite-simple with a version upper bound.
Yes, naturally. Don't worry!
On Mon, Aug 20, 2012 at 3:13 AM, Janne Hellsten notifications@github.comwrote:
I won't mind any API breaking changes in direct-sqlite, but if you do break the existing API, please bump up the version number to 2.1 so that I can protect sqlite-simple and snaplet-sqlite-simple with a version upper bound.
— Reply to this email directly or view it on GitHubhttps://github.com/IreneKnapp/direct-sqlite/pull/12#issuecomment-7862237.
-- Irene Knapp
Actually, I decided not to break down the error code enumeration (data Result = ...
). I see it as a lot of work, with very little benefit:
CError
to CResult
all over the place.Left (Error ErrorError)
.One thing I would like to break, though, is the name of bind:
bind :: Statement -> [SQLData] -> IO ()
Unlike column
, which only reads one column, bind
sets all the parameters. Here's what I'd like to do instead:
bind :: Statement -> ParamIndex -> SQLData -> IO ()
binds :: Statement -> [SQLData] -> IO ()
This should also make it easier for people to implement named parameters in their higher-level libraries.
@IreneKnapp: Have you finished reviewing this pull request yet? I plan to improve the API of Database.SQLite3
itself, but the commits will be based on the ones in this pull request.
Sorry it's taking so long! I want to understand it, not just rubber-stamp it. It's fairly invasive and if I don't keep myself current with what's going on in the codebase, I'll cease to understand it, you know? Hopefully tonight.
(If I conclude that I'm never going to get the time, then I will just rubber-stamp it, just to be clear. That's the only thing that would be fair. I'm aware that this phase when you've done the work and are waiting to hear back is pretty frustrating. But right now I expect to have time.)
I guess I'll just trust that your notes are accurate rather than reading and understanding the code. I feel like I've kept you waiting too long already.
Sorry, this is a pretty big pull request. The commits trace the development history, which is basically:
Database.SQLite3
to use those bindings.Database.SQLite3.Direct
, a lower-level variant ofDatabase.SQLite3
implemented with the FFI bindings.Database.SQLite3
again, to useDatabase.SQLite3.Direct
.Merging information
This pull request renames SQLite3.hsc to SQLite3.hs, which makes the diff a bit less useful. To see what changed in
Database.SQLite3
, you can do the following:This pull request includes the commit by @nurpax from pull request #9, with the merge conflict resolved.
What this pull request does
This splits direct-sqlite into three levels of abstraction:
Database.SQLite3
: Existing API.Database.SQLite3.Direct
: LikeDatabase.SQLite3
, but return errors instead of throwing them, and only use cheap conversions (meaning noString
andText
).Note: the
SQLData
type defined here is different from the one inDatabase.SQLite3
. The newSQLData
type has strictness annotations, so it is incompatible with the old type. This should be fixed in a future version, once we decide to break the existing API.Database.SQLite3.Bindings
: Raw FFI bindings, using newtypes to clarify parameters and make the bindings easier to use correctly.My goal was to avoid breaking the existing API, so people can start using the new internals without compatibility issues. However, some minor changes have been made to the existing API:
CInt
is smaller thanInt
.Future directions
I took plenty of liberties with
Database.SQLite3.Direct
. It represents the direction I would like to seeDatabase.SQLite3
go, namely:I'd also want to factor the
Error
type:But we'd have to remove these data constructors from
Error
:ErrorOK
ErrorRow
ErrorDone