ms

package
Version: v0.0.0-...-cc996d8 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Zlib Imports: 18 Imported by: 0

README

# Microsoft SQL Server (MS SQL Server) TDS database client.
Database driver for database client frontend:
 http://godoc.org/bitbucket.org/kardianos/rdb

Documentation

Overview

Microsoft SQL Server (MS SQL Server) TDS Protocol database client.

For use with sql client interface:

bitbucket.org/kardianos/rdb

This driver doesn't use cgo or any c libraries and is self contained.

Supported Data Types

rdb.
	TypeNull

	TypeString     :: Maps to nvarchar
	TypeAnsiString :: Maps to varchar
	TypeBinary     :: Maps to varbinary

	TypeText
	TypeAnsiText
	TypeVarChar
	TypeAnsiVarChar
	TypeChar
	TypeAnsiChar

	TypeBool
	TypeInt8
	TypeInt16
	TypeInt32
	TypeInt64

	TypeFloat32
	TypeFloat64

	TypeDecimal

	TypeTDZ
	TypeTime
	TypeDate
	TypeTD   :: Maps to DateTime2

tds.
	TypeOldTD :: Maps to DateTime

The following types support io.Writer for output fields, and io.Reader for input parameters:

TypeString
TypeAnsiString
TypeBinary
TypeVarChar
TypeAnsiVarChar

Transactions are not yet supported.

Out parameters are not yet supported.

Parameter names are not optional. They must be supplied.

Index

Constants

