github.com/mattn/go-adodb@v0.0.1/adodb_go18.go (about)

     1  // +build go1.8
     2  
     3  package adodb
     4  
     5  import (
     6  	"database/sql/driver"
     7  	"errors"
     8  
     9  	"golang.org/x/net/context"
    10  )
    11  
    12  // Ping implement Pinger.
    13  func (c *AdodbConn) Ping(ctx context.Context) error {
    14  	if c.db == nil {
    15  		return errors.New("Connection was closed")
    16  	}
    17  	return nil
    18  }
    19  
    20  /*
    21  func (c *AdodbConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
    22  	list := make([]namedValue, len(args))
    23  	for i, nv := range args {
    24  		list[i] = namedValue(nv)
    25  	}
    26  	return c.query(ctx, query, list)
    27  }
    28  
    29  func (c *AdodbConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
    30  	list := make([]namedValue, len(args))
    31  	for i, nv := range args {
    32  		list[i] = namedValue(nv)
    33  	}
    34  	return c.exec(ctx, query, list)
    35  }
    36  */
    37  
    38  func (c *AdodbConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {
    39  	return c.prepare(ctx, query)
    40  }
    41  
    42  func (c *AdodbConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
    43  	return c.begin(ctx)
    44  }
    45  
    46  func (s *AdodbStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
    47  	list := make([]namedValue, len(args))
    48  	for i, nv := range args {
    49  		list[i] = namedValue(nv)
    50  	}
    51  	return s.query(ctx, list)
    52  }
    53  
    54  func (s *AdodbStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
    55  	list := make([]namedValue, len(args))
    56  	for i, nv := range args {
    57  		list[i] = namedValue(nv)
    58  	}
    59  	return s.exec(ctx, list)
    60  }