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 ¶
- Variables
- func RegisterScanType(dt DataType, scanType reflect.Type)
- type ConvertError
- type Converter
- type DataType
- type Field
- type PrepareResult
- type QueryDescr
- type QueryKind
- type ReadProvider
- type Session
- func (s *Session) Close() error
- func (s *Session) CloseResultsetID(id uint64) error
- func (s *Session) Commit() error
- func (s *Session) DropStatementID(id uint64) error
- func (s *Session) Exec(pr *PrepareResult, args []driver.NamedValue) (driver.Result, error)
- func (s *Session) ExecCall(pr *PrepareResult, args []driver.NamedValue) (driver.Result, error)
- func (s *Session) ExecDirect(query string) (driver.Result, error)
- func (s *Session) InTx() bool
- func (s *Session) IsBad() bool
- func (s *Session) MaxBulkNum() int
- func (s *Session) Prepare(query string) (*PrepareResult, error)
- func (s *Session) Query(pr *PrepareResult, args []driver.NamedValue) (driver.Rows, error)
- func (s *Session) QueryCall(pr *PrepareResult, args []driver.NamedValue) (driver.Rows, error)
- func (s *Session) QueryDirect(query string) (driver.Rows, error)
- func (s *Session) Reset()
- func (s *Session) Rollback() error
- func (s *Session) SetInTx(v bool)
- type SessionConfig
- type Sniffer
- type WriterSetter
Constants ¶
This section is empty.
Variables ¶
var ErrFloatOutOfRange = errors.New("float out of range error")
ErrFloatOutOfRange means that a float exceeds the size of the hdb float field.
var ErrIntegerOutOfRange = errors.New("integer out of range error")
ErrIntegerOutOfRange means that an integer exceeds the size of the hdb integer field.
var ErrUint64OutOfRange = errors.New("uint64 values with high bit set are not supported")
ErrUint64OutOfRange means that a uint64 exceeds the size of a int64.
var QrsCache = newQueryResultSetCache()
QrsCache is a query result cache supporting reading procedure (call) table parameter via separate query (legacy mode).
Functions ¶
func RegisterScanType ¶ added in v0.99.0
RegisterScanType registers driver owned datatype scantypes (e.g. Decimal, Lob).
Types ¶
type ConvertError ¶ added in v0.99.0
type ConvertError struct {
// contains filtered or unexported fields
}
A ConvertError is returned by conversion methods if a go datatype to hdb datatype conversion fails.
func (*ConvertError) Error ¶ added in v0.99.0
func (e *ConvertError) Error() string
func (*ConvertError) Unwrap ¶ added in v0.99.1
func (e *ConvertError) Unwrap() error
Unwrap returns the nested error.
type Converter ¶ added in v0.99.0
type Converter interface {
Convert(interface{}) (interface{}, error)
}
Converter is the interface that wraps the Convert method. Convert is used to convert query parameters from go datatypes to hdb datatypes.
type DataType ¶
type DataType byte
DataType is the type definition for data types supported by this package.
const ( DtUnknown DataType = iota // unknown data type DtTinyint DtSmallint DtInteger DtBigint DtReal DtDouble DtDecimal DtTime DtString DtBytes DtLob DtRows )
Data type constants.
type Field ¶ added in v0.11.1
type Field interface {
Name() string
TypeName() string
TypeLength() (int64, bool)
TypePrecisionScale() (int64, int64, bool)
ScanType() DataType
Nullable() bool
In() bool
Out() bool
Converter() Converter
}
A Field represents whether a db result or a parameter Field.
type PrepareResult ¶ added in v0.99.0
type PrepareResult struct {
// contains filtered or unexported fields
}
A PrepareResult represents the result of a prepare statement.
func (*PrepareResult) Check ¶ added in v0.99.0
func (pr *PrepareResult) Check(qd *QueryDescr) error
Check checks consistency of the prepare result.
func (*PrepareResult) IsProcedureCall ¶ added in v0.99.0
func (pr *PrepareResult) IsProcedureCall() bool
IsProcedureCall returns true if the statement is a call statement.
func (*PrepareResult) NumField ¶ added in v0.99.0
func (pr *PrepareResult) NumField() int
NumField returns the number of parameter fields in a database statement.
func (*PrepareResult) NumInputField ¶ added in v0.99.0
func (pr *PrepareResult) NumInputField() int
NumInputField returns the number of input fields in a database statement.
func (*PrepareResult) PrmField ¶ added in v0.99.0
func (pr *PrepareResult) PrmField(idx int) Field
PrmField returns the parameter field at index idx.
func (*PrepareResult) StmtID ¶ added in v0.99.0
func (pr *PrepareResult) StmtID() uint64
StmtID returns the statement id.
type QueryDescr ¶ added in v0.99.0
type QueryDescr struct {
// contains filtered or unexported fields
}
QueryDescr represents a query descriptor of a database statement.
func NewQueryDescr ¶ added in v0.99.0
func NewQueryDescr(query string, sc *scanner.Scanner) (*QueryDescr, error)
NewQueryDescr returns a new QueryDescr instance.
func (*QueryDescr) ID ¶ added in v0.99.0
func (d *QueryDescr) ID() uint64
ID return the query id of a query descriptor (legacy mode: call table output parameters).
func (*QueryDescr) IsBulk ¶ added in v0.99.0
func (d *QueryDescr) IsBulk() bool
IsBulk returns true if the query is a bulk statement..
func (*QueryDescr) Kind ¶ added in v0.99.0
func (d *QueryDescr) Kind() QueryKind
Kind return the query kind of a query descriptor.
func (*QueryDescr) Query ¶ added in v0.99.0
func (d *QueryDescr) Query() string
Query return the query statement of a query descriptor.
func (*QueryDescr) String ¶ added in v0.99.0
func (d *QueryDescr) String() string
type QueryKind ¶ added in v0.99.0
type QueryKind int
QueryKind is the query type of a database statement.
type ReadProvider ¶ added in v0.99.0
ReadProvider is the interface wrapping the Reader which provides an io.Reader.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a HDB session.
func NewSession ¶
func NewSession(ctx context.Context, cfg SessionConfig) (*Session, error)
NewSession creates a new database session.
func (*Session) CloseResultsetID ¶
CloseResultsetID releases the hdb resultset handle.
func (*Session) DropStatementID ¶
DropStatementID releases the hdb statement handle.
func (*Session) Exec ¶
func (s *Session) Exec(pr *PrepareResult, args []driver.NamedValue) (driver.Result, error)
Exec executes a sql statement.
func (*Session) ExecCall ¶ added in v0.99.0
func (s *Session) ExecCall(pr *PrepareResult, args []driver.NamedValue) (driver.Result, error)
ExecCall executes a stored procecure (by Exec).
func (*Session) ExecDirect ¶
ExecDirect executes a sql statement without statement parameters.
func (*Session) MaxBulkNum ¶ added in v0.99.0
MaxBulkNum returns the maximal number of bulk calls before auto flush.
func (*Session) Prepare ¶
func (s *Session) Prepare(query string) (*PrepareResult, error)
Prepare prepares a sql statement.
func (*Session) Query ¶
func (s *Session) Query(pr *PrepareResult, args []driver.NamedValue) (driver.Rows, error)
Query executes a query.
func (*Session) QueryCall ¶ added in v0.99.0
func (s *Session) QueryCall(pr *PrepareResult, args []driver.NamedValue) (driver.Rows, error)
QueryCall executes a stored procecure (by Query).
func (*Session) QueryDirect ¶
QueryDirect executes a query without query parameters.
type SessionConfig ¶ added in v0.99.0
type SessionConfig interface {
Host() string
Username() string
Password() string
Locale() string
BufferSize() int
FetchSize() int
BulkSize() int
LobChunkSize() int32
Timeout() int
TCPKeepAlive() time.Duration
Dfv() int
TLSConfig() *tls.Config
Legacy() bool
}
SessionConfig represents the session relevant driver connector options.
type Sniffer ¶
type Sniffer struct {
// contains filtered or unexported fields
}
A Sniffer is a simple proxy for logging hdb protocol requests and responses.
func NewSniffer ¶
NewSniffer creates a new sniffer instance. The conn parameter is the net.Conn connection, where the Sniffer is listening for hdb protocol calls. The dbAddr is the hdb host port address in "host:port" format.
type WriterSetter ¶ added in v0.99.0
WriterSetter is the interface wrapping the SetWriter method (Lob handling).
Source Files
¶
- authentication.go
- bytes.go
- clientid.go
- command.go
- connectoption.go
- connectoption_string.go
- connectoptions.go
- convert.go
- datatype.go
- datatype_string.go
- doc.go
- endianess.go
- endianess_string.go
- error.go
- errorlevel.go
- fetchsize.go
- field.go
- fieldtype.go
- functioncode.go
- functioncode_string.go
- init.go
- julian.go
- lob.go
- lobtypecode_string.go
- log.go
- message.go
- messagetype.go
- messagetype_string.go
- option.go
- parameter.go
- part.go
- partkind.go
- partkind_string.go
- parts.go
- parts1.14.go
- protocol.go
- querydescr.go
- queryresultset.go
- result.go
- rowsaffected.go
- segment.go
- segmentkind.go
- segmentkind_string.go
- session.go
- sniffer.go
- statementcontext.go
- statementcontexttype.go
- statementcontexttype_string.go
- statementid.go
- topology.go
- topologyoption.go
- topologyoption_string.go
- transactionflags.go
- transactionflagtype.go
- transactionflagtype_string.go
- typecode.go
- typecode_string.go