Documentation
¶
Overview ¶
Package protocol implements the hdb command network protocol.
http://help.sap.com/hana/SAP_HANA_SQL_Command_Network_Protocol_Reference_en.pdf
Index ¶
- Constants
- func IsSupportedDfv(dfv int) bool
- func RegisterScanType(dt DataType, scanType, scanNullType reflect.Type) bool
- func SupportedDfvs(defaultOnly bool) []int
- type AuthFinalReply
- type AuthFinalRequest
- type AuthHnd
- func (a *AuthHnd) AddBasic(username, password string)
- func (a *AuthHnd) AddJWT(token string)
- func (a *AuthHnd) AddLDAP(username, password string)
- func (a *AuthHnd) AddSessionCookie(cookie []byte, logonname, clientID string)
- func (a *AuthHnd) AddX509(certKey *auth.CertKey)
- func (a *AuthHnd) FinalReply() (*AuthFinalReply, error)
- func (a *AuthHnd) FinalRequest() (*AuthFinalRequest, error)
- func (a *AuthHnd) InitReply() (*AuthInitReply, error)
- func (a *AuthHnd) InitRequest() (*AuthInitRequest, error)
- func (a *AuthHnd) Selected() auth.Method
- func (a *AuthHnd) String() string
- type AuthInitReply
- type AuthInitRequest
- type Cdm
- type ClientContext
- type ClientID
- type Command
- type ConnectOptions
- func (co *ConnectOptions) ClientDistributionModeOrZero() Cdm
- func (co *ConnectOptions) CompressionLevelAndFlagsOrZero() int32
- func (co *ConnectOptions) DataFormatVersion2OrZero() int
- func (co *ConnectOptions) DatabaseNameOrZero() string
- func (co *ConnectOptions) FullVersionOrZero() string
- func (co *ConnectOptions) ServerConnectionIDOrZero() int
- func (co *ConnectOptions) SetClientDistributionMode(v Cdm)
- func (co *ConnectOptions) SetClientLocale(v string)
- func (co *ConnectOptions) SetCompressionLevelAndFlags(v int32)
- func (co *ConnectOptions) SetDataFormatVersion2(v int)
- func (co *ConnectOptions) SetSelectForUpdateSupported(v bool)
- func (co *ConnectOptions) SetUpdateTopologyAnywhere(v bool)
- func (ops ConnectOptions) String() string
- func (co *ConnectOptions) SystemIDOrZero() string
- type DBConnectInfo
- type DataType
- type DecodeError
- type DecodeErrors
- type Fetchsize
- type FunctionCode
- type HdbError
- func (e *HdbError) Code() int
- func (e *HdbError) Error() string
- func (e *HdbError) IsError() bool
- func (e *HdbError) IsFatal() bool
- func (e *HdbError) IsWarning() bool
- func (e *HdbError) Level() int
- func (e *HdbError) Position() int
- func (e *HdbError) StmtNo() int
- func (e *HdbError) String() string
- func (e *HdbError) Text() string
- type HdbErrors
- type InputParameters
- type LobInDescr
- type LobOptions
- type LobOutDescr
- type LocatorID
- type MessageType
- type OutputParameters
- type ParameterField
- func (f *ParameterField) Convert(v any) (any, error)
- func (f *ParameterField) DatabaseTypeName() string
- func (f *ParameterField) DecimalSize() (int64, int64, bool)
- func (f *ParameterField) In() bool
- func (f *ParameterField) InOut() bool
- func (f *ParameterField) IsLob() bool
- func (f *ParameterField) Length() (int64, bool)
- func (f *ParameterField) Name() string
- func (f *ParameterField) Nullable() (bool, bool)
- func (f *ParameterField) Out() bool
- func (f *ParameterField) ScanType() reflect.Type
- func (f *ParameterField) String() string
- type ParameterMetadata
- type ParameterMode
- type Part
- type PartAttributes
- type PartDecoder
- type PartEncoder
- type PartHeader
- type PartInfo
- type PartKind
- type ReadLobReply
- type ReadLobRequest
- type Reader
- type ReaderAttrs
- type ResultField
- func (f *ResultField) DatabaseTypeName() string
- func (f *ResultField) DecimalSize() (int64, int64, bool)
- func (f *ResultField) IsLob() bool
- func (f *ResultField) Length() (int64, bool)
- func (f *ResultField) Name() string
- func (f *ResultField) Nullable() (bool, bool)
- func (f *ResultField) ScanType() reflect.Type
- func (f *ResultField) String() string
- type ResultMetadata
- type ResultPartDecoder
- type Resultset
- type ResultsetID
- type RoutingNode
- type RoutingNodeList
- type RoutingNodes
- type RowsAffected
- type ServiceType
- type SiteType
- type SiteVolumeID
- type StatementID
- type TopologyInformation
- type WriteLobDescr
- type WriteLobReply
- type WriteLobRequest
- type Writer
- type WriterAttrs
Constants ¶
const ( DfvLevel0 int = 0 // base data format DfvLevel1 int = 1 // eval types support all data types DfvLevel2 int = 2 // reserved, broken, do not use DfvLevel3 int = 3 // additional types Longdate, Seconddate, Daydate, Secondtime supported for NGAP DfvLevel4 int = 4 // generic support for new date/time types DfvLevel5 int = 5 // spatial types in ODBC on request DfvLevel6 int = 6 // BINTEXT DfvLevel7 int = 7 // with boolean support DfvLevel8 int = 8 // with FIXED8/12/16 support )
Data format version values.
const ( HdbErrAuthenticationFailed = 10 HdbErrWhileParsingProtocol = 1033 )
HANA Database errors.
const ( CoCompressionLZ4Supported int32 = 0x00000100 // sender can decompress LZ4 CoCompressionLZ4Enabled int32 = 0x00000200 // sender wants compression on )
Compression flag bits in the int32 value of coCompressionLevelAndFlags. See the negotiation doc in session.go for how these are used.
const MaxNumArg = math.MaxInt32
MaxNumArg is the maximum number of arguments allowed to send in a part.
const ( // TcTableRows is the TypeCode for table rows. TcTableRows typeCode = 0x7f // 127 )
Variables ¶
This section is empty.
Functions ¶
func IsSupportedDfv ¶ added in v0.107.0
IsSupportedDfv returns true if the data format version dfv is supported by the driver, false otherwise.
func RegisterScanType ¶
RegisterScanType registers driver owned datatype scantypes (e.g. Decimal, Lob).
func SupportedDfvs ¶ added in v0.107.0
SupportedDfvs returns a slice of data format versions supported by the driver. If parameter defaultOnly is set only the default dfv is returned, otherwise all supported dfv values are returned.
Types ¶
type AuthFinalReply ¶ added in v0.107.3
type AuthFinalReply struct {
Method auth.Method // the selected method: the client's prepared, the sniffer's wire-interpreted
}
AuthFinalReply represents an authentication final reply.
func (*AuthFinalReply) String ¶ added in v0.107.3
func (r *AuthFinalReply) String() string
type AuthFinalRequest ¶ added in v0.107.3
type AuthFinalRequest struct {
// contains filtered or unexported fields
}
AuthFinalRequest represents an authentication final request. The generic part holds the selected method with its detail parameters. Encode marshals the struct into the wire parameter list, decode unmarshals the wire parameter list into the struct.
func (*AuthFinalRequest) String ¶ added in v0.107.3
func (r *AuthFinalRequest) String() string
type AuthHnd ¶ added in v0.112.3
type AuthHnd struct {
// contains filtered or unexported fields
}
AuthHnd holds the client authentication methods dependent on the driver.Connector attributes and handles the authentication hdb protocol.
func NewAuthHnd ¶ added in v0.112.3
NewAuthHnd creates a new AuthHnd instance.
func (*AuthHnd) AddLDAP ¶ added in v1.16.0
AddLDAP adds LDAP authentication method.
The LDAP method does not authenticate the server: the server-provided RSA public key is trusted as is. LDAP authentication should therefore only be used over a TLS transport (see SessionTLS/SetTLS).
func (*AuthHnd) AddSessionCookie ¶ added in v0.112.3
AddSessionCookie adds session cookie authentication method.
func (*AuthHnd) FinalReply ¶ added in v0.112.3
func (a *AuthHnd) FinalReply() (*AuthFinalReply, error)
FinalReply returns the final reply part.
func (*AuthHnd) FinalRequest ¶ added in v0.112.3
func (a *AuthHnd) FinalRequest() (*AuthFinalRequest, error)
FinalRequest returns the final request part holding the selected method.
func (*AuthHnd) InitReply ¶ added in v0.112.3
func (a *AuthHnd) InitReply() (*AuthInitReply, error)
InitReply returns the init reply part.
func (*AuthHnd) InitRequest ¶ added in v0.112.3
func (a *AuthHnd) InitRequest() (*AuthInitRequest, error)
InitRequest returns the init request part holding the logonname and the offered authentication methods.
type AuthInitReply ¶ added in v0.107.3
type AuthInitReply struct {
Method auth.Method // wire-interpreted selected method, set on decode without authHnd
// contains filtered or unexported fields
}
AuthInitReply represents an authentication initial reply.
func (*AuthInitReply) String ¶ added in v0.107.3
func (r *AuthInitReply) String() string
type AuthInitRequest ¶ added in v0.107.3
type AuthInitRequest struct {
// contains filtered or unexported fields
}
AuthInitRequest represents an authentication initial request. The generic part holds the logonname and the offered authentication methods, each of which holds its own detail parameters. Encode marshals the struct into the wire parameter list, decode unmarshals the wire parameter list into the struct.
func (*AuthInitRequest) Logonname ¶ added in v1.18.5
func (r *AuthInitRequest) Logonname() string
Logonname returns the logonname, empty string if not present.
func (*AuthInitRequest) String ¶ added in v0.107.3
func (r *AuthInitRequest) String() string
type Cdm ¶ added in v0.107.3
type Cdm byte
Cdm represents a ConnectOption ClientDistributionMode.
ConnectOption ClientDistributionMode constants.
type ClientContext ¶ added in v1.7.2
type ClientContext struct {
// contains filtered or unexported fields
}
ClientContext represents a client context part.
func (*ClientContext) SetApplicationProgram ¶ added in v1.7.2
func (cc *ClientContext) SetApplicationProgram(v string)
SetApplicationProgram sets the client application program option.
func (*ClientContext) SetType ¶ added in v1.7.2
func (cc *ClientContext) SetType(v string)
SetType sets the client type option.
func (*ClientContext) SetVersion ¶ added in v1.7.2
func (cc *ClientContext) SetVersion(v string)
SetVersion sets the client version option.
type Command ¶ added in v0.107.3
type Command []byte
Command represents a command part with cesu8 content.
type ConnectOptions ¶ added in v1.7.2
type ConnectOptions struct {
// contains filtered or unexported fields
}
ConnectOptions represents a connect options part.
func (*ConnectOptions) ClientDistributionModeOrZero ¶ added in v1.17.3
func (co *ConnectOptions) ClientDistributionModeOrZero() Cdm
ClientDistributionModeOrZero returns the client distribution mode option if available, the zero value otherwise.
func (*ConnectOptions) CompressionLevelAndFlagsOrZero ¶ added in v1.17.2
func (co *ConnectOptions) CompressionLevelAndFlagsOrZero() int32
CompressionLevelAndFlagsOrZero gets the compression level/flags option if available, the zero value otherise.
func (*ConnectOptions) DataFormatVersion2OrZero ¶ added in v1.7.2
func (co *ConnectOptions) DataFormatVersion2OrZero() int
DataFormatVersion2OrZero returns the data format version2 option if available, the zero value otherwise.
func (*ConnectOptions) DatabaseNameOrZero ¶ added in v1.7.2
func (co *ConnectOptions) DatabaseNameOrZero() string
DatabaseNameOrZero returns the database name option if available, the zero value otherwise.
func (*ConnectOptions) FullVersionOrZero ¶ added in v1.7.2
func (co *ConnectOptions) FullVersionOrZero() string
FullVersionOrZero returns the full version option if available, the zero value otherwise.
func (*ConnectOptions) ServerConnectionIDOrZero ¶ added in v1.18.5
func (co *ConnectOptions) ServerConnectionIDOrZero() int
ServerConnectionIDOrZero returns the server connection id option if available, the zero value otherwise. The server connection id identifies the session on the server and is used in the session management statements (alter system cancel|disconnect session). The session id of the message header cannot be used for this.
func (*ConnectOptions) SetClientDistributionMode ¶ added in v1.7.2
func (co *ConnectOptions) SetClientDistributionMode(v Cdm)
SetClientDistributionMode sets the client distribution mode option.
func (*ConnectOptions) SetClientLocale ¶ added in v1.7.2
func (co *ConnectOptions) SetClientLocale(v string)
SetClientLocale sets the client locale option.
func (*ConnectOptions) SetCompressionLevelAndFlags ¶ added in v1.17.2
func (co *ConnectOptions) SetCompressionLevelAndFlags(v int32)
SetCompressionLevelAndFlags sets the compression level/flags option.
func (*ConnectOptions) SetDataFormatVersion2 ¶ added in v1.7.2
func (co *ConnectOptions) SetDataFormatVersion2(v int)
SetDataFormatVersion2 sets the data format version 2 option.
func (*ConnectOptions) SetSelectForUpdateSupported ¶ added in v1.7.2
func (co *ConnectOptions) SetSelectForUpdateSupported(v bool)
SetSelectForUpdateSupported sets the select for update supported option.
func (*ConnectOptions) SetUpdateTopologyAnywhere ¶ added in v1.17.3
func (co *ConnectOptions) SetUpdateTopologyAnywhere(v bool)
SetUpdateTopologyAnywhere sets the update topology anywhere option.
func (*ConnectOptions) SystemIDOrZero ¶ added in v1.17.3
func (co *ConnectOptions) SystemIDOrZero() string
SystemIDOrZero returns the system ID option if available, the zero value otherwise.
type DBConnectInfo ¶ added in v1.7.2
type DBConnectInfo struct {
// contains filtered or unexported fields
}
DBConnectInfo represents a database connect info part.
func (*DBConnectInfo) HostOrZero ¶ added in v1.7.2
func (ci *DBConnectInfo) HostOrZero() string
HostOrZero returns the host option, the zero value otherwise.
func (*DBConnectInfo) IsConnectedOrZero ¶ added in v1.7.2
func (ci *DBConnectInfo) IsConnectedOrZero() bool
IsConnectedOrZero returns this IsConnected option, the zero value otherwise.
func (*DBConnectInfo) PortOrZero ¶ added in v1.7.2
func (ci *DBConnectInfo) PortOrZero() int
PortOrZero returns the port option, the zero value otherwise.
func (*DBConnectInfo) SetDatabaseName ¶ added in v1.7.2
func (ci *DBConnectInfo) SetDatabaseName(v string)
SetDatabaseName sets the database name option.
type DataType ¶
type DataType byte
DataType is the type definition for data types supported by this package.
const ( DtUnknown DataType = iota // unknown data type DtBoolean DtTinyint DtSmallint DtInteger DtBigint DtReal DtDouble DtDecimal DtTime DtString DtBytes DtLob DtRows )
Data type constants.
type DecodeError ¶ added in v0.107.3
type DecodeError struct {
// contains filtered or unexported fields
}
DecodeError represents a decoding error.
func (*DecodeError) Error ¶ added in v0.107.3
func (e *DecodeError) Error() string
func (*DecodeError) Unwrap ¶ added in v1.8.22
func (e *DecodeError) Unwrap() error
type DecodeErrors ¶ added in v0.107.3
type DecodeErrors []*DecodeError
DecodeErrors represents a list of decoding errors.
func (DecodeErrors) RowErrors ¶ added in v1.8.22
func (errs DecodeErrors) RowErrors(row int) error
RowErrors returns errors if they were assigned to a row, nil otherwise.
type FunctionCode ¶ added in v0.107.3
type FunctionCode int16
FunctionCode represents a function code.
const (
FcDDL FunctionCode = 1
)
FunctionCode constants.
func (FunctionCode) IsProcedureCall ¶ added in v0.107.3
func (fc FunctionCode) IsProcedureCall() bool
IsProcedureCall returns true if the function code is a procedure call, false otherwise.
func (FunctionCode) String ¶ added in v0.107.3
func (i FunctionCode) String() string
type HdbError ¶ added in v1.0.1
type HdbError struct {
// contains filtered or unexported fields
}
HdbError represents a single error returned by the server.
type HdbErrors ¶ added in v0.107.3
type HdbErrors struct {
*HdbError
// contains filtered or unexported fields
}
HdbErrors represent the collection of errors returned by the server.
func (*HdbErrors) NumError ¶ added in v0.107.3
NumError implements the driver.Error interface. NumErrors returns the number of all errors, including warnings.
type InputParameters ¶ added in v0.107.3
type InputParameters struct {
InputFields []*ParameterField
FieldValues []driver.Value
// contains filtered or unexported fields
}
InputParameters represents the set of input parameters.
func NewInputParameters ¶ added in v0.107.3
func NewInputParameters(inputFields []*ParameterField, nvargs []driver.NamedValue) *InputParameters
NewInputParameters returns a InputParameters instance.
func (*InputParameters) String ¶ added in v0.107.3
func (p *InputParameters) String() string
type LobInDescr ¶ added in v0.107.3
type LobInDescr struct {
// contains filtered or unexported fields
}
LobInDescr represents a lob input descriptor.
func (*LobInDescr) FetchFirst ¶ added in v1.18.6
func (d *LobInDescr) FetchFirst(chunkSize int, cesu8EncoderFn func() transform.Transformer) error
FetchFirst fetches the first lob chunk.
It obtains a fresh transformer instance from cesu8EncoderFn (instead of reusing a shared one) because lob input readers can interleave: on a bulk insert several multi-chunk lobs are live at once and their chunks are pulled round-robin. A stateful (custom) transformer shared across them would have its state reset/clobbered by one reader while another is mid-transform, silently corrupting the data. A fresh instance per reader keeps each one isolated. The instance is created only when a transformation is actually needed (d.cesu8); the default transformer is stateless, so this costs nothing for it.
func (*LobInDescr) IsLastData ¶ added in v1.0.5
func (d *LobInDescr) IsLastData() bool
IsLastData returns true in case of last data package read, false otherwise.
func (*LobInDescr) String ¶ added in v0.107.3
func (d *LobInDescr) String() string
type LobOptions ¶ added in v0.107.3
type LobOptions int8
LobOptions represents a lob option set.
func (LobOptions) IsLastData ¶ added in v0.107.3
func (o LobOptions) IsLastData() bool
IsLastData returns true if the last data package was read, false otherwise.
func (LobOptions) String ¶ added in v0.107.3
func (o LobOptions) String() string
type LobOutDescr ¶ added in v0.107.3
type LobOutDescr struct {
IsCharLob bool
Opt LobOptions
Bytes []byte
// contains filtered or unexported fields
}
LobOutDescr represents a lob output descriptor.
func (*LobOutDescr) LocatorID ¶ added in v1.17.4
func (d *LobOutDescr) LocatorID() LocatorID
LocatorID returns the lob locator id.
func (*LobOutDescr) String ¶ added in v0.107.3
func (d *LobOutDescr) String() string
type LocatorID ¶ added in v0.107.3
type LocatorID uint64 // byte[locatorIdSize]
LocatorID represents a locator id.
type MessageType ¶ added in v0.107.3
type MessageType int8
MessageType represents the message type.
const ( MtExecuteDirect MessageType = 2 MtPrepare MessageType = 3 MtExecute MessageType = 13 MtWriteLob MessageType = 16 MtReadLob MessageType = 17 MtAuthenticate MessageType = 65 MtConnect MessageType = 66 MtCommit MessageType = 67 MtRollback MessageType = 68 MtCloseResultset MessageType = 69 MtDropStatementID MessageType = 70 MtFetchNext MessageType = 71 MtDisconnect MessageType = 77 MtDBConnectInfo MessageType = 82 )
MessageType constants.
func (MessageType) ClientInfoSupported ¶ added in v0.107.3
func (mt MessageType) ClientInfoSupported() bool
ClientInfoSupported returns true if message does support client info, false otherwise.
func (MessageType) String ¶ added in v0.107.3
func (i MessageType) String() string
type OutputParameters ¶ added in v0.107.3
type OutputParameters struct {
OutputFields []*ParameterField
FieldValues []driver.Value
DecodeErrors DecodeErrors
}
OutputParameters represents the set of output parameters.
func (*OutputParameters) String ¶ added in v0.107.3
func (p *OutputParameters) String() string
type ParameterField ¶
type ParameterField struct {
// contains filtered or unexported fields
}
ParameterField contains database field attributes for parameters.
func NewTableRowsParameterField ¶ added in v0.107.4
func NewTableRowsParameterField(idx int) *ParameterField
NewTableRowsParameterField returns a ParameterField representing table rows.
func (*ParameterField) Convert ¶
func (f *ParameterField) Convert(v any) (any, error)
Convert returns the result of the fieldType conversion.
func (*ParameterField) DatabaseTypeName ¶ added in v1.8.21
func (f *ParameterField) DatabaseTypeName() string
DatabaseTypeName returns the type name of the field. It implements the go-hdb driver ColumnType interface.
func (*ParameterField) DecimalSize ¶ added in v1.8.21
func (f *ParameterField) DecimalSize() (int64, int64, bool)
DecimalSize returns the type precision and scale of the field. It implements the go-hdb driver ColumnType interface.
func (*ParameterField) In ¶
func (f *ParameterField) In() bool
In returns true if the parameter field is an input field. It implements the go-hdb driver ParameterType interface.
func (*ParameterField) InOut ¶ added in v0.109.0
func (f *ParameterField) InOut() bool
InOut returns true if the parameter field is an input/output field. It implements the go-hdb driver ParameterType interface.
func (*ParameterField) IsLob ¶ added in v0.107.4
func (f *ParameterField) IsLob() bool
IsLob returns true if the ParameterField is of type lob, false otherwise.
func (*ParameterField) Length ¶ added in v1.8.21
func (f *ParameterField) Length() (int64, bool)
Length returns the type length of the field. It implements the go-hdb driver ColumnType interface.
func (*ParameterField) Name ¶ added in v0.107.3
func (f *ParameterField) Name() string
Name returns the parameter field name. It implements the go-hdb driver ColumnType interface.
func (*ParameterField) Nullable ¶ added in v0.107.3
func (f *ParameterField) Nullable() (bool, bool)
Nullable returns true if the field may be null, false otherwise. It implements the go-hdb driver ColumnType interface.
func (*ParameterField) Out ¶
func (f *ParameterField) Out() bool
Out returns true if the parameter field is an output field. It implements the go-hdb driver ParameterType interface.
func (*ParameterField) ScanType ¶ added in v0.107.3
func (f *ParameterField) ScanType() reflect.Type
ScanType returns the scan type of the field. It implements the go-hdb driver ColumnType interface.
func (*ParameterField) String ¶
func (f *ParameterField) String() string
type ParameterMetadata ¶ added in v0.107.3
type ParameterMetadata struct {
ParameterFields []*ParameterField
}
ParameterMetadata represents the metadata of a parameter.
func (*ParameterMetadata) String ¶ added in v0.107.3
func (m *ParameterMetadata) String() string
type ParameterMode ¶ added in v0.107.3
type ParameterMode int8
ParameterMode represents the parameter mode set.
func (ParameterMode) String ¶ added in v0.107.3
func (k ParameterMode) String() string
type Part ¶ added in v1.6.8
type Part interface {
String() string // should support Stringer interface
// contains filtered or unexported methods
}
Part represents a protocol part.
type PartAttributes ¶ added in v0.107.3
type PartAttributes int8
PartAttributes represents the part attributes.
func (PartAttributes) LastPacket ¶ added in v0.107.3
func (k PartAttributes) LastPacket() bool
LastPacket returns true if the last packet is sent, false otherwise.
func (PartAttributes) ResultsetClosed ¶ added in v0.107.3
func (k PartAttributes) ResultsetClosed() bool
ResultsetClosed returns true if the result set is closed, false otherwise.
func (PartAttributes) String ¶ added in v0.107.3
func (k PartAttributes) String() string
type PartDecoder ¶ added in v1.17.2
type PartDecoder interface {
Part
// contains filtered or unexported methods
}
PartDecoder represents a protocol part decoder.
type PartEncoder ¶ added in v1.9.0
type PartEncoder interface {
Part
// contains filtered or unexported methods
}
PartEncoder represents a protocol part the driver is able to encode.
type PartHeader ¶ added in v0.107.3
type PartHeader struct {
// contains filtered or unexported fields
}
PartHeader represents the part header.
func (*PartHeader) Attrs ¶ added in v1.17.2
func (h *PartHeader) Attrs() PartAttributes
Attrs returns the part attributes.
func (*PartHeader) Kind ¶ added in v1.17.2
func (h *PartHeader) Kind() PartKind
Kind returns the part kind.
func (*PartHeader) String ¶ added in v0.107.3
func (h *PartHeader) String() string
type PartInfo ¶ added in v1.17.2
type PartInfo struct {
Header *PartHeader
Dec *encoding.Decoder
ReadHDBErrors func(context.Context) error
ReadPart func(context.Context, PartDecoder) error
ReadResultPart func(context.Context, ResultPartDecoder) error
SkipPart func(context.Context) error
}
PartInfo holds attributes needed on iterating parts.
type PartKind ¶ added in v0.107.3
type PartKind int8
PartKind represents the part kind.
const ( PkCommand PartKind = 3 PkResultset PartKind = 5 PkError PartKind = 6 PkStatementID PartKind = 10 PkRowsAffected PartKind = 12 PkResultsetID PartKind = 13 PkTopologyInformation PartKind = 15 PkReadLobRequest PartKind = 17 PkReadLobReply PartKind = 18 PkWriteLobRequest PartKind = 28 PkClientContext PartKind = 29 PkWriteLobReply PartKind = 30 PkParameters PartKind = 32 PkAuthentication PartKind = 33 PkClientID PartKind = 35 PkStatementContext PartKind = 39 PkOutputParameters PartKind = 41 PkConnectOptions PartKind = 42 PkFetchSize PartKind = 45 PkParameterMetadata PartKind = 47 PkResultMetadata PartKind = 48 PkClientInfo PartKind = 57 PkTransactionFlags PartKind = 64 PkDBConnectInfo PartKind = 67 )
PartKind constants.
type ReadLobReply ¶ added in v0.107.3
type ReadLobReply struct {
Opt LobOptions
Bytes []byte
// contains filtered or unexported fields
}
ReadLobReply represents a lob read reply part.
func NewReadLobReply ¶ added in v1.17.4
func NewReadLobReply(id LocatorID) *ReadLobReply
NewReadLobReply creates a lob read reply part for the given locator id.
func (*ReadLobReply) String ¶ added in v0.107.3
func (r *ReadLobReply) String() string
type ReadLobRequest ¶ added in v0.107.3
type ReadLobRequest struct {
/*
read lobs:
- read lob field from database in chunks
- loop:
- readLobRequest
- readLobReply
- read lob reply
seems like readLobreply returns only a result for one lob - even if more than one is requested
--> read single lobs
*/
ID LocatorID
Ofs int64
ChunkSize int
}
ReadLobRequest represents a lob read request part.
func (*ReadLobRequest) String ¶ added in v0.107.3
func (r *ReadLobRequest) String() string
type Reader ¶ added in v0.107.3
type Reader struct {
// contains filtered or unexported fields
}
Reader represents a protocol reader.
func NewClientReader ¶ added in v1.2.0
func NewClientReader(rd io.Reader, attrs *ReaderAttrs) *Reader
NewClientReader returns an instance of a client protocol reader.
func NewDBReader ¶ added in v1.2.0
func NewDBReader(rd io.Reader, attrs *ReaderAttrs) *Reader
NewDBReader returns an instance of a database protocol reader.
func (*Reader) FunctionCode ¶ added in v0.107.3
func (r *Reader) FunctionCode() FunctionCode
FunctionCode returns the function code of the protocol.
func (*Reader) ReadProlog ¶ added in v0.107.3
ReadProlog reads the protocol prolog.
func (*Reader) SkipMessage ¶ added in v1.18.5
SkipMessage reads one complete message by wire framing and discards it. The framing is taken from the message header only; the content is opaque, so compressed packets pass through untouched.
type ReaderAttrs ¶ added in v1.17.2
type ReaderAttrs struct {
// contains filtered or unexported fields
}
ReaderAttrs holds reader attributes.
func NewReaderAttrs ¶ added in v1.17.3
func NewReaderAttrs(protTrace bool, logger *slog.Logger, cesu8DecoderFn func() transform.Transformer, lobChunkSize int, emptyDateAsNull bool, compressor compress.Compressor) *ReaderAttrs
NewReaderAttrs returns a new ReaderAttrs instance.
func (*ReaderAttrs) SetAlphanumDfv1 ¶ added in v1.17.3
func (a *ReaderAttrs) SetAlphanumDfv1(b bool)
SetAlphanumDfv1 sets alphanumDfv1.
type ResultField ¶ added in v0.107.3
type ResultField struct {
// contains filtered or unexported fields
}
ResultField represents a database result field.
func (*ResultField) DatabaseTypeName ¶ added in v1.8.21
func (f *ResultField) DatabaseTypeName() string
DatabaseTypeName returns the type name of the field. It implements the go-hdb driver ColumnType interface.
func (*ResultField) DecimalSize ¶ added in v1.8.21
func (f *ResultField) DecimalSize() (int64, int64, bool)
DecimalSize returns the type precision and scale of the field. It implements the go-hdb driver ColumnType interface.
func (*ResultField) IsLob ¶ added in v1.17.4
func (f *ResultField) IsLob() bool
IsLob returns true if the ResultField is of type lob, false otherwise.
func (*ResultField) Length ¶ added in v1.8.21
func (f *ResultField) Length() (int64, bool)
Length returns the type length of the field. It implements the go-hdb driver ColumnType interface.
func (*ResultField) Name ¶ added in v0.107.3
func (f *ResultField) Name() string
Name returns the result field name. It implements the go-hdb driver ColumnType interface.
func (*ResultField) Nullable ¶ added in v0.107.3
func (f *ResultField) Nullable() (bool, bool)
Nullable returns true if the field may be null, false otherwise. It implements the go-hdb driver ColumnType interface.
func (*ResultField) ScanType ¶ added in v0.107.3
func (f *ResultField) ScanType() reflect.Type
ScanType returns the scan type of the field. It implements the go-hdb driver ColumnType interface.
func (*ResultField) String ¶ added in v0.107.3
func (f *ResultField) String() string
String implements the Stringer interface.
type ResultMetadata ¶ added in v0.107.3
type ResultMetadata struct {
ResultFields []*ResultField
}
ResultMetadata represents the metadata of a set of database result fields.
func (*ResultMetadata) String ¶ added in v0.107.3
func (r *ResultMetadata) String() string
type ResultPartDecoder ¶ added in v1.17.2
type ResultPartDecoder interface {
Part
// contains filtered or unexported methods
}
ResultPartDecoder represents a protocol result part decoder.
type Resultset ¶ added in v0.107.3
type Resultset struct {
ResultFields []*ResultField
FieldValues []driver.Value
DecodeErrors DecodeErrors
}
Resultset represents a database result set.
type ResultsetID ¶ added in v0.107.3
type ResultsetID uint64
ResultsetID represents a resultset id.
func (ResultsetID) String ¶ added in v0.107.3
func (id ResultsetID) String() string
type RoutingNode ¶ added in v1.17.3
type RoutingNode struct {
SiteVolumeID SiteVolumeID
SiteType SiteType
// Host is the dial address (host+port). It is the reachability key: routing
// marks every topology entry with the same host reachable or unreachable.
// It is not the state identity: routing state is preserved by site volume
// identity (SiteVolumeID, SiteType), so the server must not list the same
// host with conflicting routing attributes.
Host string
Standby bool // node is a standby node
}
RoutingNode holds the topology data of a routing node.
func (*RoutingNode) Compare ¶ added in v1.17.3
func (n *RoutingNode) Compare(o *RoutingNode) int
Compare compares two routing nodes by their state identity (SiteVolumeID, then SiteType), matching the sort order of SortedNodeList.
type RoutingNodeList ¶ added in v1.17.3
type RoutingNodeList []*RoutingNode
RoutingNodeList is a topology node list.
func (RoutingNodeList) Equal ¶ added in v1.17.3
func (n RoutingNodeList) Equal(o RoutingNodeList) bool
Equal reports whether two topologies are equal: the same nodes in the same order with equal routing attributes.
type RoutingNodes ¶ added in v1.17.3
type RoutingNodes interface {
SortedNodeList(host *string) (RoutingNodeList, error)
}
RoutingNodes defines the interface to fetch routing nodes.
type RowsAffected ¶ added in v0.107.3
type RowsAffected struct {
// contains filtered or unexported fields
}
RowsAffected represents a rows affected part.
func (RowsAffected) SetHDbErrorsStmtNo ¶ added in v1.17.2
func (r RowsAffected) SetHDbErrorsStmtNo(errs *HdbErrors, offset int)
SetHDbErrorsStmtNo sets the HDBErrors statement numbers relatively to an offset.
func (RowsAffected) String ¶ added in v0.107.3
func (r RowsAffected) String() string
func (RowsAffected) Total ¶ added in v0.107.3
func (r RowsAffected) Total() int64
Total returns the total number of all affected rows.
type ServiceType ¶ added in v1.7.2
type ServiceType int32
ServiceType represents a service type.
const ( StOther ServiceType = 0 StNameServer ServiceType = 1 StPreprocessor ServiceType = 2 StIndexServer ServiceType = 3 StStatisticsServer ServiceType = 4 StXSEngine ServiceType = 5 StReserved6 ServiceType = 6 StCompileServer ServiceType = 7 StDPServer ServiceType = 8 StDIServer ServiceType = 9 StComputeServer ServiceType = 10 StScriptServer ServiceType = 11 )
Service type constants.
func (ServiceType) String ¶ added in v1.7.2
func (i ServiceType) String() string
type SiteType ¶ added in v1.17.3
type SiteType int32
SiteType represents the HSR (HANA System Replication) site type of a topology host. Mirrors the reference client's SiteType enum (Layout.hpp).
type SiteVolumeID ¶ added in v1.17.3
type SiteVolumeID uint32
SiteVolumeID is the packed site + volume identifier the server reports for a topology host (topologyOption toVolumeID): site ID in the high 8 bits, volume ID in the low 24 bits. Mirrors the reference client's SiteVolumeID.
func (SiteVolumeID) IsInvalid ¶ added in v1.17.3
func (id SiteVolumeID) IsInvalid() bool
IsInvalid reports whether either the site id or the volume id is the reserved all-ones invalid value (site 0xFF or volume 0xFFFFFF). The server must never send such a record; the reference client rejects the whole topology if it does.
func (SiteVolumeID) SiteID ¶ added in v1.17.3
func (id SiteVolumeID) SiteID() uint8
SiteID returns the site id (high 8 bits).
func (SiteVolumeID) VolumeID ¶ added in v1.17.3
func (id SiteVolumeID) VolumeID() uint32
VolumeID returns the volume id (low 24 bits).
type StatementID ¶ added in v0.107.3
type StatementID uint64
StatementID represents the statement id part type.
func (StatementID) String ¶ added in v0.107.3
func (id StatementID) String() string
type TopologyInformation ¶ added in v1.7.2
type TopologyInformation struct {
// contains filtered or unexported fields
}
TopologyInformation represents a topology information part.
func (TopologyInformation) SortedNodeList ¶ added in v1.17.3
func (ti TopologyInformation) SortedNodeList(routingHost *string) (RoutingNodeList, error)
SortedNodeList implements the RoutingNodes interface.
func (TopologyInformation) String ¶ added in v1.7.2
func (ti TopologyInformation) String() string
type WriteLobDescr ¶ added in v0.107.3
type WriteLobDescr struct {
LobInDescr *LobInDescr
ID LocatorID
// contains filtered or unexported fields
}
WriteLobDescr represents a lob descriptor for writes (lob -> db).
func (*WriteLobDescr) FetchNext ¶ added in v0.107.3
func (d *WriteLobDescr) FetchNext(chunkSize int) error
FetchNext fetches the next lob chunk.
func (*WriteLobDescr) IsLastData ¶ added in v1.8.21
func (d *WriteLobDescr) IsLastData() bool
IsLastData returns true in case of last data package read, false otherwise.
func (WriteLobDescr) String ¶ added in v0.107.3
func (d WriteLobDescr) String() string
type WriteLobReply ¶ added in v0.107.3
type WriteLobReply struct {
// write lob fields to db (reply)
// - returns ids which have not been written completely
IDs []LocatorID
}
WriteLobReply represents a lob write reply part.
func (*WriteLobReply) String ¶ added in v0.107.3
func (r *WriteLobReply) String() string
type WriteLobRequest ¶ added in v0.107.3
type WriteLobRequest struct {
Descrs []*WriteLobDescr
}
WriteLobRequest represents a lob write request part.
func (*WriteLobRequest) String ¶ added in v0.107.3
func (r *WriteLobRequest) String() string
type Writer ¶ added in v0.107.3
type Writer struct {
// contains filtered or unexported fields
}
Writer represents a protocol writer.
func NewWriter ¶ added in v0.107.3
func NewWriter(wr io.Writer, attrs *WriterAttrs) *Writer
NewWriter returns an instance of a protocol writer.
func (*Writer) HasError ¶ added in v1.13.7
HasError returns true if writing raised an error, false otherwise.
func (*Writer) SetSessionID ¶ added in v1.10.0
SetSessionID sets the session ID after a successful authentication.
func (*Writer) Write ¶ added in v0.107.3
func (w *Writer) Write(ctx context.Context, messageType MessageType, commit bool, parts ...PartEncoder) error
type WriterAttrs ¶ added in v1.17.2
type WriterAttrs struct {
// contains filtered or unexported fields
}
WriterAttrs holds writer attributes.
func NewWriterAttrs ¶ added in v1.17.3
func NewWriterAttrs(protTrace bool, logger *slog.Logger, cesu8EncoderFn func() transform.Transformer, sv map[string]string, compressor compress.Compressor) *WriterAttrs
NewWriterAttrs returns a WriterAttrs instance.
func (*WriterAttrs) SetCompressEnableWrite ¶ added in v1.17.3
func (a *WriterAttrs) SetCompressEnableWrite(b bool)
SetCompressEnableWrite sets compressEnableWrite.
Source Files
¶
- auth.go
- convert.go
- datatype.go
- decode.go
- decode1.27.go
- decodeerror.go
- dfv.go
- doc.go
- error.go
- fieldnames.go
- functioncode.go
- headers.go
- init.go
- keyvaluesparts.go
- lob.go
- lob1.27.go
- messagetype.go
- optionsparts.go
- parameter.go
- parameter1.27.go
- partkind.go
- parts.go
- protocol.go
- result.go
- result1.27.go
- resultpart1.27.go
- rowsaffected.go
- simpleparts.go
- typecode.go
- typecode1.27.go
- x_generator.go
- x_stringer.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth provides authentication methods.
|
Package auth provides authentication methods. |
|
Package encoding implements hdb field type encodings and decodings.
|
Package encoding implements hdb field type encodings and decodings. |
|
Package julian provides julian time conversion functions.
|
Package julian provides julian time conversion functions. |
|
Package levenshtein includes the levenshtein distance algorithm plus additional helper functions.
|
Package levenshtein includes the levenshtein distance algorithm plus additional helper functions. |