View Source
const (
	TypeOldBool rdb.Type = rdb.TypeDriverThresh + iota
	TypeOldByte
	TypeOldInt16
	TypeOldInt32
	TypeOldInt64
	TypeOldFloat32
	TypeOldFloat64
	TypeOldTD // DateTime
	TypeNumeric
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	ProductVersion  *semver.Version
	ProtocolVersion *semver.Version
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(c io.ReadWriteCloser) *Connection

func (*Connection) Available

func (tds *Connection) Available() bool

func (*Connection) Begin

func (tds *Connection) Begin(iso rdb.IsolationLevel) error

func (*Connection) Close

func (tds *Connection) Close()

func (*Connection) Commit

func (tds *Connection) Commit() error

func (*Connection) ConnectionInfo

func (tds *Connection) ConnectionInfo() *rdb.ConnectionInfo

func (*Connection) NextQuery

func (tds *Connection) NextQuery() (err error)

func (*Connection) NextResult

func (tds *Connection) NextResult() (more bool, err error)

func (*Connection) Open

func (tds *Connection) Open(config *rdb.Config) (*ServerInfo, error)

func (*Connection) Prepare

func (tds *Connection) Prepare(*rdb.Command) (preparedStatementToken interface{}, err error)

func (*Connection) Query

func (tds *Connection) Query(cmd *rdb.Command, params []rdb.Param, preparedToken interface{}, valuer rdb.DriverValuer) error

func (*Connection) Reset

func (tds *Connection) Reset(c *rdb.Config) error

func (*Connection) Rollback

func (tds *Connection) Rollback(savepoint string) error

func (*Connection) SavePoint

func (tds *Connection) SavePoint(name string) error

func (*Connection) Scan

func (tds *Connection) Scan() error

func (*Connection) SetAvailable

func (tds *Connection) SetAvailable(available bool)

func (*Connection) Status

func (tds *Connection) Status() rdb.DriverConnStatus

func (*Connection) Unprepare

func (tds *Connection) Unprepare(preparedStatementToken interface{}) (err error)

type Driver

type Driver struct{}

func (*Driver) DriverInfo

func (dr *Driver) DriverInfo() *rdb.DriverInfo

func (*Driver) Open

func (dr *Driver) Open(c *rdb.Config) (rdb.DriverConn, error)

func (*Driver) PingCommand

func (db *Driver) PingCommand() *rdb.Command

type InputToolong

type InputToolong struct {
	DataLen, TypeLen uint32
}

func (InputToolong) Error

func (err InputToolong) Error() string

type MessageReader

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

func (*MessageReader) Close

func (mr *MessageReader) Close() error

func (*MessageReader) Fetch

func (r *MessageReader) Fetch(n int) (ret []byte, err error)

func (*MessageReader) Next

func (mr *MessageReader) Next() ([]byte, error)

Read another packet.

type MsgColumn

type MsgColumn struct{}

type MsgDone

type MsgDone struct {
	StatusCode uint16
	CurrentCmd uint16
	Rows       uint64
}

func (MsgDone) Error

func (done MsgDone) Error() string

func (MsgDone) Status

func (done MsgDone) Status() string

func (MsgDone) String

func (done MsgDone) String() string

type MsgEnvChange

type MsgEnvChange struct{}

type MsgEom

type MsgEom struct{}

type MsgFinalDone

type MsgFinalDone struct{}

type MsgOrder

type MsgOrder []uint16

type MsgOther

type MsgOther struct {
	Other interface{}
}

type MsgParamValue

type MsgParamValue struct{}

type MsgRow

type MsgRow struct{}

type MsgRowCount

type MsgRowCount struct {
	Count uint64
}

type MsgRpcResult

type MsgRpcResult int32

type MsgStatus

type MsgStatus byte

type PacketReader

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

func NewPacketReader

func NewPacketReader(r io.Reader) *PacketReader

func (*PacketReader) BeginMessage

func (tds *PacketReader) BeginMessage(expectType PacketType) *MessageReader

func (*PacketReader) LoginAck

func (tds *PacketReader) LoginAck() (*ServerInfo, error)

func (*PacketReader) Prelogin

func (tds *PacketReader) Prelogin() (*ServerConnection, error)

type PacketType

type PacketType byte

type PacketWriter

type PacketWriter struct {
	PacketType PacketType
	// contains filtered or unexported fields
}

func NewPacketWriter

func NewPacketWriter(w io.Writer) *PacketWriter

func (*PacketWriter) BeginMessage

func (tds *PacketWriter) BeginMessage(PacketType PacketType, reset bool) error

func (*PacketWriter) EndMessage

func (tds *PacketWriter) EndMessage() error

func (*PacketWriter) Login

func (tds *PacketWriter) Login(config *rdb.Config) error

Write LOGIN7. Page 53.

func (*PacketWriter) PreLogin

func (tds *PacketWriter) PreLogin(instance string) error

Pre-Login

func (*PacketWriter) Write

func (tds *PacketWriter) Write(bb []byte) (n int, err error)

func (*PacketWriter) WriteBuffer

func (tds *PacketWriter) WriteBuffer(v []byte) (n int)

func (*PacketWriter) WriteByte

func (tds *PacketWriter) WriteByte(v byte) (n int)

func (*PacketWriter) WriteUint16

func (tds *PacketWriter) WriteUint16(v uint16) (n int)

func (*PacketWriter) WriteUint32

func (tds *PacketWriter) WriteUint32(v uint32) (n int)

func (*PacketWriter) WriteUint64

func (tds *PacketWriter) WriteUint64(v uint64) (n int)

type ServerConnection

type ServerConnection struct {
	Version    [6]byte
	Encryption byte
	Instance   string
	MARS       bool
}

Rturned from Pre-Login.

type ServerInfo

type ServerInfo struct {
	AcceptTSql  bool
	TdsVersion  [4]byte
	ProgramName string

	MajorVersion byte
	MinorVersion byte
	BuildNumber  uint16
}

Returned from Login.

func (*ServerInfo) String

func (si *ServerInfo) String() string

type SqlColumn

type SqlColumn struct {
	rdb.Column

	Collation [5]byte
	// contains filtered or unexported fields
}

type UnexpectedMessage

type UnexpectedMessage struct {
	Expected PacketType
	Recieved PacketType
}

func (UnexpectedMessage) Error

func (msg UnexpectedMessage) Error() string

Directories

Path Synopsis
Proides utility functions for interacting with batched sql statements in the same file or string.
Proides utility functions for interacting with batched sql statements in the same file or string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL