odbc

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PoolOff            = PoolOption(api.SQL_CP_OFF)
	PoolPerDriver      = PoolOption(api.SQL_CP_ONE_PER_DRIVER)
	PoolPerEnvironment = PoolOption(api.SQL_CP_ONE_PER_HENV)
)
View Source
const (
	Version3_80 = Version(api.SQL_OV_ODBC3_80)
	Version3    = Version(api.SQL_OV_ODBC3)
	Version2    = Version(api.SQL_OV_ODBC2)
)
View Source
const (
	CursorSensitive   = CursorSensitivity(api.SQL_SENSITIVE)
	CursorInsensitive = CursorSensitivity(api.SQL_INSENSITIVE)
)
View Source
const (
	ConcurrencyLock = Concurrency(api.SQL_CONCUR_LOCK)
)

Variables

View Source
var (
	ErrConnectionDead            = errors.New("connection dead")
	ErrUnsupportedIsolationLevel = errors.New("isolation level is not supported")
)
View Source
var (
	ErrInvalidHandle = errors.New("invalid handle")
	ErrHandleFreed   = errors.New("attempt to double free")
)
View Source
var (
	ErrNotImplemented = errors.New("not implemented")
)
View Source
var (
	ErrRecordSetOpen = errors.New("recordset is still open")
)

Functions

func OpenHandles added in v0.9.3

func OpenHandles() int64

Types

type Column

type Column interface {
	driver.Valuer
	Name() string
	VariableLength() (length int64, ok bool)
	Nullable() (nullable bool, ok bool)
	ScanType() reflect.Type
	Decimal() (precision int64, scale int64, ok bool)
}

type Concurrency added in v0.9.0

type Concurrency uint64

type Config

type Config struct {
	// contains filtered or unexported fields
}

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Commit

func (c *Connection) Commit() error

func (*Connection) Ping

func (c *Connection) Ping() error

func (*Connection) Rollback

func (c *Connection) Rollback() error

func (*Connection) SetAutoCommit

func (c *Connection) SetAutoCommit(autoCommit bool) error

func (*Connection) SetIsolationLevel

func (c *Connection) SetIsolationLevel(level IsolationLevel) error

func (*Connection) SetReadOnlyMode

func (c *Connection) SetReadOnlyMode(readOnly ReadOnlyMode) error

func (*Connection) Statement

func (c *Connection) Statement() (*Statement, error)

type CursorSensitivity added in v0.9.0

type CursorSensitivity uint64

type DiagRec

type DiagRec struct {
	State     string
	ErrorCode int
	Message   string
}

type Environment

type Environment struct {
	// contains filtered or unexported fields
}

func NewEnvironment

func NewEnvironment(config *Config) (*Environment, error)

func (*Environment) Close

func (e *Environment) Close() error

func (*Environment) Connect

func (e *Environment) Connect(ctx context.Context, connStr string) (*Connection, error)

func (*Environment) SetPoolOption

func (e *Environment) SetPoolOption(option PoolOption) error

func (*Environment) SetTraceFile

func (e *Environment) SetTraceFile(filePath string) error

SetTraceFile enables unixodbc trace output to the specified file, or disables tracing if the filePath is empty

func (*Environment) SetVersion

func (e *Environment) SetVersion(version Version) error

type Error

type Error struct {
	DiagRecords []*DiagRec
}

func (*Error) Error

func (e *Error) Error() string

type ErrorMap added in v0.9.0

type ErrorMap map[string]error

func (ErrorMap) Err added in v0.9.0

func (m ErrorMap) Err() error

type IsolationLevel

type IsolationLevel uint64

type PoolOption

type PoolOption uint64

type ReadOnlyMode

type ReadOnlyMode uint64

type RecordSet

type RecordSet struct {
	// contains filtered or unexported fields
}

func (*RecordSet) Close

func (rs *RecordSet) Close() error

func (*RecordSet) Column

func (rs *RecordSet) Column(index int) Column

func (*RecordSet) ColumnNames

func (rs *RecordSet) ColumnNames() []string

func (*RecordSet) ColumnWithName

func (rs *RecordSet) ColumnWithName(name string) Column

func (*RecordSet) Fetch

func (rs *RecordSet) Fetch() (more bool, err error)

func (*RecordSet) Statement

func (rs *RecordSet) Statement() *Statement

func (*RecordSet) Unmarshal

func (rs *RecordSet) Unmarshal(out interface{}) error

type Statement

type Statement struct {
	// contains filtered or unexported fields
}

func (*Statement) BindParams

func (s *Statement) BindParams(params ...interface{}) error

func (*Statement) Close

func (s *Statement) Close() error

func (*Statement) ExecDirect

func (s *Statement) ExecDirect(ctx context.Context, sql string) error

func (*Statement) Execute

func (s *Statement) Execute(ctx context.Context) error

func (*Statement) NumParams

func (s *Statement) NumParams() (int, error)

func (*Statement) Prepare

func (s *Statement) Prepare(ctx context.Context, sql string) error

func (*Statement) RecordSet

func (s *Statement) RecordSet() (*RecordSet, error)

func (*Statement) ResetParams

func (s *Statement) ResetParams() error

func (*Statement) SetConcurrency added in v0.9.0

func (s *Statement) SetConcurrency(concurrency Concurrency) error

func (*Statement) SetCursorSensitivity added in v0.9.0

func (s *Statement) SetCursorSensitivity(sensitivity CursorSensitivity) error

type TableInfo

type TableInfo struct {
	Catalog *string   `col_name:"TABLE_CAT"`
	Schema  *string   `col_name:"TABLE_SCHEM"`
	Name    string    `col_name:"TABLE_NAME"`
	Type    TableType `col_name:"TABLE_TYPE"`
	Remarks string    `col_name:"REMARKS"`
}

type TableType

type TableType string
var (
	TypeTable      TableType = "TABLE"
	TypeView       TableType = "VIEW"
	TypeSysTable   TableType = "SYSTEM TABLE"
	TypeGlobalTemp TableType = "GLOBAL TEMPORARY"
	TypeLocalTemp  TableType = "LOCAL TEMPORARY"
	TypeAlias      TableType = "ALIAS"
	TypeSynonym    TableType = "SYNONYM"
)

type TypeInfo

type TypeInfo struct {
	DataType   api.SQLINTEGER `col_name:"DATA_TYPE"`
	ColumnSize api.SQLULEN    `col_name:"COLUMN_SIZE"`
}

type Version

type Version uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL