Documentation ¶
Overview ¶
Package odbc implements database/sql driver to access data via odbc interface.
Index ¶
- Variables
- func IsError(ret api.SQLRETURN) bool
- func NewError(apiName string, handle interface{}) error
- func ToHandleAndType(handle interface{}) (h api.SQLHANDLE, ht api.SQLSMALLINT, err error)
- type BaseColumn
- type BindableColumn
- type BufferLen
- type Column
- type Conn
- func (c *Conn) Begin() (driver.Tx, error)
- func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (tx driver.Tx, err error)
- func (c *Conn) Close() (err error)
- func (c *Conn) Exec(query string, args []driver.Value) (driver.Result, error)
- func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (result driver.Result, err error)
- func (c *Conn) Ping(ctx context.Context) error
- func (c *Conn) Prepare(query string) (driver.Stmt, error)
- func (c *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error)
- func (c *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (rows driver.Rows, err error)
- func (c *Conn) ResetSession(ctx context.Context) error
- type DiagRecord
- type Driver
- type Error
- type NonBindableColumn
- type Parameter
- type Result
- type Rows
- type Stats
- type Stmt
- func (s *Stmt) Close() error
- func (s *Stmt) Exec(args []driver.Value) (driver.Result, error)
- func (s *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
- func (s *Stmt) NumInput() int
- func (s *Stmt) Query(args []driver.Value) (driver.Rows, error)
- func (s *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)
- type Tx
Constants ¶
This section is empty.
Variables ¶
var ErrTXAlreadyStarted = errors.New("already in a transaction")
var ErrTXCompleted = errors.New("transaction already completed")
Functions ¶
func ToHandleAndType ¶
func ToHandleAndType(handle interface{}) (h api.SQLHANDLE, ht api.SQLSMALLINT, err error)
Types ¶
type BaseColumn ¶
type BaseColumn struct { SQLType api.SQLSMALLINT CType api.SQLSMALLINT // contains filtered or unexported fields }
BaseColumn implements common column functionality.
func (*BaseColumn) Name ¶
func (c *BaseColumn) Name() string
type BindableColumn ¶
type BindableColumn struct { *BaseColumn IsBound bool IsVariableWidth bool Size int Len BufferLen Buffer []byte }
BindableColumn allows access to columns that can have their buffers bound. Once bound at start, they are written to by odbc driver every time it fetches new row. This saves on syscall and, perhaps, some buffer copying. BindableColumn can be left unbound, then it behaves like NonBindableColumn when user reads data from it.
func NewBindableColumn ¶
func NewBindableColumn(b *BaseColumn, ctype api.SQLSMALLINT, bufSize int) *BindableColumn
type Column ¶
type Column interface { Name() string Bind(h api.SQLHSTMT, idx int) (bool, error) Value(h api.SQLHSTMT, idx int) (driver.Value, error) }
Column provides access to row columns.
func NewVariableWidthColumn ¶
func NewVariableWidthColumn(b *BaseColumn, ctype api.SQLSMALLINT, colWidth api.SQLULEN) (Column, error)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) ExecContext ¶
func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (result driver.Result, err error)
implement driver.ExecerContext
func (*Conn) PrepareContext ¶
implement driver.ConnPrepareContext
type DiagRecord ¶
func (*DiagRecord) String ¶
func (r *DiagRecord) String() string
type Driver ¶
type Driver struct { Stats // contains filtered or unexported fields }
func (*Driver) Close ¶
TODO(ninthclowd): this is not part of the driver.Driver interface and will never be called by a consumer
type Error ¶
type Error struct { APIName string Diag []DiagRecord }
type NonBindableColumn ¶
type NonBindableColumn struct {
*BaseColumn
}
NonBindableColumn provide access to columns, that can't be bound. These are of character or binary type, and, usually, there is no limit for their width.
type Parameter ¶
type Parameter struct { SQLType api.SQLSMALLINT Decimal api.SQLSMALLINT Size api.SQLULEN // Following fields store data used later by SQLExecute. // The fields keep data alive and away from gc. Data interface{} StrLen_or_IndPtr api.SQLLEN // contains filtered or unexported fields }
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) LastInsertId ¶
implement driver.Result
func (*Result) RowsAffected ¶
implement driver.Result
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
func (*Rows) HasNextResultSet ¶
implement driver.RowsNextResultSet
func (*Rows) NextResultSet ¶
implement driver.RowsNextResultSet
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) Close ¶
implement driver.Stmt Close closes the statement.
As of Go 1.1, a Stmt will not be closed if it's in use by any queries.
func (*Stmt) Exec ¶
implement driver.Stmt - per documentation, not supposed to be used by multiple goroutines
func (*Stmt) ExecContext ¶
implement driver.StmtExecContext
func (*Stmt) Query ¶
implement driver.Stmt - per documentation, not supposed to be used by multiple goroutines
func (*Stmt) QueryContext ¶
implement driver.StmtQueryContext