Documentation ¶
Overview ¶
Package odbc implements database/sql driver to access data via odbc interface.
Index ¶
- Variables
- func ConvertAssign(dest, src interface{}) error
- func CreateDb(dbname string, connStr string, options ...string) (bool, error)
- func DropDb(dbname string, connStr string) (bool, error)
- func IsError(ret api.SQLRETURN) bool
- func NewError(apiName string, handle interface{}) error
- func SqltoCtype(sqltype api.SQLSMALLINT) api.SQLSMALLINT
- func ToHandleAndType(handle interface{}) (h api.SQLHANDLE, ht api.SQLSMALLINT)
- type BaseColumn
- type BindableColumn
- type BufferLen
- type Column
- type Conn
- type DBP
- type DiagRecord
- type Driver
- type Error
- type NonBindableColumn
- type ODBCStmt
- type Out
- type Parameter
- type Pool
- type Result
- type Rows
- func (r *Rows) Close() error
- func (r *Rows) ColumnTypeDatabaseTypeName(index int) string
- func (r *Rows) ColumnTypeLength(index int) (length int64, ok bool)
- func (r *Rows) ColumnTypeNullable(index int) (nullable, ok bool)
- func (r *Rows) ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool)
- func (r *Rows) ColumnTypeScanType(index int) reflect.Type
- func (r *Rows) Columns() []string
- func (r *Rows) HasNextResultSet() bool
- func (r *Rows) Next(dest []driver.Value) error
- func (r *Rows) NextResultSet() error
- type Stats
- type Stmt
- type Tx
Constants ¶
This section is empty.
Variables ¶
var ConnMaxLifetime, PoolSize int
var Psize int
Psize sets the size of the pool idf value is passed
Functions ¶
func ConvertAssign ¶ added in v0.1.1
func ConvertAssign(dest, src interface{}) error
ConvertAssign function copies the database data to Dest field in stored procedure.
func CreateDb ¶ added in v0.3.0
CreateDb function will take the db name and user details as parameters and create the database.
func DropDb ¶ added in v0.3.0
DropDb function will take the db name and user details as parameters and drop the database.
func SqltoCtype ¶ added in v0.1.1
func SqltoCtype(sqltype api.SQLSMALLINT) api.SQLSMALLINT
SqltoCtype function will convert the sql type to c type
func ToHandleAndType ¶
func ToHandleAndType(handle interface{}) (h api.SQLHANDLE, ht api.SQLSMALLINT)
Types ¶
type BaseColumn ¶
type BaseColumn struct { CType api.SQLSMALLINT SType api.SQLSMALLINT // contains filtered or unexported fields }
BaseColumn implements common column functionality.
func (*BaseColumn) Name ¶
func (c *BaseColumn) Name() string
func (*BaseColumn) TypeScan ¶ added in v0.1.0
func (c *BaseColumn) TypeScan() reflect.Type
type BindableColumn ¶
type BindableColumn struct { *BaseColumn IsBound bool IsVariableWidth bool Size int Len BufferLen Buffer []byte // contains filtered or unexported fields }
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 TypeScan() reflect.Type 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
type DBP ¶
DBP struct type contains the timeout, dbinstance and connection string
type DiagRecord ¶
func (*DiagRecord) String ¶
func (r *DiagRecord) String() string
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 ODBCStmt ¶
type ODBCStmt struct { Parameters []Parameter Cols []Column // contains filtered or unexported fields }
func (*ODBCStmt) BindColumns ¶
type Out ¶ added in v0.1.1
type Out struct {
// contains filtered or unexported fields
}
Out struct is used to store the value of a OUT parameter in Stored Procedure
func (*Out) ConvertAssign ¶ added in v0.1.1
ConvertAssign function copies the database data to Dest field in stored procedure.
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 Outs []*Out // contains filtered or unexported fields }
func ExtractParameters ¶
ExtractParameters will describe all the parameters
type Pool ¶
type Pool struct { PoolSize int // contains filtered or unexported fields }
Pool struct contais the about the pool like size, used and available connections
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) LastInsertId ¶
func (*Result) RowsAffected ¶
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
func (*Rows) ColumnTypeDatabaseTypeName ¶ added in v0.1.0
func (*Rows) ColumnTypeLength ¶ added in v0.1.0
func (*Rows) ColumnTypeNullable ¶ added in v0.1.0
func (*Rows) ColumnTypePrecisionScale ¶ added in v0.1.0
func (*Rows) ColumnTypeScanType ¶ added in v0.1.0
func (*Rows) HasNextResultSet ¶ added in v0.1.0
func (*Rows) NextResultSet ¶ added in v0.1.0
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) CheckNamedValue ¶ added in v0.1.1
func (s *Stmt) CheckNamedValue(nv *driver.NamedValue) (err error)
CheckNamedValue implementes driver.NamedValueChecker.