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
- type Connection
- func (tds *Connection) Available() bool
- func (tds *Connection) Begin(iso rdb.IsolationLevel) error
- func (tds *Connection) Close()
- func (tds *Connection) Commit() error
- func (tds *Connection) ConnectionInfo() *rdb.ConnectionInfo
- func (tds *Connection) NextQuery() (err error)
- func (tds *Connection) NextResult() (more bool, err error)
- func (tds *Connection) Open(config *rdb.Config) (*ServerInfo, error)
- func (tds *Connection) Prepare(*rdb.Command) (preparedStatementToken interface{}, err error)
- func (tds *Connection) Query(cmd *rdb.Command, params []rdb.Param, preparedToken interface{}, ...) error
- func (tds *Connection) Reset(c *rdb.Config) error
- func (tds *Connection) Rollback(savepoint string) error
- func (tds *Connection) SavePoint(name string) error
- func (tds *Connection) Scan() error
- func (tds *Connection) SetAvailable(available bool)
- func (tds *Connection) Status() rdb.DriverConnStatus
- func (tds *Connection) Unprepare(preparedStatementToken interface{}) (err error)
- type Driver
- type InputToolong
- type MessageReader
- type MsgColumn
- type MsgDone
- type MsgEnvChange
- type MsgEom
- type MsgFinalDone
- type MsgOrder
- type MsgOther
- type MsgParamValue
- type MsgRow
- type MsgRowCount
- type MsgRpcResult
- type MsgStatus
- type PacketReader
- type PacketType
- type PacketWriter
- func (tds *PacketWriter) BeginMessage(PacketType PacketType, reset bool) error
- func (tds *PacketWriter) EndMessage() error
- func (tds *PacketWriter) Login(config *rdb.Config) error
- func (tds *PacketWriter) PreLogin(instance string) error
- func (tds *PacketWriter) Write(bb []byte) (n int, err error)
- func (tds *PacketWriter) WriteBuffer(v []byte) (n int)
- func (tds *PacketWriter) WriteByte(v byte) (n int)
- func (tds *PacketWriter) WriteUint16(v uint16) (n int)
- func (tds *PacketWriter) WriteUint32(v uint32) (n int)
- func (tds *PacketWriter) WriteUint64(v uint64) (n int)
- type ServerConnection
- type ServerInfo
- type SqlColumn
- type UnexpectedMessage
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) 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) PingCommand ¶
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
type MsgEnvChange ¶
type MsgEnvChange struct{}
type MsgFinalDone ¶
type MsgFinalDone struct{}
type MsgParamValue ¶
type MsgParamValue struct{}
type MsgRowCount ¶
type MsgRowCount struct {
Count uint64
}
type MsgRpcResult ¶
type MsgRpcResult int32
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) 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 ¶
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 UnexpectedMessage ¶
type UnexpectedMessage struct { Expected PacketType Recieved PacketType }
func (UnexpectedMessage) Error ¶
func (msg UnexpectedMessage) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.