A lot of what you suggest cannot be done without violating our compatibility promise, and would break existing code.
I think there are changes for 1.1 in the standard libraries/packages that will break code as well.Correct me if I am wrong.
The previous implementation of ListenUnixgram returned a UDPConn as a representation of the connection endpoint. The Go 1.1 implementation instead returns a UnixConn to allow reading and writing with its ReadFrom and WriteTo methods.
Does the compatibility promise cover the standard libraries/packages?I thought it would just cover the language.I think there are changes for 1.1 in the standard libraries/packages that will break code as well.Correct me if I am wrong.
Anyway I am tired of the argument, that improvements would break existing code.That way you could not go anywhere.
The exceptions are only for obviously broken signatures, which is the case here.
A redesign should create a new package or additional types/functions, not modify an existing one.
Rémy.
One can argue, if we need database/sql in the standard library at all.The only purpose I can see, is unifying database drivers.
Anyway, there should be some consensus, how the new library shouldbe build, even if it is developed outside the standard library.
Open(drv Driver) (*DB, error)
and
type Driver interface { // Open returns a new connection to the database. // the parameters to the connection are handled by the driver // The returned connection is only used by one goroutine at a // time. Open() (Conn, error) }
and let the driver authors do something like
var driver = .... blah (set it in init)
type New struct {
User string
Password string
...
}
func (ø New) Open() (Conn, error) {
driver.Open(ø.User, ø.Password,...)
}
On 25.04 23:22, meta keule wrote:
> 1. make DB an interface. since any library using a database is supposed to
> support database/sql it is essential
> to be able to replace the db without having to write a driver (for testing,
> interception et al)
Why not better testing in the database/sql tests?
> 2. refactor the connection pool to be a separate package and an
> implementation of the DB interface. Let it be customizable.
This could probably be done without breaking database/sql API.
> 3. It should always be clear, when a connection is open and closed, don't
> do magic things like autoclosing and opening connections
> in the base package. connections should always be handled/controlled
> explicitly.
Many of the users of the base package *want* this.
> 4. remove prepare statements and transactions out of database/sql. They are
> really not needed and not supported by all drivers and they should not,
> since they could be expressed in plain SQL. More highlevel packages could
> provide shortcuts for them. There also should not be opinionated linkage
> between connection handling and transactions/prepare statements.
This would make database/sql unusable for many applications.
> 5. instead make a typed struct (ConnOptions or so) for database connections
> instead of fragile connection strings. let the driver transform the
> connection struct to whatever it needs. A port should be an int, a password
> a string etc. provide a way to transform an Url to this kind of ConnOptions
> struct.
I'd consider this a step backwards. Databases may not even have a
concept of an port or the "port" may be a filepath, or a series
of ints.
- Taru Karttunen
On 27 Apr 2013 08:11, "meta keule" <marcre...@googlemail.com> wrote:
>
> The deeper I dig into the sql package, the more rotten it looks to me.
> connections should be decoupled from prepare statements and transactions.
What about systems that prepare statements on server side?
A prepared statement is not just "a string with placeholders".
Remy.
For what its worth I'm strongly in favour of the fluent nhibernate style of chained SQL statements.
(eg. Stmt().Select().From("TableBlah").Where("field > 10").Limit(10), Table().AddColumn("field").Int32().AddColumn("xxx").DateTime().
5. instead make a typed struct (ConnOptions or so) for database connections instead of fragile connection strings. let the driver transform the connection struct to whatever it needs. A port should be an int, a password a string etc. provide a way to transform an Url to this kind of ConnOptions struct.
Regards,Benny--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Then you could just take an interface Options parameter. Seems cleaner than encoding stuff into a string.
Aaron