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
odbc-safe layer #54
Comments
@pacman82 Thanks, you're doing great things! The more I think about ODBC in Rust and database access in general, I begin to understand that odbc-rs crate is really need to be something like your odbc-safe crate - it should allow to use ODBC more or less safely and mimic original API very close to not scare ODBC users from other platforms, and nothing more. All this ergonomic and idiomatic API thing is actually role for some general rust database access layer crate which could use inside various easy switchable db access implementations, like odbc-rs or postgres rust native driver, whatever. For now it looks like Diesel is candidate, but as for me it's too high level and I'd prefer a design like in a popular java jOOQ library - with excessive codegen and ergonomic SQL builder which supports many switchable database backends. So one way to go now is just to migrate everything from odbc-safe to odbc-rs with major version switch and stop worrying about high level API design, or as you suggest build new generic high level API over odbc-safe but then it tends to expand scope of this library to infinity and beyond, and I'm not sure if we can really do this actually. What do you think? |
I think you hit the nail on the head with this one. Binding to ODBC and designing a high level DB API is a bit to ambitious in one take.
I think a little incubation phase would be nice to soften the blow for our users. I did create a branch in my fork of the repository and added you as a collaborator. Yet, maybe it is even better to create the branch in your repository. Regarding the major version: I think it is a little to early release a 1.0.0, since I think we will continue to break our interface quite a lot in the near future, before we have all major use cases covered. (We need at the very least one extra lifetime on statements for the bound columns). Although I hope this to be the most dramatic change. Here is a list of things I suggest we do before we can releasing this branch:
As soon as we feel confident we might start suggesting to our user to try out the new branch. |
Or: Did some thinking yesterday. Maybe a sensible, somewhat higher layer could be achieved. Still not super high level, but not quite as bare bones as
A lot of different state transitions could be eliminated, the API Could be made a lot simpler. Some pseudo code: // Direct transition from Unversioned to Versioned state
let odbc = create_odbc_3_env()?;
let conn = odbc.connect("Datasource", "User", "Password");
if let Some(result_set) = conn.direct_execution("SELECT * FROM Table"){
// use result set...
} Something like this is may be entirely doable. There are two major caveat though:
Other than that, I honestly think that a convenient to use layer on top of odbc-safe is entirely within reach. |
@pacman82 Looks good to me. We can provide automatic support of non utf8 encodings using And warning messages could be just transcoded to Rust strings, I don't think this could be performance issue for anyone. |
Closing this because odbc-safe is implemented and this discussion lacks activity |
I am open a GitHub issue since this is probably the best way to have a public design discussion. During the last month I have been busy revisiting some of the design decisions in odbc-rs and did some iterating in a separate repository without worrying to much about breaking interfaces and tests. I did this not with use cases in mind and convenience in mind, but wanted to stay very truthful to the original ODBC C interface. You can have a look at the result of this at odbc-safe. Referring our design discussion in issue #14 [odbc-safe] is currently a merge of layers 2 and 3.
My suggestion is to rewrite odbc-rs in Terms of [odbc-safe]. This should allow us:
However, some breaking changes are likely to occur down this road. I've down little thinking on how exactly an idiomatic odbc library build on top of odbc-safe would look like, but I thought it is about time to discuss this with you and hear your general thoughts about the subject.
The text was updated successfully, but these errors were encountered: