Skip to content
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

direct-sqlite should provide lower-level access for those who need it #11

Closed
joeyadams opened this issue Aug 18, 2012 · 2 comments
Closed

Comments

@joeyadams
Copy link
Contributor

Currently, direct-sqlite contains FFI bindings, performs marshaling, and throws exceptions. This does not give some users enough control:

  • persistent-sqlite wants to avoid unnecessary conversions.
  • I want more precise error handling (e.g. distinguish between syntax errors and disk corruption) for an application I'm working on.

I propose we introduce the following alternative APIs:

  • Database.SQLite3.Direct: Similar to Database.SQLite3, but:
    • Return errors instead of throwing them. Use data types to represent errors, not just strings.
    • Only use cheap conversions, meaning no String or Text. Accepting or returning UTF8-encoded ByteStrings is fine, since persistent-sqlite has to do that anyway.
  • Database.SQLite3.Bindings: Direct FFI bindings and enumeration decoding functions.

Database.SQLite3 would use Database.SQLite3.Direct, and Database.SQLite3.Direct would use Database.SQLite3.Bindings.

I've already implemented Database.SQLite3.Bindings, and implemented Database.SQLite3 in terms of it. I would submit a pull request, but I'd rather wait until I'm done romping around in Database.SQLite3, to avoid clashing with other contributions. I plan to implement Database.SQLite3.Direct pretty soon.

Anyone have an issue with this? Thanks for the input.

@nurpax
Copy link
Collaborator

nurpax commented Aug 18, 2012

The changes to move the C low-levels into SQLite3.Bindings looks good. I like the c_sqlite3* naming convention, it makes it easier to read the code for me.

@nurpax
Copy link
Collaborator

nurpax commented Oct 18, 2012

can't this be closed now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants