Commit aa12f9e2 authored by gwenn's avatar gwenn

Cache column names.

parent 57134f1f
......@@ -27,7 +27,8 @@ type connImpl struct {
c *Conn
}
type stmtImpl struct {
s *Stmt
s *Stmt
columnNames []string // cache
}
func (d *Driver) Open(name string) (driver.Conn, error) {
......@@ -67,7 +68,7 @@ func (c *connImpl) Prepare(query string) (driver.Stmt, error) {
if err != nil {
return nil, err
}
return &stmtImpl{s}, nil
return &stmtImpl{s, nil}, nil
}
func (c *connImpl) Close() error {
......@@ -134,7 +135,10 @@ func (s *stmtImpl) bind(args []driver.Value) error {
// TODO Cache result?
func (s *stmtImpl) Columns() []string {
return s.s.ColumnNames()
if s.columnNames == nil {
s.columnNames = s.s.ColumnNames()
}
return s.columnNames
}
func (s *stmtImpl) Next(dest []driver.Value) error {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment