My belief is that a generic interface to DBs is only useful because that way 
you can write other DB-driven libraries that don't care about the details of 
the DB. I don't think I've ever seen code in the wild that uses this 
functionality though (although, admittedly, I haven't looked at a lot of code 
that uses databases in general).

-Kevin

On Dec 11, 2013, at 9:10 AM, Steven Fackler <[email protected]> wrote:

> The interface can be made generic, but it'd require HKT and potentially some 
> more work on removing spurious conflicting trait implementation warnings. It 
> only uses trait objects for query parameters where you actually need an array 
> of distinct types implementing an interface. I've also found that generic SQL 
> interfaces are less than useful in the "I can instantly swap from Postgres to 
> SQLite with a config file toggle" sense simply because their implementations 
> of SQL (SERIAL vs AUTOINCREMENT, etc) differ too much for it to work without 
> a ton of pain. If anything, a generic API would be nice just to push the APIs 
> of different SQL client libraries closer together.
> 
> Someone could absolutely take the interface used by rust-postgres and make a 
> MySQL/MariaDB driver with it, but that person wouldn't be me :)
> 
> Steven Fackler
> 
> 
> On Wed, Dec 11, 2013 at 7:15 AM, Gaetan <[email protected]> wrote:
> I agree python dbapi is pretty simple to use due to the dynamic nature of 
> types in python.
> 
> I like this rust postgre binding, I can't see why it cannot be extended to 
> support mysql?
> 
> Actually, my main reference is sqlalchemy but it's a step much higher in term 
> of abstraction of the DB.
> 
> -----
> Gaetan
> 
> 
> 
> 2013/12/11 Corey Richardson <[email protected]>
> Python has the advantage of dynamic typing, and Go runtime type
> assertions and variadics. Their interfaces probably aren't /too/ good
> for inspiration, especially Python's.
> 
> See rust-postgres (https://github.com/sfackler/rust-postgres) for an
> existing DB binding. I think it's fairly idiomatic and any DB API
> should draw inspiration from it. It leverages trait objects, though
> it's unclear that that can be generic. Personally I've never really
> been a fan of generic SQL APIs. Unless they leverage intense amounts
> of magic (Entity Framework, SQLAlchemy), I find they end up being
> crippled (luasql) or fairly uses (python's dbapi).
> 
> Maybe that's just me.
> 
> On Wed, Dec 11, 2013 at 9:24 AM, Gaetan <[email protected]> wrote:
> > I'll be glad volunteering for this task, however I'm new in rust so I may
> > need to have some mentoring for this...
> >
> > I would be inspired by the python interface:
> > https://pypi.python.org/pypi/MySQL-python/1.2.4
> >
> > -----
> > Gaetan
> >
> >
> >
> > 2013/12/11 John Mija <[email protected]>
> >>
> >> Before of release 1.0, it would be very good if it's added to the package
> >> standard a generic interface to be implemented by the packages of SQL
> >> drivers.
> >>
> >> As example, see packages "database/sql" and "database/sql/driver" in the
> >> Go's library:
> >>
> >> http://golang.org/pkg/database/
> >> _______________________________________________
> >> Rust-dev mailing list
> >> [email protected]
> >> https://mail.mozilla.org/listinfo/rust-dev
> >
> >
> >
> > _______________________________________________
> > Rust-dev mailing list
> > [email protected]
> > https://mail.mozilla.org/listinfo/rust-dev
> >
> 
> 
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
> 
> 
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to